OTP/Phone verification
Besides sending SMS, TextLink API can automate one-time-password (OTP) verification for phone numbers. The pricing for OTP verification is the same as sending a normal SMS, but we give OTP messages higher priority and faster delivery times.
The main perk of using our solution for verifying phone number is the removal of need to store the valid codes in your database, since we can verify codes for you.
Sending an HTTP POST request
To send a verification SMS, you can send the following POST request with tool of your choice (like Postman), or use any of the programming languages that support REST API calls.
Send phone number verification SMS to your customers.
POST
https://textlinksms.com/api/send-code
Headers
Name | Type | Description |
---|---|---|
Content-Type* | The value should be "application/json" | |
Authorization* | The value should be "Bearer API_KEY", where API_KEY is the API key that you have registered on the API Console |
Request Body
Name | Type | Description |
---|---|---|
phone_number* | String | Recipient phone number, with country prefix. E.g. +11234567890 |
service_name | String | Your name to be shown in the message |
source_country | String | Uppercase ISO2 code of the sender phone number country. If left out, the cheapest option will be used. |
expiration_time | Integer | How long the code is valid, in miliseconds |
Examples for different programming languages
Check if the code is valid
After you have sent the one-time-password to your user, you can prompt him to enter the code in your website or application. After he has entered the code, you can use the /verify-code
endpoint, to check if it is valid, without having to store the code locally.
Verify the code that the customer has submitted.
POST
https://textlinksms.com/api/verify-code
Headers
Name | Type | Description |
---|---|---|
Content-Type* | The value should be "application/json" | |
Authorization* | The value should be "Bearer API_KEY", where API_KEY is the API key that you have registered on the API Console |
Request Body
Name | Type | Description |
---|---|---|
phone_number* | String | The phone number that you would like to verify |
code | String | The OTP code to verify |
Code examples
Last updated