Skip to main content

Instances API

Endpoints for managing your WhatsApp instances, including listing, connecting, and configuring webhooks.

Creating New Instances

To create new instances programmatically, you need a partner account. See the Partner API for details.

List Instances

Returns a paginated list of all your WhatsApp instances.

GET /api/instances

Query Parameters

ParameterTypeRequiredDefaultDescription
pagenumberNo1Page number (minimum: 1)
limitnumberNo100Items per page (1-100)

Response

{
"data": [
{
"instanceId": "instance-123",
"name": "My WhatsApp Instance",
"status": "connected",
"whatsappJid": "[email protected]",
"whatsappLid": "5511999999999@lid",
"whatsappId": "5511999999999",
"whatsappName": "My Company",
"whatsappProfilePicUrl": "https://example.com/profile-pic.jpg",
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z"
}
],
"isFirstPage": true,
"isLastPage": true,
"currentPage": 1,
"previousPage": null,
"nextPage": null,
"pageCount": 1,
"totalCount": 1
}

Instance Status Values

StatusDescription
createdInstance created, not yet started
connectingInstance is connecting to WhatsApp
pending_qr_code_scanWaiting for QR code scan
connectedInstance is connected and ready
stoppedInstance was stopped
manually_stoppedInstance was manually stopped by user
errorInstance encountered an error
qr_timeoutQR code scan timed out
payment_pendingPayment required to continue

Example

curl -X GET "https://api.zapyapi.com/api/instances?page=1&limit=10" \
-H "x-api-key: YOUR_API_KEY"

Get QR Code

Gets the QR code for connecting a WhatsApp instance. The user must scan this QR code with their WhatsApp mobile app.

GET /api/instances/{instanceId}/qr

Path Parameters

ParameterTypeRequiredDescription
instanceIdstringYesWhatsApp instance identifier

Response

{
"instanceId": "my-whatsapp-instance",
"qrCode": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
"expiresAt": 1672531200000,
"attempt": 1
}
FieldTypeDescription
instanceIdstringInstance identifier
qrCodestringQR code as base64 image or raw string
expiresAtnumberExpiration timestamp (milliseconds)
attemptnumberQR code generation attempt number

Example

curl -X GET "https://api.zapyapi.com/api/instances/my-instance/qr" \
-H "x-api-key: YOUR_API_KEY"

Restart Instance

Restarts a WhatsApp instance. Use this to reconnect after disconnection or errors.

POST /api/instances/{instanceId}/restart

Path Parameters

ParameterTypeRequiredDescription
instanceIdstringYesWhatsApp instance identifier

Response

{}

Returns an empty object on success.

Example

curl -X POST "https://api.zapyapi.com/api/instances/my-instance/restart" \
-H "x-api-key: YOUR_API_KEY"

Logout Instance

Logs out a WhatsApp instance. This disconnects the WhatsApp session and requires re-scanning the QR code to reconnect.

POST /api/instances/{instanceId}/logout

Path Parameters

ParameterTypeRequiredDescription
instanceIdstringYesWhatsApp instance identifier

Response

{}

Returns an empty object on success.

Example

curl -X POST "https://api.zapyapi.com/api/instances/my-instance/logout" \
-H "x-api-key: YOUR_API_KEY"

Webhook Configuration

Create or Update Webhook

Creates or updates the webhook configuration for an instance. Webhooks allow you to receive real-time events from your WhatsApp instance.

POST /api/instances/{instanceId}/webhook-config

Path Parameters

ParameterTypeRequiredDescription
instanceIdstringYesWhatsApp instance identifier

Request Body

{
"webhookUrl": "https://api.example.com/webhooks/whatsapp",
"secret": "your-secret-key",
"isActive": true
}
FieldTypeRequiredDefaultDescription
webhookUrlstringYes-URL to receive webhook events
secretstringNo-Secret key for signature verification
isActivebooleanYestrueWhether the webhook is active

Response

{
"id": "webhook-config-uuid",
"instanceId": "my-instance",
"webhookUrl": "https://api.example.com/webhooks/whatsapp",
"secret": "your-secret-key",
"isActive": true,
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z"
}

Example

curl -X POST "https://api.zapyapi.com/api/instances/my-instance/webhook-config" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"webhookUrl": "https://api.example.com/webhooks/whatsapp",
"secret": "my-secret-key",
"isActive": true
}'

Get Webhook Configuration

Gets the current webhook configuration for an instance.

GET /api/instances/{instanceId}/webhook-config

Path Parameters

ParameterTypeRequiredDescription
instanceIdstringYesWhatsApp instance identifier

Response

{
"id": "webhook-config-uuid",
"instanceId": "my-instance",
"webhookUrl": "https://api.example.com/webhooks/whatsapp",
"secret": "your-secret-key",
"isActive": true,
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z"
}

Example

curl -X GET "https://api.zapyapi.com/api/instances/my-instance/webhook-config" \
-H "x-api-key: YOUR_API_KEY"

Delete Webhook Configuration

Deletes the webhook configuration for an instance. The instance will stop sending webhook events.

