API documentation
GET
POST
GET
PUT
DELETE
Contacts API
Store recipients, names and groups so you can send without keeping your own list.
GET /contacts
Query params: page (default 1), limit (default 20), search, group_id.
200 OK
{
"success": true,
"data": {
"contacts": [ { "id": 15, "phone": "+233241234567", "name": "Ama Mensah", "email": null, "group_id": 2, "tags": ["vip"], "custom_fields": { "branch": "Osu" } } ],
"pagination": { "page": 1, "limit": 20, "total": 1, "pages": 1 }
}
}
POST /contacts
phone | string, required | Mobile number |
name, email | string, optional | |
group_id | integer, optional | Contact group |
tags | array, optional | Any labels you choose |
custom_fields | object, optional | Any extra data for personalisation |
request
curl -X POST https://tiansms.com/api/v1/contacts
-H "x-api-key: YOUR_API_KEY" -H "Content-Type: application/json"
-d '{"phone":"+233241234567","name":"Ama Mensah","tags":["vip"],"custom_fields":{"branch":"Osu"}}'
Returns 201 Created with the contact in data.
GET /contacts/{id}
Returns a single contact, or 404 if it does not belong to your account.
PUT /contacts/{id}
Partial update — send only the fields you want to change.
DELETE /contacts/{id}
200 OK
{ "success": true, "message": "Contact deleted successfully" }