Developer Center

Termii provides RESTful API which is based on simple HTTP POST/GET requests.
Our API lets you create, send, and verify messages, as well as, track your delivery statistics.

Step 1

Visit your dashboard to get a Sender or Device ID

Start
Step 2

Visit user console to get your test or live API key

Start
Step 3

Buy units or get a premium plan to go live

Start

Messaging APIs

The Messaging API allows businesses send text messages to their customers.
The API accepts form-encoded request bodies, returns JSON-encoded responses,
and uses standard HTTP response codes.

Single Channel

A single channel represent an indiviudal messaging channel eg. sms, email, etc. This API allows businesses send text messages to their customers across any of these single channels.

  Endpoint
      
      1   https://www.termii.com/api/sms/send
      
    

  POST Request JSON

      1   {
      2   "to": "2347089509657",
      3   "from": "TestAccount",
      4   "sms": "Hi there, testing Termii API v2",
      5   "type": "plain",
      6   "media_url": "",
      7   "channel": "whatsapp",
      8   "api_key": "Your API Key",
	      "notify_url": "",
	      "notify_id" : ""
      9   }
      
  GET QueryPARAMS

      1   api_key: Your API key
      2   channel: generic
      3   type: plain
      4   sms: Hi there Testing Termii
      5   from: Termii
      6   to: 2347089509657
      
      
      
      
      
      
  Response JSON

        1   {
        2   "message_id": "9122821270554876574",
        3   "message": "Successfully Sent",
        4   "balance": 9,
        5   "user": "Peter Mcleish"
        6   }
       

Options

      1   Type:  plain, voice, mms, unicode
      2   Channel: whatsapp, dnd, generic
     
      
Guide

DND represents Do-Not-Distrub and messages sent via this channel are blocked by telcom providers. To ensure your messages are allowed to deliver, apply for a sender ID through your dashboard.

Template

This API allows businesses create predefined templates for sending messages across Email, Sms, Whatsapp and Voice channels.

  Endpoint
      
      1   https://www.termii.com/api/message-template
      
    

  POST Request JSON

      1   {
      2   "api_key": "Your API Key",
      3   "service": "email",
      4   "template": "Hi {{name}} there"
      5   }
      
      
      
      
      
      
      
      
      
  ResponseJSON

      1    {
      2    "data": {
      3    "template_id": "Your Unique Template ID",
      4    "service_type": "Sms",
      5    "template": "Hi {{name}} there {{hiell}}",
      6    "status": "PENDING",
      7    "keywords": [
      8    "{{name}}",
      9    "{{hiell}}"
      10   ]
      11   }
      12   }
      
      
Options

      1   Services:  email, whatsapp
     
      
Guide

Our template API works for only multi-channel messages. When creating a template put your variables in between "{{" and "}}"

Multi-Channel

This API allows businesses send messages across a mutliple channels to customers using pre-defined templates eg. Email, SMS, Whatsapp, and Voice.

  Endpoint
      
      1   https://www.termii.com/api/multichannel/send
      
    

  POST Request JSON

      1    {
      2    "api_key": "Your API Key",
      3    "channel": "email",
      4    "template_id": "Termii's Template API ID",
      5    "data" : {"name": "Ay", "hiell": "200"},
	    "from": "Applies to sms and whatsapp",
	    "to": "Applies to sms and whatsapp",
      7    "from_email" : "Applies to Email",
      8    "from_name": "Termii",
      9    "subject": "Hallos from termii",
      10   "to_email": "oluwatayoawe@gmail.com"
      11   }
      
  ResponseJSON

      1   {
      2   "message_id": "174749423",
      3   "message": "Successfully Sent",
      4   "balance": 8,
      5   "user": "Oluwatayo Awe"
      6   }
      
      
      
      
      
      
      
Options

      1   Channel:  whatsapp, dnd, email
     
      
Guide

To use this API, a template has to be created and the ID added while calling this endpoint. The json paramenters are different and should be added based on the channels being used.

Verification APIs

The Verification API allows businesses verify phone numbers as well as
generate tokens to authenticate transactions and confirm user identity.

Generate Token

Tokens are numeric or alpha-numeric codes generated to authenticate login requests and verify customer transactions. This API returns OTP codes in JSON format which can be used within any web or mobile app.

  Endpoint
      
      1   https://www.termii.com/api/sms/otp/generate
      
    

  POST Request JSON

      1   {
      2   "api_key": "Your API Key",
      3   "pin_type": "NUMERIC",
      4   "phone_number": "2348109477743",
      5   "pin_attempts": 3,
      6   "pin_time_to_live": 0,
      7   "pin_length": 4
      8   }
      
      
  Response JSON

      1   {
      2   "status": "success",
      3   "data": {
      4   "pin_id": "db34d5ce-9bd4-4f10-b8ec-8ee402ccd0",
      5   "otp": "522726",
      6   "phone_number": "2348109077743",
      7   "phone_number_other": "Termii"
      8   }
      9   }
      
Options

      1   Pin Type Options: NUMERIC,ALPHANUMERIC
      2   Pin attempts minimum of 1
      3   pin_time_to_live in minutes min 0 max 60
      4   pin_length : minimum of 4 maximum of 8
     
      
