# Confirm Verification Code

<table data-header-hidden><thead><tr><th width="74.8046875" align="center"></th><th></th></tr></thead><tbody><tr><td align="center"><mark style="color:blue;"><strong>POST</strong></mark> </td><td>https://api.sfox.com/v1/enterprise/users/verify/:user_id</td></tr></tbody></table>

Submit verification codes to complete email or sms verification.

***

## Request

### Path Parameters

<table><thead><tr><th width="200.0078125">Name</th><th>Description</th></tr></thead><tbody><tr><td><code>user_id</code> <br><mark style="color:red;">required</mark>, string</td><td>Unique ID for this user defined by you that will serve as the shared identifier for this account between you and sFOX.</td></tr></tbody></table>

### Body Parameters

<table><thead><tr><th width="199.65234375">Name</th><th>Description</th></tr></thead><tbody><tr><td><code>type</code> <br><mark style="color:red;">required</mark>, string</td><td><p>Verification requirement method.</p><p><em>Possible values: <code>email</code> , <code>sms</code></em></p></td></tr><tr><td><code>otp</code> <br><mark style="color:red;">required</mark>, string</td><td>Verification code sent to the user.</td></tr></tbody></table>

### Example Requests

{% tabs %}
{% tab title="Shell" %}
{% code lineNumbers="true" %}

```shell
curl -X POST \
  -H 'Content-type: application/json' \
  -H "Authorization: Bearer ${ENTERPRISE_API_KEY}" \
  --data '{ "type": "email", "otp": "12345" }'  \
  "https://api.sfox.com/v1/enterprise/users/verify/${user_id}"
```

{% endcode %}
{% endtab %}

{% tab title="NodeJS" %}

<pre class="language-javascript" data-line-numbers><code class="lang-javascript">const axios = require('axios');

const user_id = "${user_id}"
const data = JSON.stringify({type: 'email', otp: '12345'})
const config = {
  method: 'post',
  url: `https://api.sfox.com/v1/enterprise/users/verify/${user_id}`,
  headers: {
    "Content-Type": "application/json",
    Authorization: `Bearer ${process.env.ENTERPRISE_API_KEY}`
  },
  data: data
}

axios(config)
  .then((response) => {
    console.log(response.status)
    console.log(respones.data)
  })
  .catch(err => {
    console.error(err.response.status)
    console.error(err.response.data)
<strong>  });
</strong></code></pre>

{% endtab %}

{% tab title="Python" %}
{% code lineNumbers="true" %}

```python
import requests
import os

user_id = os.environ['${user_id}']

data = requests.post(
  f"https://api.sfox.com/v1/enterprise/users/verify/${user_id}",
  headers={
    "Authorization": f"Bearer {os.environ['ENTERPRISE_API_KEY']}"
  },
  json={
    "type": "email",
    "otp": "12345"
  }
)
print(data.status_code)
print(data.json())
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Response

### Response Fields

<table><thead><tr><th width="191.47265625">Name</th><th>Description</th></tr></thead><tbody><tr><td><code>data</code><br>object</td><td>Verification code information.</td></tr><tr><td>    <code>success</code><br>    boolean</td><td>Whether verification was successful or not.</td></tr><tr><td>    <code>user_id</code><br>    string</td><td>The ID of the end user the code was sent to.</td></tr><tr><td>    <code>type</code><br>    string</td><td>The verification method for the code. <br><em>Possible values: <code>email</code> , <code>sms</code></em></td></tr></tbody></table>

### Responses

<details>

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

The following is an example response body from verifying an email verification code

{% code title="Successfully verified email" lineNumbers="true" %}

```json
{
    "data": {
        "success": true,
        "user_id": "client_account_1",
        "type": "email"
    }
}
```

{% endcode %}

The following is an example response body from verifying an sms verification code

{% code title="Successfully verified phone number" lineNumbers="true" %}

```json
{
    "data": {
        "success": true,
        "user_id": "client_account_1",
        "type": "sms"
    }
}
```

{% endcode %}

</details>
