Skip to content

Contacts API

Create and manage business contacts programmatically.

Contacts are people associated with your business — team members, clients, or anyone you interact with. Unlike customers (who have a billing relationship), contacts are a general-purpose directory.

Use Cases

  • People Directory: Maintain a contact list for your team or client base
  • CRM Sync: Import contacts from external platforms
  • Communication: Store contact info for use in campaigns and outreach

Endpoints

MethodEndpointDescription
POST/business/contact/createCreate a new contact
GET/business/contact/listList all contacts
GET/business/contact/details/:idGet contact details

Create Contact

Add a new contact to your business directory.

http
POST /business/contact/create

Request Body

FieldTypeRequiredDescription
namestringYesContact's full name
emailstringNoEmail address
phonestringNoPhone number
positionstringNoJob title or role
companynamestringNoCompany or organisation

Example Request

bash
curl -X POST "https://api.cashfin.africa/business/contact/create" \
  -H "Authorization: cs_your_client_secret" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Jane Wanjiku",
    "email": "[email protected]",
    "phone": "+254712345678",
    "position": "Procurement Manager",
    "companyname": "Acme Corp"
  }'
javascript
const response = await fetch(
  "https://api.cashfin.africa/business/contact/create",
  {
    method: "POST",
    headers: {
      Authorization: "cs_your_client_secret",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      name: "Jane Wanjiku",
      email: "[email protected]",
      phone: "+254712345678",
      position: "Procurement Manager",
      companyname: "Acme Corp",
    }),
  }
);
const data = await response.json();
php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL            => "https://api.cashfin.africa/business/contact/create",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_POST           => true,
  CURLOPT_POSTFIELDS     => json_encode([
    'name'        => 'Jane Wanjiku',
    'email'       => '[email protected]',
    'phone'       => '+254712345678',
    'position'    => 'Procurement Manager',
    'companyname' => 'Acme Corp',
  ]),
  CURLOPT_HTTPHEADER     => [
    "Authorization: cs_your_client_secret",
    "Content-Type: application/json"
  ],
]);

$result = json_decode(curl_exec($curl), true);
python
import requests

response = requests.post(
    'https://api.cashfin.africa/business/contact/create',
    headers={
        'Authorization': 'cs_your_client_secret',
        'Content-Type': 'application/json'
    },
    json={
        'name': 'Jane Wanjiku',
        'email': '[email protected]',
        'phone': '+254712345678',
        'position': 'Procurement Manager',
        'companyname': 'Acme Corp',
    }
)

Success Response

json
{
  "success": true,
  "message": "Contact created successfully",
  "data": {
    "_id": "507f1f77bcf86cd799439045",
    "name": "Jane Wanjiku",
    "email": "[email protected]",
    "phone": "+254712345678",
    "position": "Procurement Manager",
    "companyname": "Acme Corp",
    "createdat": "2024-01-15T12:00:00.000Z"
  }
}

List Contacts

Retrieve a paginated list of contacts.

http
GET /business/contact/list

Query Parameters

ParameterTypeDefaultDescription
pageinteger1Page number
limitinteger10Results per page (max: 100)
searchstring-Search by name, email, phone, or company

Example Request

bash
curl -X GET "https://api.cashfin.africa/business/contact/list?page=1&limit=10" \
  -H "Authorization: cs_your_client_secret"
javascript
const response = await fetch(
  "https://api.cashfin.africa/business/contact/list?page=1&limit=10",
  {
    headers: { Authorization: "cs_your_client_secret" },
  }
);
const data = await response.json();
python
import requests

response = requests.get(
    'https://api.cashfin.africa/business/contact/list',
    headers={'Authorization': 'cs_your_client_secret'},
    params={'page': 1, 'limit': 10}
)

Success Response

json
{
  "success": true,
  "data": [
    {
      "_id": "507f1f77bcf86cd799439045",
      "name": "Jane Wanjiku",
      "email": "[email protected]",
      "phone": "+254712345678",
      "position": "Procurement Manager",
      "companyname": "Acme Corp",
      "createdat": "2024-01-15T12:00:00.000Z"
    }
  ],
  "pagination": {
    "total": 62,
    "page": 1,
    "limit": 10,
    "pages": 7
  }
}

Get Contact Details

Retrieve full details of a specific contact.

http
GET /business/contact/details/:id

Path Parameters

ParameterTypeRequiredDescription
idstringYesContact ID (MongoDB ObjectID)

Example Request

bash
curl -X GET "https://api.cashfin.africa/business/contact/details/507f1f77bcf86cd799439045" \
  -H "Authorization: cs_your_client_secret"
javascript
const contactId = "507f1f77bcf86cd799439045";

const response = await fetch(
  `https://api.cashfin.africa/business/contact/details/${contactId}`,
  {
    headers: { Authorization: "cs_your_client_secret" },
  }
);
const data = await response.json();
python
import requests

contact_id = '507f1f77bcf86cd799439045'

response = requests.get(
    f'https://api.cashfin.africa/business/contact/details/{contact_id}',
    headers={'Authorization': 'cs_your_client_secret'}
)

Success Response

json
{
  "success": true,
  "data": {
    "_id": "507f1f77bcf86cd799439045",
    "name": "Jane Wanjiku",
    "email": "[email protected]",
    "phone": "+254712345678",
    "position": "Procurement Manager",
    "companyname": "Acme Corp",
    "active": true,
    "createdat": "2024-01-15T12:00:00.000Z",
    "updatedat": "2024-01-15T12:00:00.000Z"
  }
}

Error Responses

Contact Not Found

json
{
  "success": false,
  "error": "Contact not found"
}

Cashfin Business API Documentation