AISARAISAR
REST API

Contacts

A contact is the record for a person or organisation you communicate with: phone numbers, emails, linked channel accounts (contactAccounts — e.g. a specific WhatsApp number or Instagram username), tags, and a status (lead/active/inactive). A single contact can have multiple linked accounts and conversations. The API covers CRUD, lookup/resolution by identifier, duplicate merging, and broadcast opt-in/opt-out management.

Endpoints

MethodPath
GET/v1/contacts

List the company's contacts with pagination, search and status filter.

GET/v1/contacts/lookup

Quick contact lookup by phone, external_id or channel username.

GET/v1/contacts/channel-options

List channel types available for linking an account to a contact.

POST/v1/contacts

Create a contact (with phones, emails and linked channel accounts).

POST/v1/contacts/resolve-identifiers

Resolve a batch of identifiers (phone/username/external_id) to existing contact ids.

PATCH/v1/contacts/{contact}

Update a contact (fully rewrites related phones/emails/accounts).

DELETE/v1/contacts/{contact}

Delete a contact (soft delete).

POST/v1/contacts/{contact}/merge

Merge a contact into another one (all conversations and accounts move to the target).

POST/v1/contacts/{contact}/tags

Sync a contact's tags (full replace of the tag set).

POST/v1/contacts/{contact}/opt-out

Opt a contact out of broadcasts.

POST/v1/contacts/{contact}/opt-in

Opt a contact back into broadcasts (clears opt-out).

GET/v1/contacts/{contact}/deals

List a contact's deals (requires the deals feature to be enabled).

Examples

Create a contact

Request

bash
curl -X POST "https://api.aisar.app/v1/contacts" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "firstName": "John",
    "lastName": "Doe",
    "phones": [{ "phone": "+77001234567", "type": "mobile" }],
    "emailes": [{ "email": "john@example.com", "type": "work" }]
  }'

Response

json
{
  "data": {
    "id": 45,
    "company_id": 1,
    "firstName": "John",
    "lastName": "Doe",
    "displayName": "John Doe",
    "status": "lead",
    "phones": [{ "phone": "+77001234567", "type": "mobile" }],
    "emailes": [{ "email": "john@example.com", "type": "work" }],
    "contactAccounts": [],
    "merged_into_contact_id": null
  }
}

Look up a contact by phone

Request

bash
curl -X GET "https://api.aisar.app/v1/contacts/lookup?q=%2B77001234567" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Accept: application/json"

Response

json
{
  "data": [
    {
      "id": 45,
      "displayName": "John Doe",
      "status": "lead",
      "phones": [{ "phone": "+77001234567", "type": "mobile" }]
    }
  ]
}