Skip to main content
POST
/
instances
/
{instanceId}
/
token
/
{token}
/
contacts
/
add
Add contacts
curl --request POST \
  --url https://api.z-api.io/instances/{instanceId}/token/{token}/contacts/add \
  --header 'Client-Token: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "firstName": "<string>",
  "phone": "<string>"
}
'

Overview

This method is responsible for saving WhatsApp contacts to your phone’s contact list.
About this featureThe method for adding contacts to the WhatsApp list will only work for accounts that have already received the necessary update. Make sure your WhatsApp account has received the update before using this feature. Otherwise, the operation will not be completed successfully.Additionally, you need to allow WhatsApp to add contacts directly on your phone. To do this, go to your app’s privacy settings and adjust the permissions so that WhatsApp can access and modify your contacts.

Attributes

instanceId
string
required
Your instance ID. Available in the Z-API panel under Instances.
token
string
required
Your Z-API instance token.

Required

firstName
string
required
Name of the contact to be added to the phone book
phone
string
required
Phone number of the contact to be added to the phone book

Optional

lastName
string
Last name of the contact to be added to the phone book

Request Body

[
  {
    "firstName": "Contact 1",
    "lastName": "Last name 1",
    "phone": "554499999999"
  },
  {
    "firstName": "Contact 2",
    "lastName": "Last name 2",
    "phone": "554499998888"
  }
]

Response

200

{
  "success": true,
  "errors": []
}

405

Make sure you are correctly sending the method specification, that is, verify that you sent POST or GET as specified at the beginning of this topic.

415

If you receive a 415 error, make sure to add the “Content-Type” header to your request, which in most cases is “application/json”.