# Verify Phone OTP

***

## <mark style="color:blue;">Verify OTP</mark>

<mark style="color:green;">`POST`</mark> `https://valifystage.com/api/v1/otp/verify/`

#### Headers

| Name          | Type   | Description            |
| ------------- | ------ | ---------------------- |
| Content-Type  | string | application/json       |
| Authorization | string | Bearer \<access-token> |

#### Request Body

<table><thead><tr><th>Name</th><th width="146.199951171875">Type</th><th>Description</th><th>Notes</th></tr></thead><tbody><tr><td>data</td><td>object</td><td><p>Object containing the parameters below:<br><code>{</code> <br>  <code>otp: &#x3C;str>,</code> <br>  <code>bundle_key: &#x3C;str>,</code><br>  <code>lang: &#x3C;str></code></p><p><code>transaction_id: &#x3C;str></code><br><code>}</code><br></p></td><td><p>-otp: 6 digit OTP entered by the user.</p><p></p><p>-The transaction ID from the "Send Phone OTP" step.</p></td></tr></tbody></table>

**Status Codes**

{% tabs %}
{% tab title="✅200 " %}

```python
{
    'verified': true
}
```

{% endtab %}

{% tab title="400 " %}

```python
{
    "message": "Bad Request – invalid request received (e.g. missing Bundle key, required parameters or invalid json) | Make sure all the required parameters are included"
}
```

{% endtab %}

{% tab title="401 " %}

```python
{
    "message": "Unauthorized – your Bundle key is invalid"
}
```

{% endtab %}

{% tab title="403 " %}

```python
{
    "message": "Forbidden – specified access_token could not be found"
}
```

{% endtab %}

{% tab title="404 " %}

```python
{
    "message": "Not Found"
}
```

{% endtab %}

{% tab title="415 " %}

```python
{
    "message": "Unsupported Media Type"
}
```

{% endtab %}

{% tab title="422 " %}

```python
{
    "message": "<error-description>",
    "error_code": <valify-error-code>
}
```

{% endtab %}

{% tab title="500 " %}

```python
{
    "message": "Internal Server Error"
}
```

{% endtab %}
{% endtabs %}

## Code Snippets

{% tabs %}
{% tab title="🐍Python 3" %}

```python
import requests
import base64

token = '<token>' # Place your token here
data = {
    'otp': '<6-digit otp>', # Place the received OTP here
    'transaction_id': '<transaction id from "Send OTP">', # Place the transaction ID here
    'bundle_key': '<bundle key>', #Place the bundle key here
    'lang': '<str>' # optional, default: en
}

r = requests.post("https://valifystage.com/api/v1/otp/verify/",
        json=data,
        headers={'Authorization': 'Bearer %s' % token}
    )
                      
print(r.json())
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://valify.gitbook.io/documentation/apis/otp/verify-phone-otp.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
