Overview
The Contacts API allows you to import, update, and manage contacts in your SmartAlex database.
Get all contacts with optional filtering.
curl -X GET "https://api.getsmartalex.com/v1/contacts" \
-H "Authorization: Bearer YOUR_API_KEY"
Query Parameters
| Parameter | Type | Description |
|---|
status | string | Filter by status: active, dnc |
search | string | Search by name, phone, or email |
campaign_id | string | Filter by campaign membership |
page | integer | Page number (default: 1) |
per_page | integer | Items per page (default: 20, max: 100) |
Response
{
"data": [
{
"id": "contact_abc123",
"phone": "+15551234567",
"first_name": "John",
"last_name": "Smith",
"email": "john@example.com",
"company": "Acme Corp",
"title": "Manager",
"status": "active",
"calls_count": 3,
"last_called_at": "2024-01-15T14:30:00Z",
"created_at": "2024-01-10T09:00:00Z"
}
],
"meta": {
"total": 1250,
"page": 1,
"per_page": 20
}
}
Retrieve a single contact with call history.
curl -X GET "https://api.getsmartalex.com/v1/contacts/contact_abc123" \
-H "Authorization: Bearer YOUR_API_KEY"
Response
{
"data": {
"id": "contact_abc123",
"phone": "+15551234567",
"first_name": "John",
"last_name": "Smith",
"email": "john@example.com",
"company": "Acme Corp",
"title": "Manager",
"status": "active",
"metadata": {
"source": "website",
"interest": "enterprise"
},
"calls": [
{
"id": "call_xyz789",
"direction": "outbound",
"status": "completed",
"duration": 180,
"sentiment": "positive",
"created_at": "2024-01-15T14:30:00Z"
}
],
"campaigns": [
{
"id": "campaign_def456",
"name": "January Outreach",
"status": "completed"
}
],
"created_at": "2024-01-10T09:00:00Z",
"updated_at": "2024-01-15T14:30:00Z"
}
}
Add a single contact to your database.
curl -X POST "https://api.getsmartalex.com/v1/contacts" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"phone": "+15551234567",
"first_name": "John",
"last_name": "Smith",
"email": "john@example.com",
"company": "Acme Corp",
"title": "Manager"
}'
Parameters
| Parameter | Type | Required | Description |
|---|
phone | string | Yes | Phone number (E.164 format recommended) |
first_name | string | No | First name |
last_name | string | No | Last name |
email | string | No | Email address |
company | string | No | Company name |
title | string | No | Job title |
metadata | object | No | Custom key-value data |
Response
{
"data": {
"id": "contact_new789",
"phone": "+15551234567",
"first_name": "John",
"last_name": "Smith",
"status": "active",
"created_at": "2024-01-16T10:00:00Z"
}
}
Import multiple contacts at once.
curl -X POST "https://api.getsmartalex.com/v1/contacts/import" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contacts": [
{
"phone": "+15551234567",
"first_name": "John",
"last_name": "Smith"
},
{
"phone": "+15559876543",
"first_name": "Jane",
"last_name": "Doe"
}
],
"skip_duplicates": true
}'
Parameters
| Parameter | Type | Required | Description |
|---|
contacts | array | Yes | Array of contact objects (max 1000) |
skip_duplicates | boolean | No | Skip duplicate phone numbers (default: true) |
update_existing | boolean | No | Update existing contacts (default: false) |
Response
{
"data": {
"imported": 2,
"duplicates_skipped": 0,
"invalid_skipped": 0,
"errors": []
}
}
For imports larger than 1000 contacts, make multiple requests or contact support for bulk import options.
Update an existing contact’s information.
curl -X PUT "https://api.getsmartalex.com/v1/contacts/contact_abc123" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": "john.smith@newcompany.com",
"company": "New Company Inc"
}'
Parameters
All parameters are optional. Only included fields will be updated.
| Parameter | Type | Description |
|---|
phone | string | Phone number |
first_name | string | First name |
last_name | string | Last name |
email | string | Email address |
company | string | Company name |
title | string | Job title |
status | string | active or dnc |
metadata | object | Custom data (merged with existing) |
Response
{
"data": {
"id": "contact_abc123",
"phone": "+15551234567",
"first_name": "John",
"last_name": "Smith",
"email": "john.smith@newcompany.com",
"company": "New Company Inc",
"status": "active",
"updated_at": "2024-01-16T10:30:00Z"
}
}
Remove a contact from your database.
curl -X DELETE "https://api.getsmartalex.com/v1/contacts/contact_abc123" \
-H "Authorization: Bearer YOUR_API_KEY"
Response
{
"data": {
"id": "contact_abc123",
"deleted": true
}
}
Deleting a contact removes them from all campaigns and deletes their call history association.
Mark as DNC
Add a contact to the Do Not Call list.
curl -X POST "https://api.getsmartalex.com/v1/contacts/contact_abc123/dnc" \
-H "Authorization: Bearer YOUR_API_KEY"
Response
{
"data": {
"id": "contact_abc123",
"status": "dnc",
"dnc_at": "2024-01-16T10:00:00Z"
}
}
Remove from DNC
Remove a contact from the Do Not Call list.
curl -X DELETE "https://api.getsmartalex.com/v1/contacts/contact_abc123/dnc" \
-H "Authorization: Bearer YOUR_API_KEY"
Response
{
"data": {
"id": "contact_abc123",
"status": "active"
}
}
| Status | Description |
|---|
active | Available to be called |
dnc | Do Not Call - will not be dialed |
Error Codes
| Code | Description |
|---|
contact_not_found | Contact ID doesn’t exist |
duplicate_phone | Phone number already exists |
invalid_phone | Phone number format is invalid |
contact_limit_reached | Plan contact limit exceeded |
import_too_large | Import exceeds maximum batch size |