Start Free — No Credit Card Required · IntelliReply AI now replies in Arabic and EnglishSee plans →

Contacts API

List, search, create, update and delete contacts, and keep ZAPGEN in sync with your CRM or store using upsert by phone number.

Contacts are the people you message. Each one has a phone number (unique in your organization), a name, optional email and address, your custom fields and any number of groups.

Syncing from another system? Use upsert.

POST /api/contacts/upsert finds the contact by phone number, creates it if it's new, and only changes the fields you send. You don't need to store ZAPGEN's IDs or check whether a contact exists first.

The contact object#

Contact
{
  "uuid": "4d1f7a3e-9b2c-4c41-8f0e-2a7d5c9b1e63",
  "first_name": "Sara",
  "last_name": "Ahmed",
  "full_name": "Sara Ahmed",
  "phone": "+971501234567",
  "formatted_phone_number": "+971 50 123 4567",
  "email": "[email protected]",
  "address": "{\"street\":\"Cluster D\",\"city\":\"Dubai\",\"state\":null,\"zip\":null,\"country\":\"UAE\"}",
  "metadata": "{\"Membership\":\"Gold\",\"Birthday\":\"1992-04-18\"}",
  "is_subscribed": 1,
  "is_favorite": 0,
  "unread_messages": 2,
  "latest_chat_created_at": "2026-11-12 09:41:07",
  "created_at": "2026-10-03 14:20:11",
  "updated_at": "2026-11-12 09:41:07"
}
FieldDescription
uuidThe contact's ID. Use it in /api/contacts/{uuid}.
first_name, last_name, full_nameThe contact's name.
phoneThe number in E.164 format.
formatted_phone_numberThe number formatted for display.
emailEmail address, or null.
addressA JSON string with street, city, state, zip and country. Parse it before use.
metadataA JSON string with your custom field values, keyed by field name. Parse it before use.
is_subscribed1 if the contact receives marketing messages, 0 if not.
is_favorite1 if someone in your team starred the contact.
unread_messagesMessages from this contact nobody has read yet.
latest_chat_created_atTime of the latest message with this contact (UTC).
created_at, updated_atUTC, YYYY-MM-DD HH:MM:SS.

The API returns a few more internal fields. Don't rely on them. Groups aren't included in the contact object.

List contacts#

GEThttps://app.zapgen.ae/api/contacts

Returns your contacts, oldest first, paginated.

NameTypeRequiredDescription
pageintegerNoPage number, from 1.
per_pageintegerNoContacts per page, 1–100. Default 10.
phonestringNoReturn only the contact with this number. +971501234567, 00971501234567 and 971501234567 all match.
searchstringNoContacts whose first name, last name, phone or email contains this text.
curl "https://app.zapgen.ae/api/contacts?phone=%2B971501234567" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json"
Response
{
  "data": [
    {
      "uuid": "4d1f7a3e-9b2c-4c41-8f0e-2a7d5c9b1e63",
      "first_name": "Sara",
      "last_name": "Ahmed",
      "phone": "+971501234567",
      "email": "[email protected]",
      "is_subscribed": 1,
      "created_at": "2026-10-03 14:20:11"
    }
  ],
  "links": { "first": "…", "last": "…", "prev": null, "next": null },
  "meta": { "current_page": 1, "last_page": 1, "per_page": 10, "total": 1 }
}

No match gives an empty data array, not an error. To get one contact, filter by phone: there's no endpoint that fetches a contact by its uuid yet.

Create a contact#

POSThttps://app.zapgen.ae/api/contacts
NameTypeRequiredDescription
first_namestringYesFirst name.
phonestringYesNumber with country code. Must not already belong to a contact.
last_namestringNoLast name.
emailstringNoEmail address.
street, city, state, zip, countrystringNoAddress.
metadataobjectNoCustom field values keyed by field name, e.g. {"Membership": "Gold"}.
is_subscribedbooleanNoWhether the contact receives marketing messages.
grouparrayNoGroup uuids to add the contact to.
filefileNoProfile photo (JPG, PNG, GIF or WebP, up to 5 MB). Send the request as multipart/form-data to include it.
curl -X POST https://app.zapgen.ae/api/contacts \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "first_name": "Sara",
    "last_name": "Ahmed",
    "phone": "+971501234567",
    "email": "[email protected]",
    "city": "Dubai",
    "metadata": { "Membership": "Gold" },
    "group": ["9a3c1e7b-5d2f-4b8a-9c6e-1f0d2b3a4c5d"]
  }'
