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
}
'import requests
url = "https://api.z-api.io/instances/{instanceId}/token/{token}/update-queue-settings"
payload = { "disableEnqueueWhenDisconnected": True }
headers = {
"Client-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Client-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({disableEnqueueWhenDisconnected: true})
};
fetch('https://api.z-api.io/instances/{instanceId}/token/{token}/update-queue-settings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.z-api.io/instances/{instanceId}/token/{token}/update-queue-settings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'disableEnqueueWhenDisconnected' => true
]),
CURLOPT_HTTPHEADER => [
"Client-Token: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.z-api.io/instances/{instanceId}/token/{token}/update-queue-settings"
payload := strings.NewReader("{\n \"disableEnqueueWhenDisconnected\": true\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Client-Token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.z-api.io/instances/{instanceId}/token/{token}/update-queue-settings")
.header("Client-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"disableEnqueueWhenDisconnected\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.z-api.io/instances/{instanceId}/token/{token}/update-queue-settings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Client-Token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"disableEnqueueWhenDisconnected\": true\n}"
response = http.request(request)
puts response.read_bodyMessage Queue
Update queue settings
Updates the queue settings of an instance, allowing control over message enqueue behavior when disconnected.
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
}
'import requests
url = "https://api.z-api.io/instances/{instanceId}/token/{token}/update-queue-settings"
payload = { "disableEnqueueWhenDisconnected": True }
headers = {
"Client-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Client-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({disableEnqueueWhenDisconnected: true})
};
fetch('https://api.z-api.io/instances/{instanceId}/token/{token}/update-queue-settings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.z-api.io/instances/{instanceId}/token/{token}/update-queue-settings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'disableEnqueueWhenDisconnected' => true
]),
CURLOPT_HTTPHEADER => [
"Client-Token: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.z-api.io/instances/{instanceId}/token/{token}/update-queue-settings"
payload := strings.NewReader("{\n \"disableEnqueueWhenDisconnected\": true\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Client-Token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.z-api.io/instances/{instanceId}/token/{token}/update-queue-settings")
.header("Client-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"disableEnqueueWhenDisconnected\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.z-api.io/instances/{instanceId}/token/{token}/update-queue-settings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Client-Token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"disableEnqueueWhenDisconnected\": true\n}"
response = http.request(request)
puts response.read_bodyConcept
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
string
required
Your instance ID. Available in the Z-API panel under Instances.
string
required
Your Z-API instance token.
Body (Required)
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
disableEnqueueWhenDisconnectedistrue, new messages will not be added to the queue while the instance is disconnected - When
disableEnqueueWhenDisconnectedisfalse, 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
}