Guide

OTP refers to One-Time-Passwords. On Termii they are called token or pins and can be delivered in numbers (numeric) or letters (alphanumeric)

Send Token

The send token API allows businesses tigger one-time-passwords (pins) across any available messaging channel on Termii. Passwords created are generated randomly and there's an option to set an expiry time.

  Endpoint
  
  1   https://www.termii.com/api/sms/otp/send
  

  POST Request JSON

  1    {
  2    "api_key" : "Your API key",
  3    "message_type" : "NUMERIC",
  4    "to" : "eg. 2348109077743",
  5    "from" : "Aproved Sender or Device IDs",
  6    "channel" : "dnd",
  7    "pin_attempts" : 10,
  8    "pin_time_to_live" :  5,
  9    "pin_length" : 6,
  10   "pin_placeholder" : "< 1234 >",
  11   "message_text" : "Your pin is < 1234 >",
  12   "pin_type" : "NUMERIC"
  13   }
  
  Response JSON

  1   {
  2   "pinId": "29ae67c2-c8e1-4165-8a51-8d3d7c298081",
  3   "to": "2348109077743",
  4   "smsStatus": "Message Sent"
  5   }
  
  
  
  
  
  
  
  
  
Options

  1   Pin Type Options: NUMERIC,ALPHANUMERIC
  2   Pin attempts minimum of 1
  3   pin_time_to_live in minutes minimum 0 maximum 60
  4   pin_length : minimum of 4 maximum of 8
 
  
Guide

The channels available on the send token API include dnd (sms) and whatsapp. To ensure the pin generated delivers to dnd customers on the sms channel, request access to our default DND enabled sender IDs

Verify Token

The verify token API, checks tokens sent to customers and returns a response confirming the status of the token. A token can either be confirmed as verified or expired based on the timer set for the token

  Endpoint
      
      1  https://www.termii.com/api/sms/otp/verify
      
    

  POST Request JSON

      1   {
      2   "api_key": "Sk1sdHhhdHljbGtzR25zRWtsYk8=",
      3   "pin_id": "c8dcd048-5e7f-4347-8c89-4470c3af0b",
      4   "pin": "195558"
      5   }
      
  Response JSON

      1   {
      2   "pinId": "c8dcd048-5e7f-4347-8c89-4470c3af0b",
      3   "verified": "True",
      4   "msisdn": "2348109077743"
      5   }
      
Options

      1   Pin Type Options: NUMERIC,ALPHANUMERIC
      2   Pin attempts minimum of 1
      3   pin_time_to_live in minutes min 0 max 60
      4   pin_length : minimum of 4 maximum of 8
     
      
Guide

This API requires a numeric or alphanumeric token to have been sent out to a customer. It collects this token when inputed by the user and confirms its status

Search

The search API allows businesses verify phone numbers and automatically detect their status as well as current network. It also tells if the number has activated the do-not-disturb settings

  Endpoint
      
      1   https://www.termii.com/api/check/dnd
      
    

  POST Request JSON

      1   {
      2   "api_key": "required",
      3   "phone_number": "required"
      4   }
      
  ResponseJSON

      1   {
      2   "number": "2347089509657",
      2   "status": "DND blacklisted",
      2   "network": "Airtel Nigeria",
      2   "network_code": "62120"
      3   }
      
      
Options

      NB: Phone number must start with country code
     
      
Guide

DND represents Do-Not-Distrub routes and messages sent via this channel are blocked by telcom providers. To ensure your messages are allowed to deliver, apply for a sender ID through your dashboard.

Insights APIs

The Insights API allows businesses track the delivery of messages
sent on the Termii platform. This applies to all channels including sms, whatsapp, voice and whatsapp.

Delivery (mobile)

This delivery API returns reports for messages sent across the sms, voice & whatsapp channels. Reports can either display all messages on termii or a single message

  Endpoint
      
      1   https://www.termii.com/api/sms/inbox?api_key=YourAPIKey
      
    

  GET Request JSON

      1    [
      2    {
      3    "id": 111,
      4    "userid": 21,
      5    "sender": "Termii",
      6    "receiver": "2348109477743",
      7    "message": "Hi there, testing Termii API v2",
      8    "amount": 1,
      9    "use_gateway": "16",
      10   "api_key": "Your API Key",
      11   "status": "Message Sent| Pending",
      12   "sms_type": "plain",
      13   "send_by": "api",
      14   "media_url": null,
      15   "message_id": "0055824139442874696",
      16   "campaign_id": null,
      17   "notify_url": null,
      18   "notify_id": null,
      19   "created_at": "2020-01-28 00:18:42",
      20   "updated_at": "2020-01-28 00:18:42"
      21   }
      22   ]
      
Options

      NB: To view a fixed report add the message id
      to the web string
      i.e. &message_id=Your message ID
     
      
Guide

Message IDs are gotten when a message is sent on Termii. Find the ID in the JSON response and input it into the deliver API to get a specific delivery report, else we would return all reports on your account.

Termii © 2020. Termii is a registered trademark of Termii Inc. With our subsidiaries in Africa,
We collaborate with fast growing brands to deliver great customer messaging experience for African businesses.