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

Code Snippets

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())

Postman Collection

Last updated