Introduction

With our amazing REST, easy, and smart “Verify” APIs, integration of OTP SMS into your app is a breeze! Just two simple steps and you'll be up and running in seconds! Generate the code, verify it, and you're ready to go!




APIs Features:

Connecting to taqnyat.sa API is a breeze! Simply use HTML forms to send data as POST, or send data to the API URL directly using Query String and send the data as "GET". For larger amounts of data, we recommend using POST, as GET does not support sending large amounts of data. Additionally, you can send data in JSON - a full description of the JSON Data method can be found in this document. taqnyat.sa also returns data in the most common format, JSON. When connecting to taqnyat.sa API through HTTP/HTTPS protocols, the SMS data must be in a certain format. For example, Sender Name must be encoded using URL-Encoding and the message text must be in UTF-8 encoding.




Before you go

• We recommended the one who is going to use this documentation or APIs to have programming skills. • The testing cost is nothing because we offer a free startup balance of 1 SAR for any trial account. • Cost calculation for messaging depends on how many messages you will send and how many destinations it will be receiving the messages. • If you want to try to send SMS API, we advise you to send scheduled SMS, so you can check if they reached “Scheduled SMS Archive” in your taqnyat.sa account, then you may delete the SMS to spare the cost and get your balance back. • When you send SMS through API, mobile numbers that will receive the SMS must be in international format without 00 or symbol (+) • You must have an active sender name before you go, you may contact support@taqnyat.sa or account manager to get more details about the requirements and how to activate your Sender Name.








Base URL

All URLs resources in the SMS documentation have the base URL
`https://api.taqnyat.sa/verify.php`]





Let us Get started:

To use taqnyat.sa API, you should have a taqnyat.sa account, here is an explanation of how you can register, checking your current balance, request a recharge for your balance through a “request recharge form” in taqnyat.sa website.

  1. Registration process: You can register on taqnyat.sa website through the following link: Contact and go to Sales tab ,fill the form and hit send.

  2. Check your balance: You can check your current balance from the website after you logged at the dashboard.

  3. Balance Topup: After your login to your https://www.taqnyat.sa account, you can request recharging your balance, through the request top-up form, you can access it through the balance top-up tab located in the left top corner. Fill all the required data in the form and we will top up your account within two hours at most after we validate the deposit.

  4. Using bearer Tokens: bearer Tokens will have a unique value generated in the taqnyat.sa user account , because it provides a more secure connection with the API.

  5. Setup API settings: taqnyat.sa provides security settings that allows you to control SMS sending through API. You can do the following setting
    - enable or disable sending SMS through API from your account.
    - grant permission to specific IP’s to be allowed to send SMS message through API using your account.
    - grant permission to specific countries to be allowed to send SMS message through API using your account.




Authentication

• To use our API, you will need a unique Bearer token generated from your account at our platform by following the below steps Setup Bearer token • For REST API Bearer token must be submitted within the header Authorization.




Setup Bearer token

With Taqnyat you can set up your bearer token in seconds using the below steps: • Login to your account at Taqnyat. • Select Application from Developer section. • Press the add button on the top right corner. • Choose a suitable name for your application. • Select the services you want this app to include, in our case SMS. • Hit the confirm button to submit your application. • Copy the Bearer Tokens.




Generate new OTP Verification

This resource used to generate the OTP.

POST /https://api.taqnyat.sa/verify.php/
Parameter Description Required
apiKey The Bearer Token from Taqnyat portal Yes
numbers Array of strings, of numbers started with international 966 Yes
sender message sender Yes
method specifies how to send the verification code, for now we only support SMS Yes
lang specifies the language of SMS message, “en” or “ar”, “ar “is the default Yes
requestId you can specify a unique ID for each verification process through this variable. If this variable is passed to the verify API, it must be used during the check verification code process Yes
note text to be appended to message No
returnJson when send this variable with value 1 the result will be return in JSON format No

Sample

[
    {
        "apiKey": "*************************",
        "numbers": [
            "966000000000"
        ],
        "method": "sms",
        "sender": "sender name",
        "lang": "ar",
        "requestId": "1",
        "note": "some note"
    }
]




Check OTP Verification

This resource used to generate the OTP.

POST /https://api.taqnyat.sa/verify.php/
Parameter Description Required
apiKey The Bearer Token from Taqnyat portal Yes
numbers Array of strings, of numbers started with international 966 Yes
sender message sender Yes
method specifies how to send the verification code, for now we only support SMS Yes
lang specifies the language of SMS message, “en” or “ar”, “ar “is the default Yes
requestId you can specify a unique ID for each verification process through this variable. If this variable is passed to the verify API, it must be used during the check verification code process Yes
note text to be appended to message No
returnJson when send this variable with value 1 the result will be return in JSON format No
activeKey The code received on the number Yes

Sample

[
    {
        "apiKey": "*************************",
        "numbers": [
            "966000000000"
        ],
        "method": "sms",
        "sender": "sender name",
        "lang": "ar",
        "requestId": "1",
        "activeKey": "6240"
        "note": "some note",
    }
]





Results values

code Description
0 Connection failed to Taqnyat server
1 invalid apiKey
3 Mobile number is not specified or incorrect.
4 Your balance is not enough.
5 Activation code sent successfully.
6 Unknown error Please contact technical support, this case holds more than one error such as: Sender name is not authorized or Your balance is 0.
7 The activation code has already been sent, you can re-send it in second, Get JSON result form more details
8 You have exceeded the allowed number of attempts, change requestId to verify mobile number.
10 Activation process completed successfully.
11 Activation code is incorrect.
12 Attempts to enter activation code have been exhausted.
13 This number is activated.
19 Mobile number is already verified