Which API should I choose?

We have two APIs: the synchronous API and the asynchronous API. But what are their uses?

Synchronous API

If you don't know which API to choose, choose the API Synchronous. Our good old API, developed, maintained and improved over the years will allow you to add many features to your software.

The Synchronous API, as its name suggests, works synchronously, which means that all your messages will be processed before receiving the response from our API. This means that all the information about your campaign is contained in the API response. But it also means that processing takes longer if you send a lot of SMS messages.

The synchronous API is easy to use and will meet your needs in most cases.

Here is an example of the API response you can receive by sending an SMS with the Synchronous API:


{
    "status": 1,
    "message": "OK",
    "ticket": "14672468",
    "cost": 2,
    "credits": 642,
    "total": 2,
    "sent": 2,
    "blacklisted": 0,
    "duplicated": 0,
    "invalid": 0,
    "npai": 0
}
                    
                    

<response>
    <status>1</status>
    <message>OK</message>
    <ticket>14672468</ticket>
    <cost>2</cost>
    <credits>642</credits>
    <total>2</total>
    <sent>2</sent>
    <blacklisted>0</blacklisted>
    <duplicated>0</duplicated>
    <invalid>0</invalid>
    <npai>0</npai>
</response>
                
                

Asynchronous API

The API Asynchronous on the other hand processes your messages asynchronously. This means that it will always have the same execution time, no matter how many SMS messages are sent. However, the response will not contain all the information for your campaign; to retrieve it, you will need to use the endpoint GET /batches.

This API is ideal for integration into your software, if you need immediate API feedback even with large SMS campaigns.

Voici un exemple de réponse API que vous pouvez recevoir en envoyant un SMS avec l'API Asynchrone :


{
    "data": {
        "batch_id": "123456",
        "type": "batches"
    },
    "links": {
        "self": "https:///api/batches/123456"
    }
}
                    
                    

API compatibility

Some features available with the Synchronous API can also be used with the Asynchronous API.

Par exemple :

  • When a webhook is created, the data from the Asynchronous API will also be sent to it.
  • The tokens you create on the Synchronous API will be those used by the Asynchronous API to identify you.
  • If you create senders with the Synchronous API, you can use them on the Asynchronous API.