Skip to main content

Get contacts

Method#

/contacts#

GET https://api.z-api.io/instances/YOUR_INSTANCE/token/YOUR_TOKEN/contacts

Header#

KeyValue
Client-TokenACCOUNT SECURITY TOKEN

Concept#

This method is responsible for returning all of your Whatsapp contacts. Remember what was said in the introduction about contact numbers. In case you skipped this part, I suggest that you take a step back and read our introduction.


Attributes#

Required#

AttributesTypeDescription
pageintegerUsed for pagination you have to inform here the contact page you want to search
pageSizeintegerSpecifies the size of the contact return per page

Optionals#

AttributesTypeDescription

Request Params#

URL example#

Method

GET https://api.z-api.io/instances/YOUR_INSTANCE/token/YOUR_TOKEN/contacts?page=1&pageSize=20


Response#

200#

AttributesTypeDescription
phonestringContacts phone
namestringFirst and last name of the contact, it will only return filled in if you have the number in your contacts
shortstringContact name, it will only return filled in if you have the number in your contacts
vnamestringContact name if you have him as a contact
notifystringName entered in Whatsapp name settings

Example

[
{
"name": "Nome e sobrenome do contato 1",
"short": "Nome do contato 1",
"notify": "Nome no Whatsapp 1",
"vname": "Nome no vcard",
"phone": "559999999999"
}
]

405#

In this case certify that you are sending the correct specification of the method. This means, verify if you sent a POST or GET as specified at the beginning of this topic.

415#

In case you receive 415 error, make sure to add the “Content-Type” of the object you are sending in the request headers, mostly “application/json”


Code#