# Confirm Withdrawal

<mark style="color:blue;">**`POST`**</mark> `https://api.sfox.com/v1/user/withdraw/confirm`

Confirm a user's withdrawal request.

Once a withdrawal is initiated, a 6-digit OTP[^1] code will be sent to the user's email address.  Collect this code from the user and submit it along with the ID of the withdrawal using this request to confirm the user's withdrawal. Once confirmed, the withdrawal will begin processing.

{% hint style="info" %}
**Authentication:** This endpoint requires a [User Auth Token](https://docs.sfox.com/connect/rest-api/end-users/create-user-auth-token) for authentication. Requests using your Connect API Key will be rejected.
{% endhint %}

### Body Parameters

<table><thead><tr><th width="215">Name</th><th width="115">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong><code>otp</code></strong>  <mark style="color:red;">required</mark></td><td>string</td><td>The 6-digit OTP code sent to the user's email</td></tr><tr><td><strong><code>atx_id</code></strong> <mark style="color:red;">required</mark></td><td>number</td><td>The transaction ID (<code>atx_id</code>) of the withdrawal you are confirming</td></tr></tbody></table>

### Response Body

<table><thead><tr><th width="173.33333333333331">Key</th><th width="562">Description</th></tr></thead><tbody><tr><td><strong><code>success</code></strong></td><td>Whether the request for a new confirmation code was successful or not</td></tr><tr><td><strong><code>atx_id</code></strong></td><td>The transaction ID of the withdrawal you are requesting a code for</td></tr><tr><td><strong><code>tx_status</code></strong></td><td>The transaction status of the withdrawal</td></tr></tbody></table>

### Responses

<details>

<summary><mark style="color:green;"><strong>200 OK</strong></mark></summary>

```json
{
    "data": {
        "success": true,
        "atx_id": 1525624,
        "tx_status": 1160
    }
}
```

</details>

{% tabs %}
{% tab title="Shell" %}

```shell
curl -X POST \
  -H 'Content-type: application/json' \
  -H "Authorization: Bearer ${USER_AUTH_TOKEN}" \
  --data '{ "otp": "123456",
          "atx_id": 987654 }'  \
'https://api.sfox.com/v1/user/withdraw/confirm'
```

{% endtab %}

{% tab title="NodeJS" %}

```javascript
const axios = require('axios');

const config = {
  method: 'post',
  url: 'https://api.sfox.com/v1/user/withdraw/confirm',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer {process.env.USER_AUTH_TOKEN}`
  },
  data: {
   otp: '123456',
   atx_id: 987654
  }
}

axios(config)
  .then(response => {
    console.log(response.status);
    console.log(respones.data);
  })
  .catch(err => {
    console.error(err.response.status);
    console.error(err.respones.data);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import os

data = requests.post(
  "https://api.sfox.com/v1/user/withdraw/confirm",
  headers={
    "Authorization": f"Bearer {os.environ['ENTERPRISE_API_KEY']}"
  },
  json={
    "otp": "123456",
    "atx_id": 987654
  }
)
print(data.status_code)
print(data.json())
```

{% endtab %}
{% endtabs %}

[^1]: One Time Password
