Getting a Transactional Quote

Return a crypto quote for the amount exchanged from one currency to another and its expiration time in UTC. The response also includes a quoteId, which can be used to initiate a buy or sell transaction. Quotes expire after 30 seconds by default.

🚧

Passing EXTERNAL value for cryptoSettlementType field is MANDATORY for this endpoint if sending to a wallet not custodied by Coinme


debitCurrencyCode refers to the asset the user is selling and creditCurrencyCode refers to the asset the user is buying

For example, if a user is buying DOGE, then debitCurrencyCode = USD and creditCurrencyCode = DOGE

Crypto Quote using USD Amount

Crypto quotes can be retrieved using a specified USD amount

Buy $100 in DOGE with Debit Card Example

Sample API Request for BUY: POST

URL: https://caas-staging.coinme.com/services/cryptoquote
headers:
"Authorization":"asdfghj", //authorization token, required
'User-Agent: partnerapi' //required
Request Body:
{
  "customerId": "654987321", //required
  "providerId": "654987321", //optional. required if using Coinme payment processing
  "debitCurrencyCode":"USD", // required
  "creditCurrencyCode":"DOGE", //required
  "amountValue":"100", //required
  "amountCurrencyCode":"USD", //required
  "cryptoSettlementType": "EXTERNAL", // optional, possible values are "INTERNAL" or "EXTERNAL". defaults to "INTERNAL". Use "EXTERNAL" to also calculate blockchain fees
  "chain": "" //optional, possible values are "XLM", "ETH", "SOL" or "LINEA". use only if Coinme supports trading this currency on multiple chains. otherwise unnecessary 
}

Sample API Response for BUY:

Note: spread = 0.015, market value for 1 USD to Dogecoin = 7.8

Successful Response:
{
  "data": 
  {
    "expiresIn": 30000, // in milliseconds
    "expirationTime": "2022-02-01T18:59:28.297Z", //UTC
    "quoteId": "1006491596889587712",
    "creditCurrencyUnitPrice":"7.917", // 7.8(market value for 1 USD to Dogecoin)*(1+ 0.015(spread))
    "creditCurrencyUnitPriceCode":"DOGE/USD",
    "debitCurrencyUnitPrice":"0.1263104711", // 1/7.917(creditCurrencyUnitPrice)
    "debitCurrencyUnitPriceCode":"USD/DOGE",
    "creditCurrencyAmount":"771.9075", // include the spread.Calculation- (100(debitCurrencyAmount)-2.5(totalFees))*7.917(creditCurrencyUnitPrice)
    "creditCurrencyCode":"DOGE",
    "debitCurrencyAmount":"100",// Amount value requested by User
    "debitCurrencyCode":"USD",
    "totalFees":"2.5", // exchange fee value
    "feeCurrencyCode":"USD", // exchange fee currency code
    "feesMap":{
      "exchangeFee":"2.5",
      "processingFee":"0",
      "blockchainFee": "0.3" // will be present if cryptoSettlementType is EXTERNAL
    },
    "spreadAmount":"0.117",
    "spreadCurrencyCode":"USD",
  },
  "errorResponse": null
}

