API reference
Add a contact
POST /v1/contacts
One person to a project's phonebook: their number, the name the console shows, the attributes an agent can say about them, and their time zone. A number already there is 409 contact_exists — to add or update many at once, import them. Needs contacts:write and a live key.
Body
Sent as JSON. A field this operation does not take is refused, so a typo fails loudly.
| Field | Type | Required | Description |
|---|---|---|---|
attributes |
object | No | What an agent may say about them: its {{placeholders}} take these by name. Kept as text. |
name |
string | No | What the console calls them. Never spoken. |
phone |
string | Yes | Their number, in international format. |
project_id |
string (uuid) | Yes | The project whose phonebook they join. |
timezone |
string or null | No | Where they are, like Asia/Riyadh: a campaign's calling hours are read there. Leave it out for your organization's own. |
Answer
201 with Contact.
Errors
Every error is a problem document with a stable code.
| Status | When |
|---|---|
401 |
The key is missing, mistyped, unknown, revoked or expired. |
403 |
A test key, or a key limited to some agents. |
404 |
This key reaches no such project. |
409 |
The number is already in the project's phonebook, or the project is frozen. |
422 |
Not a phone number, or not a time zone. |
429 |
Too many requests for this key or its organization; see Retry-After. |
500 |
Something went wrong on our side. Quote the request_id to support. |
Examples
#!/bin/sh
# Add someone to the phonebook. With a live key: the phonebook holds real people.
curl -sS --fail-with-body -X POST "https://api.aigently.ai/v1/contacts" \
-H "Authorization: Bearer $AIGENTLY_API_KEY" \
--json '{
"project_id": "0b1c2d3e-4f5a-6b7c-8d9e-0f1a2b3c4d5e",
"phone": "+12025550131",
"name": "Sara Haddad",
"attributes": {
"first_name": "Sara",
"member_since": "2023"
},
"timezone": "America/New_York"
}'
Try it
Sends this request to the API from your browser, with a test key. Nothing it does rings a phone.