Suggestions

close search

Stringee SMS REST API reference

Authentication

REST API SMS must be authenticated using a custom HTTP header: X-STRINGEE-AUTH along with a JSON web token. Create the JWT token with format:

HEADER:
    {
        "typ": "JWT",
        "alg": "HS256",// only support HS256
        "cty": "stringee-api;v=1"
    }

PAYLOAD:
    {
        "jti": "SK...-...",//JWT ID
        "iss": "SK...",//API key sid
        "exp": ...,//expiration time
        "rest_api": true
    }

VERIFY SIGNATURE:
    HMACSHA256(
        base64UrlEncode(HEADER) + "." +
        base64UrlEncode(PAYLOAD),
        apiKeySecret
    )

The values:

    iss: API key SID generated by Stringee 
    jti: the identify of the token, can be generated by: apiKeySid_timestamp
    exp: the expired time of the token (in second)
    apiKeySecret: API key secret generated by Stringee

Send an SMS

URL: https://api.stringee.com/v1/sms

HTTP method: POST

Content-Type: application/json

Custom HTTP POST header: Name: X-STRINGEE-AUTH Value: JSON web token (JWT), see Authentication

POST data (body):

{
    "sms":[
        {
            "from": "YOUR_BRANDNAME",
            "to": "CLIENT_NUMBER",
            "text": "CONTENT_SMS"
        }
    ]
}
Field Type Require Description
sms Array Yes
sms["from"] String Yes Your SMS Brandname
sms["to"] String Yes The phone number you want to send
sms["text"] String Yes SMS's content

Response:

{
    "smsSent": response_number_of_sms_sent,
    "result": [
        {
            "price": response_price,
            "smsType": response_type,
            "r": response_code,
            "msg": response_msg
        }
    ]
}
Field Type Require Descriptio
smsSent Int Yes Response number of sms sent
result Array Yes
result["price"] Int No Response price
result["smsType"] Int No Response type
result["r"] Int No Response code
result["msg"] String No Response message

Sample request: Use your brandname

POST /v1/sms HTTP/1.1
Host: https://api.stringee.com
X-STRINGEE-AUTH: json_web_token
Accept: application/json

{
    "sms":[
        {
            "from": "YOUR_BRANDNAME",
            "to": "841679361752",
            "text": "This is an SMS from your brandname"
        }
    ]
}

Sample response

{
    "smsSent": 1,
    "result": [
        {
            "price": "830",
            "smsType": 2,
            "r": 0,
            "msg": "Success"
        }
    ]
}

Sample

URL: https://github.com/stringeecom/server-samples/tree/master/sms