Skip to main content

Fetch contacts by phonebook ID

Endpoint: https://BASE_URL/api/phonebooks/{phonebook_id}/contacts?api_key=YourAPIKey Request Type: GET
{
    "data": [
        {
            "id": 3,
            "pid": 4,
            "phone_number": "2347062609181",
            "email_address": null,
            "message": null,
            "company": null,
            "first_name": null,
            "last_name": null,
            "create_at": "2021-06-30 12:02:15",
            "updated_at": "2021-06-30 12:02:15"
        },
        {
            "id": 4,
            "pid": 4,
            "phone_number": "2347051428948",
            "email_address": null,
            "message": null,
            "company": null,
            "first_name": null,
            "last_name": null,
            "create_at": "2021-06-30 12:02:20",
            "updated_at": "2021-06-30 12:02:20"
        },
        {
            "id": 5,
            "pid": 4,
            "phone_number": "2348173343852",
            "email_address": null,
            "message": null,
            "company": null,
            "first_name": null,
            "last_name": null,
            "create_at": "2021-06-30 12:02:20",
            "updated_at": "2021-06-30 12:02:20"
        },
        {
            "id": 6,
            "pid": 4,
            "phone_number": "2348057616056",
            "email_address": null,
            "message": null,
            "company": null,
            "first_name": null,
            "last_name": null,
            "create_at": "2021-06-30 12:02:20",
            "updated_at": "2021-06-30 12:02:20"
        },
        {
            "id": 7,
            "pid": 4,
            "phone_number": "2348060463787",
            "email_address": null,
            "message": null,
            "company": null,
            "first_name": null,
            "last_name": null,
            "create_at": "2021-06-30 12:02:20",
            "updated_at": "2021-06-30 12:02:20"
        }
       
    ],
  
    "links": {
        "first": "https://BASE_URL/api/phonebooks/04c3ebcc-3a7e-485a-88c1-68e731386f77/contacts?page=1",
        "last": "https://BASE_URL/api/phonebooks/04c3ebcc-3a7e-485a-88c1-68e731386f77/contacts?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://BASE_URL/api/phonebooks/04c3ebcc-3a7e-485a-88c1-68e731386f77/contacts",
        "per_page": 25,
        "to": 22,
        "total": 22
    }
}

Add single contacts to phonebook

Endpoint: https://BASE_URL/api/phonebooks/{phonebook_id}/contacts Request Type: POST Body params:
OptionsRequiredDescription
api_keyyesstring
Your API key (It can be found on your Termii dashboard)
phone_numberyesstring
Phone number of the contact
country_codenostring
Represents short numeric geographical codes developed to represent countries (Example: 234 ).
email_addressnostring
email address of the contact
first_nameyesstring
first name of the contact
last_nameyesstring
last name of the contact
companyyesstring
name of the company of the contact
{
"api_key": "Your API Key",
"phone_number":"8123696237",
"email_address":"[email protected]",
"first_name": "test",
"last_name": "contact",
"company": "Termii",
"country_code": "234"
}
Response
  {
    "data": {
      "id": 3647982,
      "phone_number": "2448123696237",
      "email_address": "[email protected]",
      "message": null,
      "company": "Termii",
      "first_name": "test",
      "last_name": "contact",
      "create_at": "2021-10-11 10:15:35",
      "updated_at": "2021-10-11 10:15:35"
    }
}

Add multiple contacts to phonebook

Endpoint: https://BASE_URL/api/phonebooks/contacts/upload Request Type: POST Content-Type for “contact” should be “application/json”. Content-Type in headers should be auto generated as multipart/form-data
OptionsRequiredDescription
api_keyyesstring
Your API key (It can be found on your Termii dashboard)
fileyesstring
sample csv file containing phone numbers.
country_codenostring
Represents short numeric geographical codes developed to represent countries (Example: 234 ).
pidyesstring
Phonebook ID
curl -X POST https://BASE_URL/api/phonebooks/contacts/upload \
-F "file=@path/to/your/file.csv" \
-F 'contact={"pid": "12345", "country_code": "234", "api_key": "your_api_key"}'
Response:
 {

    "message": "Your list is being uploaded in the background. Go ahead with other things while we handle this. Please note that it could take a couple minutes to get it done."

}

Delete contact

Endpoint: https://BASE_URL/api/phonebook/contacts/delete/contact_id?api_key=YourAPIKey Request Type: DELETE Response
   {

        "message":"Contact deleted successfully"
  
  }