Failure Response:
{
  "data": null,
  "errorResponse": {
    "httpStatus":"200",
    "timestamp":"2022-02-01T18:59:28.297Z",// UTC
    "path":"/services/cryptoquote POST",
    "errorData": [
      {
        "errorCode":"123-123-123-123",// The error code is just a sample showing the structure of the error code.
        "message":"CreditCurrencyCode cannot be same as DebitCurrencyCode"
      }
    ]
}

Sell $100 in DOGE with Debit Card Example

Sample API Request for SELL: POST

URL: https://caas-staging.coinme.com/services/cryptoquote
headers:
"Authorization":"asdfghj", //authorization token, required
'User-Agent: partnerapi' //required
Request Body:
{
  "customerId": "654987321", //required
  "providerId": "654987321", //optional. required if using Coinme payment processing
  "debitCurrencyCode":"DOGE", //required
  "creditCurrencyCode":"USD" //required
  "amountValue":"100", //required
  "amountCurrencyCode":"USD", //required
  "cryptoSettlementType": "EXTERNAL", // optional, possible values are "INTERNAL" or "EXTERNAL". defaults to "INTERNAL". Use "EXTERNAL" to also calculate blockchain fees
  "chain": "" //optional, possible values are "XLM", "ETH" "LINEA". use only if Coinme supports trading this currency on multiple chains. otherwise unnecessary
}

Sample API Response for SELL:

Note: spread = 0.015, market value for 1 USD to Dogecoin = 7.8

Successful Response:
{
  "data": 
  {
    "expiresIn": 30000,// in milliseconds
    "expirationTime": "2022-02-01T18:59:28.297Z",//UTC
    "quoteId": "1006491596889587712",
    "creditCurrencyUnitPrice":"0.1301574906",//1/(7.8(market value for 1 USD to Dogecoin) * (1 - 0.015(spread)))
    "creditCurrencyUnitPriceCode":"USD/DOGE",
    "debitCurrencyUnitPrice":"7.683",// 1/0.1301574906(creditCurrencyUnitPrice)
    "debitCurrencyUnitPriceCode":"DOGE/USD",
    "creditCurrencyAmount":"100",//Amount value requested by User 
    "creditCurrencyCode":"USD",
    "debitCurrencyAmount":"749.0925",//Calculation: 7.683(debitCurrencyUnitPrice)*(100(creditCurrencyAmount)-2.5(totalFees))
    "debitCurrencyCode":"DOGE",
    "totalFees":"2.5",//exchange fee value
    "feeCurrencyCode":"USD", // exchange fee currency code
    "feesMap":{
      "exchangeFee":"2.5",
      "processingFee":"0",
      "blockchainFee": "0.3" // will be present if cryptoSettlementType is EXTERNAL
    },
    "spreadAmount":"0.117",
    "spreadCurrencyCode":"USD",
    "promoCode":"noFees", //optional
  },
  "errorResponse": null
}

Failure Response:
{
  "data": null,
  "errorResponse": {
    "httpStatus":"200",
    "timestamp":"2022-02-01T18:59:28.297Z",//UTC
    "path":"/services/cryptoquote POST",
    "errorData": [
      {
        "errorCode":"123-123-123-123",//The error code is just a sample showing the structure of the error code.
        "message":"CreditCurrencyCode cannot be same as DebitCurrencyCode"
      }
    ]
}

Sell $100 in DOGE to Physical Cash Example

Partners can enable their users to sell crypto for physical cash at 20,000 ATM locations in the U.S. Partners must specify the providerId of the cash provider (given by Coinme) and the location, either through locationReference or gpsCoordinates.

Cash off-ramp locations are found using the Get Locations endpoint.

Sample API Request for SELL: POST

URL: https://caas-staging.coinme.com/services/cryptoquote
headers:
"Authorization":"asdfghj", //authorization token,required
'User-Agent: partnerapi' //required
Request Body:
{
  "customerId": "654987321" //required
  "providerId": "654987321", //required when using Coinme cash off-ramp
  "debitCurrencyCode":"DOGE" // required
  "creditCurrencyCode":"USD"//required
  "amountValue":"100", //required
  "amountCurrencyCode":"USD", //required
  "locationReference": "9821392", //optional, should be specified only if fiat settlement is done through Coinme and requires a physical location
  "gpsCoordinates": { //optional, alternative to "locationReference"
    "latitude": "-78.617716",
    "longitude": "62.936942"
    },
  "cryptoSettlementType": "EXTERNAL", // optional, possible values are "INTERNAL" or "EXTERNAL". defaults to "INTERNAL". Use "EXTERNAL" to also calculate blockchain fees
  "chain": "" //optional, possible values are "XLM", "ETH" "LINEA". use only if Coinme supports trading this currency on multiple chains. otherwise unnecessary
}

Sample API Response for SELL:

Note: spread = 0.015, market value for 1 USD to Dogecoin = 7.8

Successful Response:
{
  "data": 
  {
    "expiresIn": 30000,// in milliseconds
    "expirationTime": "2022-02-01T18:59:28.297Z",//UTC
    "quoteId": "1006491596889587712",
    "creditCurrencyUnitPrice":"0.1301574906",//1/(7.8(market value for 1 USD to Dogecoin) * (1 - 0.015(spread)))
    "creditCurrencyUnitPriceCode":"USD/DOGE",
    "debitCurrencyUnitPrice":"7.683",// 1/0.1301574906(creditCurrencyUnitPrice)
    "debitCurrencyUnitPriceCode":"DOGE/USD",
    "creditCurrencyAmount":"100",//Amount value requested by User 
    "creditCurrencyCode":"USD",
    "debitCurrencyAmount":"749.0925",//Calculation: 7.683(debitCurrencyUnitPrice)*(100(creditCurrencyAmount)-2.5(totalFees))
    "debitCurrencyCode":"DOGE",
    "totalFees":"2.5",//exchange fee value
    "feeCurrencyCode":"USD", // exchange fee currency code
    "feesMap":{
      "exchangeFee":"2.5",
      "processingFee":"0",
      "blockchainFee": "0.3" // will be present if cryptoSettlementType is EXTERNAL
    },
    "spreadAmount":"0.117",
    "spreadCurrencyCode":"USD",
    "promoCode":"noFees", //optional
  },
  "errorResponse": null
}

Failure Response:
{
  "data": null,
  "errorResponse": {
    "httpStatus":"200",
    "timestamp":"2022-02-01T18:59:28.297Z",//UTC
    "path":"/services/cryptoquote POST",
    "errorData": [
      {
        "errorCode":"123-123-123-123",//The error code is just a sample showing the structure of the error code.
        "message":"CreditCurrencyCode cannot be same as DebitCurrencyCode"
      }
    ]
}


Crypto Quote using Crypto Amount

Quotes can also use cryptocurrencies (i.e., BTC) as the amount when the user wants to buy/sell a specific amount of crypto.

Buy .000987 BTC with Debit Card Example

Sample API Request for BUY: POST

URL: https://caas-staging.coinme.com/services/cryptoquote
headers:
"Authorization":"asdfghj", //authorization token,required,
'User-Agent: partnerapi' //required
Request Body:
{
  "customerId": "654987321", //required
  "providerId": "654987321", //optional. required if using Coinme payment processing
  "debitCurrencyCode":"USD", // required
  "creditCurrencyCode":"BTC", //required
  "amountValue":"0.000987", //required
  "amountCurrencyCode":"BTC", //required
  "cryptoSettlementType": "EXTERNAL", // optional, possible values are "INTERNAL" or "EXTERNAL". defaults to "INTERNAL". Use "EXTERNAL" to also calculate blockchain fees
  "chain": "" //optional, possible values are "XLM", "ETH", "SOL" or "LINEA". use only if Coinme supports trading this currency on multiple chains. otherwise unnecessary 
}

Sample API Response for BUY:

{
    "data": {
        "quoteId": "1251838985953988608",
        "creditCurrencyUnitPrice": "0.00000906",
        "creditCurrencyUnitPriceCode": "BTC/USD",
        "debitCurrencyUnitPrice": "110379.90",
        "debitCurrencyUnitPriceCode": "USD/BTC",
        "creditCurrencyAmount": "0.00098700",
        "creditCurrencyCode": "BTC",
        "debitCurrencyAmount": "118.81",
        "debitCurrencyCode": "USD",
        "totalFees": "9.87",
        "feeCurrency": "USD",
        "feesMap": {
            "blockchainFee": "9.87"
        },
        "expiresIn": 60000,
        "expirationTime": "2025-06-16T10:02:12.295Z",
        "spread": "2.61",
        "spreadCurrencyCode": "USD",
        "chain": "BTC"
    },
    "errorResponse": null

Getting Crypto Quote Details

Crypto quote details can be retrieved by adding quoteId to the cryptoquote path

Sample API Request for CryptoQuote: GET

URL: https://caas-staging.coinme.com/services/cryptoquote/{quoteId}
headers:
"Authorization":"asdfghj", //authorization token,required
'User-Agent: partnerapi' //required

SampleResponse for CryptoQuote: GET

{
    "data": {
        "quoteId": "1016647805236006912",
        "creditCurrencyUnitPrice": "0.00003840",
        "creditCurrencyUnitPriceCode": "BTC/USD",
        "debitCurrencyUnitPrice": "26041.78",
        "debitCurrencyUnitPriceCode": "USD/BTC",
        "creditCurrencyAmount": "0.00028147",
        "creditCurrencyCode": "BTC",
        "debitCurrencyAmount": "7.47",
        "debitCurrencyCode": "USD",
        "totalFees": "0.14",
        "feeCurrency": "USD",
        "feesMap": {
            "exchangeFee": "0.14",
            "blockchainFee": "0.3" // will be present if cryptoSettlementType is EXTERNAL
        },
        "expiresIn": 54600,
        "expirationTime": "2023-09-06T09:56:25.171Z",
        "spread": "0.08",
        "spreadCurrencyCode": "USD"
    },
    "errorResponse": null
}

Error Codes

Error CodeError Message
280-500-201-000Internal error occurred, please try again or contact support
280-500-201-999Internal error occurred, please contact support
280-400-201-667Field <field_name> cannot be null or empty
280-400-201-902CreditCurrencyCode cannot be same as DebitCurrencyCode
280-400-201-901AmountCurrencyCode must match DebitCurrencyCode or CreditCurrencyCode
280-400-201-909Unsupported operation BUY/SELL
280-400-201-903amountCurrencyCode must be of type FIAT
280-400-201-910Promo code is not valid!
280-400-201-913Currency {currency} is NOT supported for partnerId {partnerId}
280-400-201-914Did not receive chain in request for partner {partnerId} and currency {currency}
280-400-201-915Received invalid value {chain} for currency {currency}, valid chains are: [list of valid chains for this currency]
280-400-201-916NO {currency} wallet found for user {userId} and partnerId {partnerId}
280-400-201-917{currency} wallet doesn’t have enough balance for user {userId} and partnerId {partnerId}
280-400-201-918Fees {fees} are higher than input {amount}, unable to create quote!

Error messages for errors that occur while retrieving user data:

Error CodeError Message
121-500-317-000Internal error occurred, please try again or contact support
121-404-317-704UserProfile not found with identifier: partnerId=<partner_id> and accountId=<account_id>
121-401-317-706User profile for account <account_id> found, but account is currently locked

Error messages for errors that occur while retrieving partner data:

Error CodeError Message
205-500-317-000Internal error occurred, please try again or contact support
205-400-317-602Field <field> can’t be empty or null
205-400-317-600Field <field> exceeds maximum length of <max_length>
205-404-317-704PartnerAssignedProvider resource not found with identifier partnerId=<partner_id> and providerId=<provider_id>
205-400-317-702Unsupported partner currency: <currency>
205-400-317-802Unsupported provider currency: <currency>