Response
{
  "statusCode": 200,
  "id": "4d1f7a3e-9b2c-4c41-8f0e-2a7d5c9b1e63",
  "message": "Request processed successfully"
}

id is the new contact's uuid. A number that's already a contact gives a 400 with "phone": ["This phone number already exists"].

Create or update by phone (upsert)#

POSThttps://app.zapgen.ae/api/contacts/upsert

Finds the contact by phone number. If there isn't one, it creates it. If there is, it updates only the fields you send and leaves the rest as they are.

NameTypeRequiredDescription
phonestringYesNumber with country code. Used to find the contact.
first_namestringWhen creatingFirst name. Required only if the contact doesn't exist yet.
last_namestring or nullNoLast name. null clears it.
emailstring or nullNoA valid email address. null clears it.
street, city, state, zip, countrystringNoAddress. Only the parts you send change.
metadataobjectNoCustom field values keyed by field name.
metadata_modestringNomerge (default) adds your values to the existing ones. replace replaces all custom field values with yours.
is_subscribedbooleanNoWhether the contact receives marketing messages.
grouparrayNoGroup uuids. Replaces the contact's groups with this list. Unknown uuids are ignored.
curl -X POST https://app.zapgen.ae/api/contacts/upsert \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "phone": "+971501234567",
    "first_name": "Sara",
    "email": "[email protected]",
    "metadata": { "Last order": "#4421" }
  }'
Response
{
  "statusCode": 200,
  "message": "Request processed successfully",
  "created": false,
  "id": "4d1f7a3e-9b2c-4c41-8f0e-2a7d5c9b1e63",
  "contact": {
    "uuid": "4d1f7a3e-9b2c-4c41-8f0e-2a7d5c9b1e63",
    "first_name": "Sara",
    "last_name": "Ahmed",
    "phone": "+971501234567",
    "email": "[email protected]",
    "is_subscribed": 1
  }
}

created is true when a new contact was made. Without first_name for a new number you get a 400: "first_name": ["The first name field is required when creating a contact."].

Replace a contact#

PUThttps://app.zapgen.ae/api/contacts/{uuid}

Replaces a contact's details. Takes the same fields as Create a contact, but first_name and phone are optional.

PUT replaces, it doesn't merge

last_name, email, the address and metadata are set to exactly what you send, so a field you leave out is cleared. first_name, phone, is_subscribed and group are only changed when you send them. To change just one or two fields, use upsert instead.

curl -X PUT https://app.zapgen.ae/api/contacts/4d1f7a3e-9b2c-4c41-8f0e-2a7d5c9b1e63 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "first_name": "Sara",
    "last_name": "Ahmed",
    "email": "[email protected]",
    "city": "Abu Dhabi",
    "metadata": { "Membership": "Platinum" }
  }'
Response
{
  "statusCode": 200,
  "id": "4d1f7a3e-9b2c-4c41-8f0e-2a7d5c9b1e63",
  "message": "Request processed successfully"
}

An unknown uuid returns 404 with Contact not found.

Delete a contact#

DELETEhttps://app.zapgen.ae/api/contacts/{uuid}

Deletes the contact from your organization.

curl -X DELETE https://app.zapgen.ae/api/contacts/4d1f7a3e-9b2c-4c41-8f0e-2a7d5c9b1e63 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json"
Response
{
  "statusCode": 200,
  "id": "4d1f7a3e-9b2c-4c41-8f0e-2a7d5c9b1e63",
  "message": "Request processed successfully"
}

An unknown or already deleted uuid returns 404 with Contact not found.

Errors#

StatusWhen
400A required field is missing, the phone number isn't valid, or (on create) it already belongs to a contact.
401The API key is missing or wrong.
403Your subscription has ended. Creating and changing contacts stops; listing and deleting still work.
404No contact with that uuid in your organization.

Good to know#

  • Changes made through the API send contact.created, contact.updated and contact.deleted webhooks, like changes made in the app.
  • Contacts that ZAPGEN creates by itself, when a new number messages you or when you send to a new number, don't send contact.created. Watch message.received for those.
  • Contacts imported from Excel in the app don't send contact.created either.
Still stuck?Our team answers on WhatsApp and at [email protected].
Ask us on WhatsApp