API reference

Contacts API

8 endpoints for contacts. Send your token as a Bearer header; how tokens, scopes, limits and errors work is on the API reference page.

API reference

Before you start

  • Authentication, scopes, rate limits, errors, retrying safely and paging are explained once, on the API reference.
  • Every request needs a token with the scope shown on its endpoint; without it the answer is 403.

Contacts

List contacts

GET/api/contactsScope contacts:read

List your contacts, a page at a time.

Every filter is optional, and they combine. A page holds at most 200 contacts: read total, then ask for the next page until you have them all. Deleted contacts are never listed.

Parameters
ParameterTypeWhat it is
pageinteger, at least 1, in the queryDefault: 1.
page_sizeinteger, 1 to 200, in the queryDefault: 50.
searchstring, or null, in the queryWords found anywhere in the name, email or number, in any order. A number matches in any format.
statusstring, or null, in the queryThe contact's status, such as new.
classificationstring, or null, in the queryLead classification: hot, warm or cold.
sourcestring, or null, in the queryWhere the contact came from, exactly as the contact's source field says.
dispositionstring, or null, in the queryThe contact's latest outcome key.
min_scoreinteger, or null, in the queryHas a call scored at least this (0 to 100).
max_scoreinteger, or null, in the queryHas a call scored at most this (0 to 100).
min_durationinteger, or null, in the queryHas a call at least this many seconds long.
max_durationinteger, or null, in the queryHas a call at most this many seconds long.
campaign_idstring (uuid), or null, in the queryHas a call placed by this campaign.
lead_setstring, or null, in the queryThe lead set the contact was imported into.
dndboolean, or null, in the querytrue: only Do-Not-Call contacts; false: only callable ones.
needsone of: callback, stale_high, or null, in the querycallback: a call back is owed; stale_high: hot, callable, and not rung in the last 7 days.
added_fromstring (date-time), or null, in the queryAdded at or after this time (ISO 8601).
added_tostring (date-time), or null, in the queryAdded at or before this time (ISO 8601).
added_daysinteger, 1 to 366, or null, in the queryAdded in the last N days
agent_idstring (uuid), or null, in the queryHas a call answered by this AI agent.
team_idstring (uuid), or null, in the queryHas a call answered by this AI team.
answered_byone of: agent, team, or null, in the queryHas a call answered by any AI agent working alone, or by any AI team.
assigned_tostring, or null, in the queryGiven to: a team member's user id, or none
last_message_statusstring, up to 12 characters, or null, in the queryThe latest campaign message to the contact has this status (delivered, read, replied, failed...)
sortone of: name, source, score, last_called, added, in the queryDefault: name.
orderone of: asc, desc, in the queryDefault: asc.
viewone of: active, held, in the queryheld: contacts held over the plan's contact limit. Default: active.
Answer (200): these fields
FieldTypeWhat it is
totalrequiredintegerContacts matching the filters, across every page.
pagerequiredinteger—
page_sizerequiredinteger—
sortrequiredstring—
orderrequiredstring—
itemsrequiredlist of objects—
items[].idrequiredstring (uuid)—
items[].namerequiredstring—
items[].phonerequiredstring—
items[].emailrequiredstring, or null—
items[].lead_typerequiredstring, or null—
items[].statusrequiredstring—
items[].classificationrequiredstring, or null—
items[].dispositionrequiredstring, or null—
items[].dnd_flagrequiredboolean—
items[].sourcestring, or null—
items[].languagestring, or null—
items[].created_atstring (date-time), or null—
items[].last_called_atstring (date-time), or null—
items[].scorenumber, or null—
items[].assigned_user_idstring (uuid), or null—
Errors
CodeWhen
401The token is missing, unknown or revoked, or its workspace was deleted.
402The workspace's plan does not include API access. The token is paused, not revoked: it works again as soon as the plan includes API access.
403The token does not have this endpoint's scope, it is a sandbox token, the workspace is suspended, or the request came from a network the workspace, or the token's IP allowlist, does not allow.
422A field is missing or not in the form this endpoint takes. detail says which, and why.
429This token has made more requests this minute than your plan allows. The Retry-After header says how many seconds to wait.
GET /api/contacts with curl
curl "https://aicallstudio.com/api/contacts?page_size=50" \
  -H "Authorization: Bearer mtc_YOUR_TOKEN"

Create a contact

POST/api/contactsScope contacts:write

Add one contact.

name and phone are required. One number is one contact: the same number in another format ("98765 43210", "+919876543210") is refused with 409. A number deleted earlier brings that contact back with its history. Adding a contact starts the workspace's New Contact workflows, as adding one by hand does, and those may call or message the person.

