# General

Below is the general information regarding our API URL and the tokens supported.

## API URL <a href="#api-url" id="api-url"></a>

{% hint style="warning" %}
Make sure to use the correct API URL corresponding to the account you are using. To verify, please check your current login URL based on below.

Mainnet: [https://merchant.coinsdo.com](https://merchant.coinsdo.com/) \
Testnet: [https://merchant.coinsdotest.com/](https://merchant.coinsdotest.com/)
{% endhint %}

<table><thead><tr><th width="173">Environment</th><th>URL</th></tr></thead><tbody><tr><td>Mainnet </td><td><code>https://open.coinsdo.com/coinsdo/open</code></td></tr><tr><td>Testnet</td><td><code>https://open.coinsdotest.com/coinsdo/open</code></td></tr></tbody></table>

## Supported Tokens <a href="#supported-tokens" id="supported-tokens"></a>

Please go to currency control list in your CoinSend/CoinGet center for the most up-to-date list of support tokens and also coinsDoId for making API request.

![](https://3529283920-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbq6zziU9PCtrTYtaegKj%2Fuploads%2FQkmJGuZCpj9ivOMQoPzp%2Fimage.png?alt=media\&token=836f86ad-a1e9-4667-a4c2-9982f579b339)

## How to make API request  <a href="#request-api" id="request-api"></a>

Below are the standard rules for making an API request with the CoinsDo Open API.

### **Request parameters**

* Header

<table><thead><tr><th width="129.83723958333331">Parameter</th><th width="90.23046875">Required</th><th>Value</th></tr></thead><tbody><tr><td>Content-Type</td><td>Yes</td><td>application/json</td></tr></tbody></table>

* Body&#x20;

<table><thead><tr><th width="110.36328125">Parameter</th><th width="89.98046875">Required</th><th width="79.6796875">Type</th><th>Description</th></tr></thead><tbody><tr><td>sign</td><td>Yes</td><td>string</td><td>Signature</td></tr><tr><td>data</td><td>Yes</td><td>string</td><td>Content（JSON string, depends on each API）</td></tr></tbody></table>

### Signing

Generate the signature by hashing the data using HMAC-SHA256 with the Secret-KEY linked to your API-KEY or merchant account. The resulting hash is the signature.

```
{
        "data": "{\"apiKey\":\"cd384rt80f5575dc\",\"mainnet\":\"TRX\",\"targetDeviceUuid\":\"085C28EC-0BD6-442B-8232-D23BC8F4D58E\",\"timestamp\":\"1622775712229\",\"addressRemark\":\"trx address\"}",
        "sign": "852cd95d5045f3e41db0447cdde405b73cc03b8844b76da74bd0b498470cba75"
}
```

### **Response**

```
{
  "code": 200, // Status code
  "msg": "Success", // Remarks
  "data": null // Response 
}
```

### **Status code**

{% hint style="info" %}
Below is a general list of status codes, and each API endpoint may have its own differences.
{% endhint %}

<table><thead><tr><th width="114.82421875">Status code</th><th>Description</th></tr></thead><tbody><tr><td>-2</td><td>System error</td></tr><tr><td>200</td><td>Success</td></tr><tr><td>4001</td><td>API endpoints not found</td></tr><tr><td>4002</td><td>Parameters in wrong format</td></tr><tr><td>4003</td><td>JSON data conversion abnormal</td></tr><tr><td>4004</td><td>API Key does not exists</td></tr><tr><td>4005</td><td>IP Restricted</td></tr><tr><td>4007</td><td>Signature verification failed</td></tr><tr><td>4010</td><td>Request expired</td></tr><tr><td>4068</td><td>Failed to verify APIKEY</td></tr></tbody></table>

## Webhook notification <a href="#webhook-notification" id="webhook-notification"></a>

Below are the details of the webhook requests are sent from CoinsDo to webhook URL.

### **Request**

<mark style="color:green;">`POST`</mark> `/{webhookURL}`

* Header

<table><thead><tr><th width="130.11848958333331">Parameter</th><th width="99.93359375">Required</th><th>Value</th></tr></thead><tbody><tr><td>Content-Type</td><td>Yes</td><td>application/json</td></tr></tbody></table>

* Body

<table><thead><tr><th width="104.9921875">Parameter</th><th width="99.6484375">Required</th><th width="79.89453125">Type</th><th>Description</th></tr></thead><tbody><tr><td>sign</td><td>Yes</td><td>string</td><td>Signature</td></tr><tr><td>data</td><td>Yes</td><td>string</td><td>Content（JSON string）</td></tr></tbody></table>

### **Response**

```
{
  "code": 200, // Status code
  "msg": "Success", // Remarks
  "data": null // Response
}
```

### How you should respond? <a href="#callback-scenario" id="callback-scenario"></a>

This section suggests whether you should respond to the callback.

When you execute, the return code should display 200 if the callback is successful. Once it is successful, there will be no further callbacks.

If you choose to ignore, the return code should display 202 if it is successful. There will be no callbacks (Choosing to ignore is similar to the 200 status in terms of effect. The only difference is whether you want to handle the suggested display).

<table><thead><tr><th width="107.203125">Scenario</th><th width="405">Example</th><th>Suggestion</th></tr></thead><tbody><tr><td>Transfer</td><td>Transfer request on the in CoinSend (success/rejected/cancelled).</td><td>Respond with code 200</td></tr><tr><td>Receive (confirmed by 1 block)</td><td>Transaction confirmed by 1 block.</td><td>Respond with code 200 /ignore</td></tr><tr><td>Receive (confirm by specific number of blocks)</td><td>Target blockchain confirmations have been reached and verified successfully (final status) and credited.</td><td>Respond with code 200 and update </td></tr></tbody></table>
