Create Contact
Creates a new contact record in your account.
Endpoint
POST https://api.smsleopard.com/v1/contacts/createAuthentication
This endpoint requires Basic Authentication using your API credentials. Click to Generate Credentials (API Keys and Secrets) (opens in a new tab)
Request Body
| Parameter | Type | Required | Description | 
|---|---|---|---|
| phone_number | string | Yes | Must be a valid phone number | 
| name | string | No | Contact's full name | 
| email | string | No | Contact's email address | 
| group_ids | array | No | Array of group IDs to add the contact to | 
| custom_metadata | object | No | Additional attributes about the contact | 
Custom Metadata Structure
{
  "custom_metadata": {
    "fields": [
      {
        "name": "field_name",
        "value": "field_value"
      }
    ]
  }
}Code Examples
curl -X POST "https://api.smsleopard.com/v1/contacts/create" \
  -u "your_api_key:your_api_secret" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "John Doe",
    "phone_number": "0700000000",
    "email": "john@doe.com",
    "group_ids": [1, 2, 3],
    "custom_metadata": {
      "fields": [
        {
          "name": "account",
          "value": "12345"
        }
      ]
    }
  }'Example Request Body
{
  "name": "John Doe",
  "phone_number": "0700000000",
  "email": "john@doe.com",
  "group_ids": [1, 2, 3],
  "custom_metadata": {
    "fields": [
      {
        "name": "account",
        "value": "12345"
      }
    ]
  }
}Response
Success Response (201 Created)
{
  "id": 1,
  "name": "John Doe",
  "phone_number": "0700000000",
  "email": "john@doe.com",
  "created_at": "2025-08-28T09:00:00Z",
  "updated_at": "2025-08-28T09:00:00Z"
}Response Fields
| Field | Type | Description | 
|---|---|---|
| id | integer | Unique identifier for the created contact | 
| name | string | Contact's full name | 
| phone_number | string | Contact's phone number | 
| email | string | Contact's email address | 
| created_at | string | ISO 8601 timestamp of creation | 
| updated_at | string | ISO 8601 timestamp of last update | 
Error Responses
400 Bad Request
{
  "error": "Invalid phone number format",
  "message": "The phone number must be a valid format"
}401 Unauthorized
{
  "error": "Unauthorized",
  "message": "Invalid API credentials"
}