# Withdraw Coin

### This method is for withdrawing assets (except IDR).

To be able to use this method you need to enable withdraw permission when you generate the API Key. Otherwise you will get “No permission” error.

You also need to prepare a Callback URL. Callback URL is a URL that our system will call to verify your withdrawal requests. Various parameters will be sent to Callback URL, make sure to check this information on your server side. If all the data is correct, print out a string “ok” (without quotes). We will continue the request if only we receive “ok” (without quotes) response, otherwise the request will be failed.

Callback call will be sent through a POST request, with 5 seconds connection timeout.

| Parameter         | Required | Value                                 | Description                                                                                                                                                                                                          |
| ----------------- | -------- | ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| currency          | Yes      | btc, ltc, doge, eth, etc              | Currency to withdraw                                                                                                                                                                                                 |
| withdraw\_address | Yes      | a valid address                       | Receiver address                                                                                                                                                                                                     |
| withdraw\_amount  | Yes      | numerical                             | Amount to send                                                                                                                                                                                                       |
| withdraw\_memo    | No       | a valid memo/message/destin ation tag | Memo to be sent to the receiver, if supported by the asset platform. Exchanges use this memo for accepting deposits for certain assets. Example: Destination Tag (for Ripple) Message (for NXT) Memo (for BitShares) |
| request\_id       | Yes      | alphanumeric, max length 255          | Custom string you need to provide to identify each withdrawal request. request\_id will be passed to callback call so your system can identify the request.                                                          |
| network           | yes      | erc20, trc20, bep2, bep20             | Currency network if exist                                                                                                                                                                                            |

<details>

<summary>Body JSON</summary>

```shell
{
    "method": "withdrawCoin",
    "timestamp": "1578304294000",
    "recvWindow": "1578303937000",
    "currency" : "doge",
    "withdraw_address" : "D9iCdBLBosJzGSvpQGMSobwtdgB2rS1zam",
    "withdraw_amount" : "10",
    "withdraw_memo" : "memo",
    "request_id" : "trx002"
}
```

</details>

<mark style="color:green;">`POST`</mark> `https://us-central1-appgregator.cloudfunctions.net/indodax/method/`

#### Query Parameters

| Name                                               | Type   | Description  |
| -------------------------------------------------- | ------ | ------------ |
| name<mark style="color:red;">\*</mark>             | String | qantor.co.id |
| connection\_name<mark style="color:red;">\*</mark> | String | crypto01     |

#### Headers

| Name                                         | Type   | Description                                      |
| -------------------------------------------- | ------ | ------------------------------------------------ |
| x-api-key<mark style="color:red;">\*</mark>  | String | U2Fsd...                                         |
| secret-key<mark style="color:red;">\*</mark> | String | <p>84c7373b....(your indodax secret key)<br></p> |

{% tabs %}
{% tab title="200: OK Success" %}
```shell
{
    "success": 1,
    "status": "approved",
    "withdraw_currency": "doge",
    "withdraw_address": "D9iCdBLBosJzGSvpQGMSobwtdgB2rS1zam",
    "withdraw_amount": "10.00000000",
    "fee": "5.00000000",
    "amount_after_fee": "5.00000000",
    "submit_time": "1578909560",
    "withdraw_id": "doge-1941965",
    "txid": ""
}
```
{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="cURL" %}
```shell
curl --location --request POST 'https://us-central1-appgregator.cloudfunctions.net/indodax/method/?name=qantor.co.id&connection_name=crypto01' \
--header 'secret-key: 84c7373...' \
--header 'x-api-key: U2Fsd...' \
--header 'Content-Type: application/json' \
--data-raw '{
    "method": "withdrawCoin",
    "timestamp": "1578304294000",
    "recvWindow": "1578303937000",
    "currency" : "doge",
    "withdraw_address" : "D9iCdBLBosJzGSvpQGMSobwtdgB2rS1zam",
    "withdraw_amount" : "10",
    "withdraw_memo" : "memo",
    "request_id" : "trx002"
}'
```
{% endtab %}

{% tab title="NodeJs - Axios" %}
```javascript
var axios = require('axios');
var data = JSON.stringify({
  "method": "withdrawCoin",
  "timestamp": "1578304294000",
  "recvWindow": "1578303937000",
  "currency": "doge",
  "withdraw_address": "D9iCdBLBosJzGSvpQGMSobwtdgB2rS1zam",
  "withdraw_amount": "10",
  "withdraw_memo": "memo",
  "request_id": "trx002"
});

var config = {
  method: 'post',
  url: 'https://us-central1-appgregator.cloudfunctions.net/indodax/method/?name=qantor.co.id&connection_name=crypto01',
  headers: { 
    'secret-key': '84c7373...', 
    'x-api-key': 'U2Fsd...', 
    'Content-Type': 'application/json'
  },
  data : data
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});

```
{% endtab %}

{% tab title="PHP - cURL" %}
```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://us-central1-appgregator.cloudfunctions.net/indodax/method/?name=qantor.co.id&connection_name=crypto01',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "method": "withdrawCoin",
    "timestamp": "1578304294000",
    "recvWindow": "1578303937000",
    "currency" : "doge",
    "withdraw_address" : "D9iCdBLBosJzGSvpQGMSobwtdgB2rS1zam",
    "withdraw_amount" : "10",
    "withdraw_memo" : "memo",
    "request_id" : "trx002"
}',
  CURLOPT_HTTPHEADER => array(
    'secret-key: 84c7373...',
    'x-api-key: U2Fsd...',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```
{% endtab %}
{% endtabs %}