Parameters
ParameterTypeWhat it is
Idempotency-Keystring, up to 255 characters, in the headersAny unique text up to 255 characters, such as a UUID, chosen by you for this request. Sent again with the same body within 24 hours, the first answer comes back (with Idempotent-Replayed: true) and nothing is done twice. The same key with another body is refused with 422.
Request body (application/json)
FieldTypeWhat it is
namerequiredstring, up to 255 charactersThe person's name.
phonerequiredstring, up to 20 characters8 to 15 digits, optionally starting with +. Stored in one canonical form.
emailstring, or nullOptional. Must look like name@example.com.
custom_fieldsobjectYour own fields for this contact, by field name. A contact type's required fields must be here.
lead_typestring, or nullThe contact type's key, which decides the fields it needs. Blank: general.
sourcestring, or nullWhere the contact came from, in your words.
dnd_flagbooleantrue puts the number on Do-Not-Call: it is never rung. Default: false.
statusstringDefault: new.
classificationstring, or nullhot, warm or cold.
dispositionstring, or nullAn outcome key defined in your workspace.
languagestring, or nullThe language the person prefers, as a code or a name, such as hi-IN or Hindi.
Answer (201): these fields
FieldTypeWhat it is
idrequiredstring (uuid)—
org_idrequiredstring (uuid)—
namerequiredstring—
phonerequiredstring—
emailrequiredstring, or null—
custom_fieldsrequiredobject—
lead_typerequiredstring, or null—
sourcerequiredstring, or null—
dnd_flagrequiredboolean—
statusrequiredstring—
classificationrequiredstring, or null—
dispositionrequiredstring, or null—
languagestring, or null—
best_timeobject, or null—
assigned_user_idstring (uuid), or null—
wa_marketing_opt_out_atstring (date-time), or null—
Errors
CodeWhen
401The token is missing, unknown or revoked, or its workspace was deleted.
402The workspace's plan does not include API access. The token is paused, not revoked: it works again as soon as the plan includes API access. The plan's contact limit is reached.
403The token does not have this endpoint's scope, it is a sandbox token, the workspace is suspended, or the request came from a network the workspace, or the token's IP allowlist, does not allow.
409A contact already has this number, in any format.
422A field is missing or not in the form this endpoint takes. detail says which, and why.
429This token has made more requests this minute than your plan allows. The Retry-After header says how many seconds to wait.
POST /api/contacts with curl
curl -X POST "https://aicallstudio.com/api/contacts" \
  -H "Authorization: Bearer mtc_YOUR_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"name":"Asha Verma","phone":"+919876543210"}'

Export contacts

GET/api/contacts/exportScope contacts:read

Download every contact matching the filters as one file, CSV or Excel.

The same filters as listing contacts, in one file with no paging. Pass ids to export just those contacts (at most 1,000), still inside the other filters.

Parameters
ParameterTypeWhat it is
formatstring, in the querycsv or xlsx. Default: csv.
searchstring, or null, in the queryWords found anywhere in the name, email or number, in any order. A number matches in any format.
statusstring, or null, in the queryThe contact's status, such as new.
classificationstring, or null, in the queryLead classification: hot, warm or cold.
sourcestring, or null, in the queryWhere the contact came from, exactly as the contact's source field says.
dispositionstring, or null, in the queryThe contact's latest outcome key.
min_scoreinteger, or null, in the queryHas a call scored at least this (0 to 100).
max_scoreinteger, or null, in the queryHas a call scored at most this (0 to 100).
min_durationinteger, or null, in the queryHas a call at least this many seconds long.
max_durationinteger, or null, in the queryHas a call at most this many seconds long.
campaign_idstring (uuid), or null, in the queryHas a call placed by this campaign.
lead_setstring, or null, in the queryThe lead set the contact was imported into.
dndboolean, or null, in the querytrue: only Do-Not-Call contacts; false: only callable ones.
needsone of: callback, stale_high, or null, in the querycallback: a call back is owed; stale_high: hot, callable, and not rung in the last 7 days.
added_fromstring (date-time), or null, in the queryAdded at or after this time (ISO 8601).
added_tostring (date-time), or null, in the queryAdded at or before this time (ISO 8601).
added_daysinteger, 1 to 366, or null, in the queryAdded in the last N days
agent_idstring (uuid), or null, in the queryHas a call answered by this AI agent.
team_idstring (uuid), or null, in the queryHas a call answered by this AI team.
answered_byone of: agent, team, or null, in the queryHas a call answered by any AI agent working alone, or by any AI team.
assigned_tostring, or null, in the queryGiven to: a team member's user id, or none
last_message_statusstring, up to 12 characters, or null, in the queryThe latest campaign message to the contact has this status (delivered, read, replied, failed...)
idsstring, or null, in the queryComma-separated contact ids: export just this selection

