Ramp Instant REST API Reference

General info

API base path: https://api-instant.ramp.network/api

All request and response bodies should be in JSON, with corresponding application/json headers.

If an error is returned, the response body is also a JSON object, with a code property describing the problem, and optionally more properties providing additional details.

Available assets and prices

Endpoint: GET /host-api/assets

Query parameters:

  • currencies (optional): comma-separated list of currency codes for which we should return asset prices.
    • If not provided, all available currencies will be used.
    • If provided, only available currencies from the list will be used.
    • If no requested currencies are available, an error is returned, with code SERVICES.HOST_API.NO_CURRENCIES_AVAILABLE.
  • hostApiKey (optional): if you have a custom integration, provide the key to access your enabled features.
    • If provided, the response will contain an enabledFeatures property with a list of the features enabled.
    • Contact us at partner@ramp.network if you want a custom integration :)

Response contents

interface HostAssetsConfig {
assets!: AssetInfo[];
enabledFeatures?: string[];
}
// All the dictionaries are plain objects indexed by currencies (uppercase ISO 4217 3-letter codes).
interface AssetInfo {
// For ETH, address is `0x000...000`.
address!: string;
symbol!: string;
name!: string;
decimals!: number;
// Last known price for one whole asset unit (1 ETH/DAI), in EUR
priceEur!: number;
priceUpdateTs!: Date;
// Max asset amount that can be currently bought at once, in wei/units per currency code.
maxSinglePurchase!: Dictionary<string>;
// Price of a single whole asset unit (1 ETH / 1 DAI).
price!: Dictionary<number>;
}

Example

Request:

curl -X GET https://api-instant.ramp.network/api/host-api/assets?currencies=GBP

Response:

{
"assets": [
{
"address": "0x0000000000000000000000000000000000000000",
"symbol": "ETH",
"name": "Ether",
"decimals": 18,
"priceEur": 146.204351612996,
"priceUpdateTs": "2020-01-24T12:47:08.475Z",
"maxSinglePurchase": {
"GBP": "9900990099009900990"
},
"price": {
"EUR": 146.204351612996,
"PLN": 34.36787710229498,
"USD": 130.94295070798083,
"GBP": 123.30407161114876
}
},
{
"address": "0x6b175474e89094c44da98b954eedeac495271d0f",
"symbol": "DAI",
"name": "Multi-Collateral DAI",
"decimals": 18,
"priceEur": 0.906651167794897,
"priceUpdateTs": "2020-01-24T12:47:08.494Z",
"maxSinglePurchase": {
"GBP": "541154455445544554455"
},
"price": {
"EUR": 0.906651167794897,
"PLN": 0.21312413458052976,
"USD": 0.8120112559176902,
"GBP": 0.7646405820808438
}
}
]
}

Purchase status

Endpoint: GET /purchase/{id}

Path parameter: id (required): id of the purchase, received from a SDK event or a webhook call.

Query parameter: secret (required): the purchaseViewToken received with the same purchase created event.

Response contents

A single RampInstantPurchase object, the same that's used in webhook calls.

Example

Request:

curl -X GET https://api-instant.ramp.network/api/host-api/purchase/123?secret=xxxxxxxx

Response:

{
"id": "123",
"endTime": "2019-10-29T15:41:41.065Z",
"asset": {
"address": null,
"symbol": "ETH",
"name": "Ether",
"decimals": 18
},
"escrowAddress": "0x528bfce01f58390c9eb81419061cd617896348be",
"cryptoAmount": "30000000000000000",
"fiatCurrency": "GBP",
"fiatValue": 0.04,
"assetExchangeRate": 1.27378941587846,
"poolFee": 0.000573205237145307,
"rampFee": 0.000573205237145307,
"purchaseHash": "...",
"purchaseViewToken": "...",
"receiverAddress": "0x2222222222222222222222222222222222222222",
"actions": [
{
"id": 1176,
"newStatus": "INITIALIZED",
"timestamp": "2019-10-24T14:41:39.372Z"
},
{
"id": 1177,
"newStatus": "ESCROW_CREATING",
"timestamp": "2019-10-24T14:41:41.065Z",
"details": "0x0ea7394fc7430be5c17484cdda08b138b1bb9f6f1af9f827a7b6df50ca0cfa25"
},
{
"id": 1178,
"newStatus": "ESCROW_CREATED",
"timestamp": "2019-10-24T15:41:41.065Z",
"details": "0x528bfce01f58390c9eb81419061cd617896348be"
}
]
}