Send SMS

How to send an sms

To send a sms you must post the following information in JSON. Using the url provided by CinetPay:

Header parameter

Key Value
Content-Type application/json
Authorization App myapikey

Body parameter

Parameter Type Mandatory Description
from String yes Represents the sender's ID and can be alphanumeric or numeric. The length of the alphanumeric Sender ID must be between 3 and 11 characters (example: company name). The length of the numeric sender ID must be between 3 and 14 characters.
to Array yes Table of message destination addresses. If you want to send a message to a destination, a single string is supported instead of an array. The destination addresses must be in international format (Example: 41793026727).
text String yes Text of the message that will be sent


Php example


    function curlPost()
        $curl = curl_init();

        curl_setopt_array($curl, array(
        CURLOPT_URL => '',
        CURLOPT_ENCODING => '',
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 0,
            "text":"Ceci est un text pour les sms"
        CURLOPT_HTTPHEADER => array(
            'Authorization: App 7c95244ccfd654bdb51bf52821b25gh67f-fbf9cc4d-1cfd-482e-a921-694bb499db80',
            'Content-Type: application/json'

        $response = curl_exec($curl);

        echo $response;

        return json_decode($response);


Response query

Example of a successful response

    "messages": [
            "to": "2250758712792",
            "status": {
                "groupId": 1,
                "groupName": "PENDING",
                "id": 7,
                "name": "PENDING_ENROUTE",
                "description": "Message sent to next instance"
            "messageId": "34426316966003536518",
            "smsCount": 1

Example of an error response

If you try to send a message without authorization, you will receive a 401 Unauthorized error.

  "requestError": {
    "serviceException": {
      "messageId": "UNAUTHORIZED",
      "text": "Invalid login details"

If you try and don't have enough credit, you will get this message

    "messages": [
            "to": "2250758712792",
            "status": {
                "groupId": 5,
                "groupName": "REJECTED",
                "id": 12,
                "name": "REJECTED_NOT_ENOUGH_CREDITS",
                "description": "Not enough credits"
            "messageId": "34431579683903536497",
            "smsCount": 1