# OTP

***

The OTP service enables you to send & verify a 6-digit one-time password (OTP) to an Egyptian Mobile Phone number via SMS. Please note that this services does not include non-Egyptian number.

The format of the phone number should be an 11-digit string that begins with "01", as follows: 01xxxxxxxxx.

***

There are 2 API endpoints provided for this service:

1. Send OTP: sends the one-time password to the provided phone number via SMS
2. Verify OTP: receives the user-entered OTP and verifies that it is the one sent to them.

An OTP attempt expires after 10 minutes. After that, you'll need to send another OTP to verify, since you cannot verify expired OTPs.&#x20;

## Code Snippets

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

```python
import requests
import base64

token = '<token>'
data = {
    'otp': '<6-digit otp>',
    'transaction_id': '<transaction id from Send OTP step>',
    'bundle_key': '<bundle key>',
    'lang': '<str>' # optional, default: en
}

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

{% endtab %}
{% endtabs %}

## Postman Collection

{% file src="/files/-MjLSWnMjv2-4ECI8dRY" %}
OTP (v1)
{% endfile %}


---

# 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.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.