Answer: 200. The file, as an attachment: CSV by default, an Excel workbook with format=xlsx.

Errors
CodeWhen
401The token is missing, unknown or revoked, or its workspace was deleted.
402The workspace's plan does not include API access. The token is paused, not revoked: it works again as soon as the plan includes API access.
403The token does not have this endpoint's scope, it is a sandbox token, the workspace is suspended, or the request came from a network the workspace, or the token's IP allowlist, does not allow.
422A field is missing or not in the form this endpoint takes. detail says which, and why.
429This token has made more requests this minute than your plan allows. The Retry-After header says how many seconds to wait.
GET /api/contacts/export with curl
curl "https://aicallstudio.com/api/contacts/export?format=csv" \
  -H "Authorization: Bearer mtc_YOUR_TOKEN" \
  -o contacts.csv

Import contacts from a file

POST/api/sources/import/csvScope contacts:write

Import contacts from a spreadsheet: one contact per row.

Send the file as multipart/form-data. Rows without a name or a dialable phone number are skipped and listed in errors. A number already in the workspace updates that contact, or is skipped with dedupe=skip. New contacts over the plan's contact limit are saved but held, and counted in held. New contacts start the New Contact workflows, which may call or message them. One import runs in a workspace at a time, and an address may start at most 3 a minute.

Parameters
ParameterTypeWhat it is
Idempotency-Keystring, up to 255 characters, in the headersAny unique text up to 255 characters, such as a UUID, chosen by you for this request. Sent again with the same body within 24 hours, the first answer comes back (with Idempotent-Replayed: true) and nothing is done twice. The same key with another body is refused with 422.
Request body (multipart/form-data)
FieldTypeWhat it is
filerequiredfileA .csv or .xlsx file with a header row. It needs a name and a phone column. At most 50 MB.
lead_setstring, or nullA lead set to put every imported contact in.
clean_namesbooleantrue tidies each name: title case, honorifics and extra spaces removed. Default: false.
dedupestringA number that is already a contact: update (the default) refreshes that contact, skip leaves it. Default: update.
lead_typestring, or nullThe contact type every row is imported as.
mappingstring, or nullJSON: which column fills each field, as {"field name": "Column header"}.
Answer (200): these fields
FieldTypeWhat it is
source_idrequiredstring (uuid)The import, as a lead source in your workspace.
createdrequiredintegerNew contacts added.
updatedrequiredintegerExisting contacts refreshed from the file.
skippedrequiredintegerRows not imported: rows with a problem (see errors), and existing contacts with dedupe=skip.
heldintegerNew contacts over the plan's contact limit: saved, and held until the plan has room. Default: 0.
errorsrequiredlist of stringWhy each skipped row was skipped, by row number.
Errors
CodeWhen
400The file is not .csv or .xlsx, is empty, cannot be read, or has no name or phone column.
401The token is missing, unknown or revoked, or its workspace was deleted.
402The workspace's plan does not include API access. The token is paused, not revoked: it works again as soon as the plan includes API access.
403The token does not have this endpoint's scope, it is a sandbox token, the workspace is suspended, or the request came from a network the workspace, or the token's IP allowlist, does not allow.
413The file is over 50 MB.
422A field is missing or not in the form this endpoint takes. detail says which, and why.
429This token has made more requests this minute than your plan allows. The Retry-After header says how many seconds to wait.
POST /api/sources/import/csv with curl
curl -X POST "https://aicallstudio.com/api/sources/import/csv" \
  -H "Authorization: Bearer mtc_YOUR_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  -F "file=@contacts.csv"

Add or update a contact

POST/api/v1/contactsScope contacts:write

Add a contact, or update the one that already has this number. Never makes a duplicate.

The number is the key: the same number in any format ("98765 43210", "+919876543210") is the same contact. A known number is updated with the fields you send, and your own fields are merged in; a new number needs a name and is added, which starts your New Contact workflows, as adding one by hand does (those may call or message the person). created says which.