DELETE /api/instances/{instanceId}/webhook-config

Path Parameters

ParameterTypeRequiredDescription
instanceIdstringYesWhatsApp instance identifier

Response

{}

Returns an empty object on success.

Example

curl -X DELETE "https://api.zapyapi.com/api/instances/my-instance/webhook-config" \
-H "x-api-key: YOUR_API_KEY"

Check Numbers

Checks if phone numbers are registered on WhatsApp.

POST /api/instances/{instanceId}/check-numbers

Path Parameters

ParameterTypeRequiredDescription
instanceIdstringYesWhatsApp instance identifier

Request Body

{
"numbers": ["5511999999999", "5521888888888"]
}
FieldTypeRequiredDescription
numbersstring[]YesArray of phone numbers to check

Response

{
"results": [
{
"number": "5511999999999",
"exists": true,
"jid": "[email protected]"
},
{
"number": "5521888888888",
"exists": false
}
]
}
FieldTypeDescription
resultsarrayArray of check results
results[].numberstringThe phone number that was checked
results[].existsbooleanWhether the number is registered on WhatsApp
results[].jidstringWhatsApp JID (only if exists is true)

Example

curl -X POST "https://api.zapyapi.com/api/instances/my-instance/check-numbers" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"numbers": ["5511999999999", "5521888888888"]
}'

Send Presence

Sends a presence update (typing indicator, online status, etc.) to a contact.

POST /api/instances/{instanceId}/presence

Path Parameters

ParameterTypeRequiredDescription
instanceIdstringYesWhatsApp instance identifier

Request Body

{
"to": "5511999999999",
"presence": "composing"
}
FieldTypeRequiredDescription
tostringYesRecipient phone number or chat ID
presencestringYesPresence type (see below)

Presence Types

ValueDescription
composingShow typing indicator
recordingShow recording audio indicator
pausedStop typing indicator
availableShow as online
unavailableShow as offline

Response

Returns 204 No Content on success.

Example

# Show typing indicator
curl -X POST "https://api.zapyapi.com/api/instances/my-instance/presence" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "5511999999999",
"presence": "composing"
}'

# Show recording indicator
curl -X POST "https://api.zapyapi.com/api/instances/my-instance/presence" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "5511999999999",
"presence": "recording"
}'

Get Profile Picture

Gets the profile picture URL for a contact.

GET /api/instances/{instanceId}/contacts/{phone}/profile-picture

Path Parameters

ParameterTypeRequiredDescription
instanceIdstringYesWhatsApp instance identifier
phonestringYesPhone number or WhatsApp JID

Response

{
"url": "https://example.com/profile-picture.jpg"
}
FieldTypeDescription
urlstring | nullProfile picture URL (null if not available)

Example

curl -X GET "https://api.zapyapi.com/api/instances/my-instance/contacts/5511999999999/profile-picture" \
-H "x-api-key: YOUR_API_KEY"

Block Contact

Blocks a contact on WhatsApp.

POST /api/instances/{instanceId}/contacts/{phone}/block

Path Parameters

ParameterTypeRequiredDescription
instanceIdstringYesWhatsApp instance identifier
phonestringYesPhone number or WhatsApp JID to block

Response

Returns 204 No Content on success.

Example

curl -X POST "https://api.zapyapi.com/api/instances/my-instance/contacts/5511999999999/block" \
-H "x-api-key: YOUR_API_KEY"

Unblock Contact

Unblocks a previously blocked contact.

DELETE /api/instances/{instanceId}/contacts/{phone}/block

Path Parameters

ParameterTypeRequiredDescription
instanceIdstringYesWhatsApp instance identifier
phonestringYesPhone number or WhatsApp JID to unblock

Response

Returns 204 No Content on success.

Example

curl -X DELETE "https://api.zapyapi.com/api/instances/my-instance/contacts/5511999999999/block" \
-H "x-api-key: YOUR_API_KEY"

Get Group Metadata

Gets metadata for a WhatsApp group, including participants.

GET /api/instances/{instanceId}/groups/{groupId}

Path Parameters

ParameterTypeRequiredDescription
instanceIdstringYesWhatsApp instance identifier
groupIdstringYesGroup JID (e.g., [email protected])

Response

{
"id": "[email protected]",
"subject": "My Group Name",
"description": "Group description here",
"owner": "[email protected]",
"creation": 1672531200,
"participants": [
{
"id": "[email protected]",
"admin": "superadmin"
},
{
"id": "[email protected]",
"admin": "admin"
},
{
"id": "[email protected]",
"admin": null
}
]
}
FieldTypeDescription
idstringGroup JID
subjectstringGroup name
descriptionstring | nullGroup description
ownerstring | nullGroup owner JID
creationnumberCreation timestamp (Unix seconds)
participantsarrayList of group participants
participants[].idstringParticipant JID
participants[].adminstring | nullAdmin status: superadmin, admin, or null

Example

curl -X GET "https://api.zapyapi.com/api/instances/my-instance/groups/[email protected]" \
-H "x-api-key: YOUR_API_KEY"