Skip to main content
PUT
/
instances
/
{instanceId}
/
token
/
{token}
/
update-queue-settings
Update queue settings
curl --request PUT \
  --url https://api.z-api.io/instances/{instanceId}/token/{token}/update-queue-settings \
  --header 'Client-Token: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "disableEnqueueWhenDisconnected": true
}
'

Concept

This method allows updating settings related to the message queue behavior of an instance. Currently, it is possible to configure whether the instance should accept new messages in the queue while disconnected.

Attributes

Required

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

Body (Required)

disableEnqueueWhenDisconnected
boolean
Defines whether the instance should block message enqueueing when it is disconnected.

Request Body

{
  "disableEnqueueWhenDisconnected": true
}

Queue behavior

  • By default, Z-API allows sending messages to the queue even when the instance does not have a connected number
  • When disableEnqueueWhenDisconnected is true, new messages will not be added to the queue while the instance is disconnected
  • When disableEnqueueWhenDisconnected is false, the default behavior is maintained (messages continue to be enqueued even when disconnected)
  • This setting is useful to prevent message accumulation in the queue when an instance is reused without a connected number

Response

200

{
  "success": true
}

405

In this case, make sure you are using the correct method (PUT) as specified at the beginning of this topic.

415

If you receive a 415 error, make sure the “Content-Type” header is correctly set to “application/json”.