Parameters
ParameterTypeWhat it is
Idempotency-Keystring, up to 255 characters, in the headersAny unique text up to 255 characters, such as a UUID, chosen by you for this request. Sent again with the same body within 24 hours, the first answer comes back (with Idempotent-Replayed: true) and nothing is done twice. The same key with another body is refused with 422.
Request body (application/json)
FieldTypeWhat it is
phonerequiredstring, up to 20 characters8 to 15 digits, optionally starting with +. The same number in any format is the same contact.
namestring, up to 255 characters, or nullRequired for a new number; for a known one it renames it.
emailstring, up to 255 characters, or null—
custom_fieldsobject, or nullYour own fields, by field name. Merged into the contact's: a field you leave out is kept.
lead_typestring, or nullThe contact type's key, which decides the fields it needs.
sourcestring, up to 50 characters, or nullWhere the contact came from, in your words.
languagestring, or nullThe language the person prefers, as a code or a name, such as hi-IN.
Answer (200): these fields
FieldTypeWhat it is
createdrequiredbooleantrue when the number was new and a contact was added.
contactrequiredobject—
contact.idrequiredstring (uuid)—
contact.namerequiredstring—
contact.phonerequiredstring—
contact.emailstring, or null—
contact.custom_fieldsobjectYour own fields. The platform's own keys (starting with _) are left out.
contact.lead_typestring, or null—
contact.sourcestring, or null—
contact.statusstring, or null—
contact.classificationstring, or null—
contact.dispositionstring, or null—
contact.languagestring, or null—
contact.do_not_callbooleanDefault: false.
contact.created_atstring (date-time), or null—
Errors
CodeWhen
401The token is missing, unknown or revoked, or its workspace was deleted.
402The workspace's plan does not include API access. The token is paused, not revoked: it works again as soon as the plan includes API access. The plan's contact limit is reached.
403The token does not have this endpoint's scope, it is a sandbox token, the workspace is suspended, or the request came from a network the workspace, or the token's IP allowlist, does not allow.
422A field is missing or not in the form this endpoint takes. detail says which, and why.
429This token has made more requests this minute than your plan allows. The Retry-After header says how many seconds to wait.
POST /api/v1/contacts with curl
curl -X POST "https://aicallstudio.com/api/v1/contacts" \
  -H "Authorization: Bearer mtc_YOUR_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"phone":"+919876543210","name":"Asha Verma","custom_fields":{"loan_id":"LN-1042"}}'

Update a contact

PATCH/api/v1/contacts/{contact_id}Scope contacts:write

Change some of a contact's fields. A field you leave out is kept; your own fields are merged.

Parameters
ParameterTypeWhat it is
contact_idrequiredstring (uuid), in the path—
Idempotency-Keystring, up to 255 characters, in the headersAny unique text up to 255 characters, such as a UUID, chosen by you for this request. Sent again with the same body within 24 hours, the first answer comes back (with Idempotent-Replayed: true) and nothing is done twice. The same key with another body is refused with 422.
Request body (application/json)
FieldTypeWhat it is
namestring, up to 255 characters, or null—
phonestring, up to 20 characters, or nullA new number. Refused if another contact has it.
emailstring, up to 255 characters, or null—
custom_fieldsobject, or nullMerged into the contact's: a field you leave out is kept.
lead_typestring, or null—
statusstring, or null—
classificationstring, or nullhot, warm or cold.
dispositionstring, or nullAn outcome key defined in your workspace.
languagestring, or null—
Answer (200): these fields
FieldTypeWhat it is
idrequiredstring (uuid)—
namerequiredstring—
phonerequiredstring—
emailstring, or null—
custom_fieldsobjectYour own fields. The platform's own keys (starting with _) are left out.
lead_typestring, or null—
sourcestring, or null—
statusstring, or null—
classificationstring, or null—
dispositionstring, or null—
languagestring, or null—
do_not_callbooleanDefault: false.
created_atstring (date-time), or null—
Errors
CodeWhen
401The token is missing, unknown or revoked, or its workspace was deleted.
402The workspace's plan does not include API access. The token is paused, not revoked: it works again as soon as the plan includes API access.
403The token does not have this endpoint's scope, it is a sandbox token, the workspace is suspended, or the request came from a network the workspace, or the token's IP allowlist, does not allow.
404No contact of yours has this id.
409Another contact already has the new number.
422A field is missing or not in the form this endpoint takes. detail says which, and why.
429This token has made more requests this minute than your plan allows. The Retry-After header says how many seconds to wait.
PATCH /api/v1/contacts/{contact_id} with curl
curl -X PATCH "https://aicallstudio.com/api/v1/contacts/YOUR_CONTACT_ID" \
  -H "Authorization: Bearer mtc_YOUR_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"status":"qualified"}'

