Creating a Sell All Order
The following are the sample requests and responses for Sell All API. The response is exactly the same as the Transactional Quote endpoint. This is usable only if Coinme’s custody wallet manages the user’s crypto assets.
Sample API Request: POST
URL: https://caas-staging.coinme.com/services/cryptoquote/sell-all
headers:
"Authorization":"asdfghj", //authorization token,required
'User-Agent: partnerapi' //required
Request Body:
{
"customerId": "654987321", //required
"debitCurrencyCode":"DOGE", // required
"creditCurrencyCode":"USD",//required
"cryptoSettlementType": "EXTERNAL", // optional, possible values are "INTERNAL" or "EXTERNAL". defaults to "INTERNAL". Use "EXTERNAL" to also calculate blockchain fees
"chain": "XLM" //optional, possible values are "XLM" or "ETH". use only if Coinme supports trading this currency on multiple chains. otherwise unnecessary
}
Sample API Response:
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": "eyJhbGciOiJIUzI1NiJ9.eyJxdW90ZSI6eyJwcmljZSI6IjM4NTA0Ljc4IiwiZXhwaXJlc0luIjo2MCwiZXhwaXJhdGlvblRpbWUiOiIyMDIyLTAyLTAxVDE4OjU5OjI4LjI5N1oiLCJxdW90ZUNvZGUiOm51bGwsImN1cnJlbmN5UGFpciI6IkJUQy9VU0QiLCJpbnZlcnRlZFByaWNlIjoiMC4wMDAwMjU5NyIsImFwcGxpY2FibGVGZWVQZXJjZW50YWdlcyI6bnVsbCwiYXBwbGljYWJsZURpc2NvdW50UGVyY2VudGFnZXMiOm51bGx9LCJwcm92aWRlck5hbWUiOiJCaXR0cmV4In0.jUHyINH8t71Xyk2GonwIwIkAIuIfT6L64Y4eNnU_gvA",
"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.4" // present if request had cryptoSettlementType: EXTERNAL
},
"spreadAmount":"0.117",
"spreadCurrencyCode":"USD",
"timestamp":"2022-02-01T18:59:28.297Z"//UTC
},
"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"
}
]
}Updated 6 days ago
What’s Next