Contacts
Create a contact
Creates a contact in the workspace. Each phone number can only be saved once per workspace. Contacts cannot be edited after creation; delete and re-create instead.
- Bearer API key
- Scope:
write - or app session
- Workspace:
X-Tenant-ID(optional with a key)
Headers
AuthorizationstringrequiredYour API key as
Bearer <key>. The wordBearerand the space are case-sensitive. Browser clients signed in to the app use the session cookie instead.X-Tenant-IDuuidoptionalWorkspace id. Optional with an API key (a key always acts in its own workspace); if you send it, it must match the key’s workspace. Required with a session cookie. You can pass
?tenant=<id>instead.
Body
application/jsonnamestringrequiredContact name.
phonestringrequiredPhone number with country code. Spaces, dashes, dots, brackets and a leading
+are removed.tagstringoptionalOptional free-text tag.
opted_inbooleanoptionalWhether the contact agreed to receive messages.
Response
201 Createdapplication/json
iduuidContact id.
namestringContact name.
phonestringPhone number with country code, digits only (no
+).tagstringFree-text tag (may be empty).
opted_ininteger1if the contact agreed to receive messages, otherwise0.created_atintegerCreation time in Unix seconds.
avatar_urlstringmay be absentProfile picture URL, when one has been downloaded.
Status codes
- 201Created. The new contact. Note that
opted_incomes back as0or1. - 400Bad request. Validation failed:
provide a name (1–100 characters),tag must be at most 60 characters,provide an international phone number with country code (8–15 digits, no leading 0)orinvalid body. - 401Unauthorized. The API key is unknown, revoked or expired (
invalid or expired API key), or there is no key and no signed-in session (unauthorized). - 402Payment required. Only when subscriptions are enforced and the workspace has no active subscription. The body includes
code: "payment_required". - 403Forbidden. The API key has the
readscope, which only allows GET requests (API key is read-only). A key in another workspace getsAPI key belongs to a different workspace. - 409Conflict. A contact with this phone number already exists in the workspace.