Erase a person's data

POST/api/v1/contacts/{contact_id}/erasureScope contacts:erase

Delete one person and their call history, for an erasure request under India's data protection law. It cannot be undone.

The contact and every call with them are deleted now. Their recordings stop being playable at once and are deleted after our review. If the number is on your Do-Not-Call list it stays there, so they are not called again.

Parameters
ParameterTypeWhat it is
contact_idrequiredstring (uuid), in the path—
Idempotency-Keystring, up to 255 characters, in the headersAny unique text up to 255 characters, such as a UUID, chosen by you for this request. Sent again with the same body within 24 hours, the first answer comes back (with Idempotent-Replayed: true) and nothing is done twice. The same key with another body is refused with 422.
Answer (200): these fields
FieldTypeWhat it is
statusrequiredstringerased.
contact_idrequiredstring (uuid)—
calls_removedrequiredinteger—
recordings_deletion_requestedrequiredintegerRecordings of those calls we were asked to delete. They are deleted after our review and cannot be played meanwhile.
Errors
CodeWhen
401The token is missing, unknown or revoked, or its workspace was deleted.
402The workspace's plan does not include API access. The token is paused, not revoked: it works again as soon as the plan includes API access.
403The token does not have this endpoint's scope, it is a sandbox token, the workspace is suspended, or the request came from a network the workspace, or the token's IP allowlist, does not allow.
404No contact of yours has this id.
422A field is missing or not in the form this endpoint takes. detail says which, and why.
429This token has made more requests this minute than your plan allows. The Retry-After header says how many seconds to wait.
POST /api/v1/contacts/{contact_id}/erasure with curl
curl -X POST "https://aicallstudio.com/api/v1/contacts/YOUR_CONTACT_ID/erasure" \
  -H "Authorization: Bearer mtc_YOUR_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)"

Add or update many contacts

POST/api/v1/contacts/bulkScope contacts:write

Add or update up to 100 contacts in one request, each exactly as one would be.

One result per contact, in the order sent. A contact that cannot be saved (a bad number, a missing required field, the plan's limit) is reported with its reason and does not stop the others. The same number twice in one request is one contact.

Parameters
ParameterTypeWhat it is
Idempotency-Keystring, up to 255 characters, in the headersAny unique text up to 255 characters, such as a UUID, chosen by you for this request. Sent again with the same body within 24 hours, the first answer comes back (with Idempotent-Replayed: true) and nothing is done twice. The same key with another body is refused with 422.
Request body (application/json)
FieldTypeWhat it is
contactsrequiredlist of objects1 to 100 contacts.
contacts[].phonerequiredstring, up to 20 characters8 to 15 digits, optionally starting with +. The same number in any format is the same contact.
contacts[].namestring, up to 255 characters, or nullRequired for a new number; for a known one it renames it.
contacts[].emailstring, up to 255 characters, or null—
contacts[].custom_fieldsobject, or nullYour own fields, by field name. Merged into the contact's: a field you leave out is kept.
contacts[].lead_typestring, or nullThe contact type's key, which decides the fields it needs.
contacts[].sourcestring, up to 50 characters, or nullWhere the contact came from, in your words.
contacts[].languagestring, or nullThe language the person prefers, as a code or a name, such as hi-IN.
Answer (200): these fields
FieldTypeWhat it is
createdrequiredinteger—
updatedrequiredinteger—
failedrequiredinteger—
resultsrequiredlist of objects—
results[].indexrequiredintegerThe position of this contact in the list you sent, from 0.
results[].createdbooleanDefault: false.
results[].contact_idstring (uuid), or null—
results[].errorstring, or nullWhy this one was not saved; null when it was.
Errors
CodeWhen
401The token is missing, unknown or revoked, or its workspace was deleted.
402The workspace's plan does not include API access. The token is paused, not revoked: it works again as soon as the plan includes API access.
403The token does not have this endpoint's scope, it is a sandbox token, the workspace is suspended, or the request came from a network the workspace, or the token's IP allowlist, does not allow.
422A field is missing or not in the form this endpoint takes. detail says which, and why.
429This token has made more requests this minute than your plan allows. The Retry-After header says how many seconds to wait.
POST /api/v1/contacts/bulk with curl
curl -X POST "https://aicallstudio.com/api/v1/contacts/bulk" \
  -H "Authorization: Bearer mtc_YOUR_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"contacts":[{"phone":"+919876543210","name":"Asha Verma"}]}'

Put AI Call Studio on your phone lines.

Book a 30-minute walkthrough, or call us right now: +91 922 222 1378