All pages

API reference

Import contacts

POST /v1/contacts/import

View as Markdown

Add up to 1,000 people to a project's phonebook in one request, matched by number: a number already there is updated, or left alone with update_existing: false. Rows that do not fit are listed in errors by their place in contacts, and the rest are taken — so sending a corrected list again is the way to fix it. 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
contacts array of ContactFields Yes The people, up to 1,000 in one request.
project_id string (uuid) Yes The project whose phonebook they join.
update_existing boolean No Whether a number already there takes these details. False leaves it as it is and counts it as skipped.

Answer

200 with ContactImported.

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 project is frozen.
422 Validation Error
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

Import a list into the phonebook
#!/bin/sh
# Import a list into the phonebook. Matched by number: people already there are updated, so sending it again is safe.
curl -sS --fail-with-body -X POST "https://api.aigently.ai/v1/contacts/import" \
  -H "Authorization: Bearer $AIGENTLY_API_KEY" \
  --json '{
  "project_id": "0b1c2d3e-4f5a-6b7c-8d9e-0f1a2b3c4d5e",
  "contacts": [
    {
      "phone": "+12025550132",
      "name": "Omar Nasser",
      "attributes": {
        "first_name": "Omar"
      }
    },
    {
      "phone": "+12025550133",
      "name": "Lina Saleh",
      "attributes": {
        "first_name": "Lina"
      }
    }
  ]
}'

Try it

Sends this request to the API from your browser, with a test key. Nothing it does rings a phone.