TextFlow Docs
HomeContactPricingRegisterLogin
  • REST API
  • Node.js
  • Python
  • C#
  • PHP
  • Java
  • Checking your balance
  • Receiving SMS replies
  • Using SMS senders
  • Send SMS for free
Powered by GitBook
On this page
  • Getting an API key
  • Sending an SMS
  • Send an SMS wih the custom body to the recipient phone number.
  • User verification
  • Send phone number verification SMS to your customers
  • Verify the code that the customer has submitted
  • Sending bulk SMS
  • Send an SMS wih the custom body to multiple phone numbers.
  • Get the number of recipients that should receive your SMS soon
  • Getting help

REST API

You can easily send SMS and verify users with our intuitive API

Last updated 1 year ago

Getting an API key

To be able to use TextFlow for sending an SMS or user verification, you first have to , after that you are going to get a free API key with two free SMS, which you can use to send SMS or verify user request anywhere in the world.

After you have registered an account, your API key will be available on the .

Sending an SMS

Send an SMS wih the custom body to the recipient phone number.

POST https://textflow.me/api/send-sms

Headers

Name
Type
Description

Content-Type*

The value should be "application/json"

Authorization*

Request Body

Name
Type
Description

phone_number*

String

Recipient phone number, with country prefix. E.g. +11234567890

text*

String

Message body

{
  ok: true,
  status: 200,
  message: 'Message sent successfully',
  data: {
    to: '+381690156360',
    content: 'Dummy message text...',
    country_code: 'Serbia',
    price: 0.15,
    timestamp: 1676842652256
  }
}
{ 
    ok: false, 
    status: 400, 
    message: 'Invalid API key' 
}
{ 
    ok: false, 
    status: 400, 
    message: 'Phone number is invalid'
}

User verification

There are two endpoints that you should call in the user verification process.

/send-code is used to send user the verification code, while the /verify-code is used to check if the code that the user has entered is valid.

When you call the /send-code endpoint, we will send an SMS to the specified phone number. It should be the phone number that you want to verify, e.g. the phone number the user has entered in your app.

After sending the verification SMS, you can show the user a form where he should enter the verification code that he should have got in the SMS. When he submits the code, you should call the /verify-code endpoint from your backend and supply his phone number (which he can send again when submitting the code) along with the code that you want verified.

That way, you do not have to worry about keeping data about phone verification in your database, because we are doing it for you.

Send phone number verification SMS to your customers

POST https://textflow.me/api/send-code

Headers

Name
Type
Description

Content-Type*

String

The value should be "application/json"

Authorization*

String

Request Body

Name
Type
Description

phone_number*

String

Phone number to verify, with country prefix. E.g. +11234567890

service_name

String

What the user will see in the verification message. If the service_name is "Guest", he would get the following message:

Your verification code for Guest is: CODE

Default is none

seconds

Integer

How many seconds is the code valid for. Default is 10 minutes. Maximum is one day.

{
  ok: true,
  status: 200,
  message: 'Verification SMS sent. ',
  data: {
    verification_code: '214158',
    expires: 1676846234264,
    message_text: 'Your verification code is:\n214158'
  }
}
{
  ok: false,
  status: 400,
  message: 'Code can not be stored more then one day.'
}
{
  ok: false,
  status: 400,
  message: 'Provider name can not be more than 110 characters and it can only consist of letters, numbers and spaces.'
}
{
    ok: false,
    status: 401,
    message: 'Invalid API key or user id.'
}
{
    ok: false,
    status: 400,
    message: 'Invalid phone number'
}

Verify the code that the customer has submitted

POST https://textflow.me/api/verify-code

Headers

Name
Type
Description

Content-Type*

String

The value should be "application/json"

Authorization*

String

Request Body

Name
Type
Description

phone_number*

String

Phone number to verify the code for, with country prefix. E.g. +11234567890

code*

String

Verification code that the user has submited.

{
  ok: true,
  status: 400,
  message: 'The code has expired. ',
  valid: false,
  valid_code: '214158',
  expires: 1676846234264
}
{
  ok: true,
  status: 400,
  message: 'The code is invalid. ',
  valid: false,
  valid_code: '214158',
  expires: 1676846234264
}
{
  ok: true,
  status: 200,
  message: 'The code is valid. ',
  valid: true,
  valid_code: '606399',
  expires: 1676848594111
}
{ 
    ok: true,
    status: 400,
    message: 'Invalid code',
    valid: false
}
{
  ok: false,
  status: 400,
  message: 'Invalid phone number',
  valid: false
}
{
  ok: false,
  status: 401,
  message: 'Invalid API key or user id.',
  valid: false
}

Sending bulk SMS

You can aslo use the TextFlow API to send one SMS to multiple recipients. It is similar to send-sms, but with the array of phone numbers which you want to receive the message.

Send an SMS wih the custom body to multiple phone numbers.

POST https://textflow.me/api/bulk-sms

Headers

Name
Type
Description

Content-Type*

The value should be "application/json"

Authorization*

Request Body

Name
Type
Description

phone_numbers*

String Array

Recipient phone numbers, with country prefixes. E.g. ["+11234567891", "+11234567892", "+11234567893"]

text*

String

Message body

{
    ok: true,
    userId: 1,
    status: 200,
    message: "Bulk SMS sending started"
}
{ 
    ok: false, 
    status: 400, 
    message: 'Invalid API key' 
}

After starting the "Send bulk SMS job", you can check the number of recipients that have not yet received the SMS, but should receive them in a few minutes or hours, depending on the server load.

Get the number of recipients that should receive your SMS soon

POST https://textflow.me/api/bulk-count

Headers

Name
Type
Description

Content-Type*

The value should be "application/json"

Authorization*

{
    ok: true,
    count: 0,
    status: 200,
    message: "Bulk messages successfully counted"
}

Getting help

If you've found a bug in the API, package or would like new features added, you are also free to contact us!

The value should be "Bearer API_KEY", where API_KEY is the API key that you have registered on the

The value should be "Bearer API_KEY", where API_KEY is the API key that you have registered on the

The value should be "Bearer API_KEY", where API_KEY is the API key that you have registered on the

The value should be "Bearer API_KEY", where API_KEY is the API key that you have registered on the

The value should be "Bearer API_KEY", where API_KEY is the API key that you have registered on the

If you need help installing or using the library, please check the first, and contact us at if you don't find an answer to your question.

register an account
API console
FAQ
[email protected]
API console
API console
API console
API console
API console