Configure Proxy
curl --request PUT \
--url https://api.z-api.io/instances/{instanceId}/token/{token}/integrator/configure-proxy \
--header 'Client-Token: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"proxyUrl": "<string>",
"enable": true
}
'import requests
url = "https://api.z-api.io/instances/{instanceId}/token/{token}/integrator/configure-proxy"
payload = {
"proxyUrl": "<string>",
"enable": 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({proxyUrl: '<string>', enable: true})
};
fetch('https://api.z-api.io/instances/{instanceId}/token/{token}/integrator/configure-proxy', 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}/integrator/configure-proxy",
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([
'proxyUrl' => '<string>',
'enable' => 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}/integrator/configure-proxy"
payload := strings.NewReader("{\n \"proxyUrl\": \"<string>\",\n \"enable\": 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}/integrator/configure-proxy")
.header("Client-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"proxyUrl\": \"<string>\",\n \"enable\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.z-api.io/instances/{instanceId}/token/{token}/integrator/configure-proxy")
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 \"proxyUrl\": \"<string>\",\n \"enable\": true\n}"
response = http.request(request)
puts response.read_bodyPartners
Configure Proxy
Configures the proxy URL and enables or disables the use of proxy on the instance
PUT
/
instances
/
{instanceId}
/
token
/
{token}
/
integrator
/
configure-proxy
Configure Proxy
curl --request PUT \
--url https://api.z-api.io/instances/{instanceId}/token/{token}/integrator/configure-proxy \
--header 'Client-Token: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"proxyUrl": "<string>",
"enable": true
}
'import requests
url = "https://api.z-api.io/instances/{instanceId}/token/{token}/integrator/configure-proxy"
payload = {
"proxyUrl": "<string>",
"enable": 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({proxyUrl: '<string>', enable: true})
};
fetch('https://api.z-api.io/instances/{instanceId}/token/{token}/integrator/configure-proxy', 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}/integrator/configure-proxy",
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([
'proxyUrl' => '<string>',
'enable' => 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}/integrator/configure-proxy"
payload := strings.NewReader("{\n \"proxyUrl\": \"<string>\",\n \"enable\": 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}/integrator/configure-proxy")
.header("Client-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"proxyUrl\": \"<string>\",\n \"enable\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.z-api.io/instances/{instanceId}/token/{token}/integrator/configure-proxy")
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 \"proxyUrl\": \"<string>\",\n \"enable\": true\n}"
response = http.request(request)
puts response.read_bodyOverview
Method used to configure both the proxy URL and the option to enable proxy usage on the instance.To use Partner endpoints, provide the Partner Token in the Authorization field, in the format:
Bearer <Partner-Token>The current values configured for
proxyUrl and useProxy on the instance can be checked at the Instance Data endpoint.Parameters
string
required
Your instance ID. Available in the Z-API panel under Instances.
string
required
Your Z-API instance token.
Attributes
string
required
Proxy URL to be used by the instance.
boolean
required
Defines whether the configured proxy should be enabled (
true) or disabled (false).If the
proxyUrl field is omitted or provided as an empty string, the instance’s current proxyUrl configuration will be replaced with an empty value.If the enable field is omitted or set to null, the instance’s existing enable configuration will be replaced with false.If there is no
proxyUrl configured, the enable field has no effect. The absence of a configured proxy URL will result in the instance connecting without using a proxy, regardless of the value of enable.Request Body
{
"proxyUrl": "socks5://user:password123@localhost:1080",
"enable": true
}
If an error occurs while connecting using the configured proxy, 3 retry attempts will be made.If the connection fails on the third attempt, the instance is connected without using any proxy, and a webhook is triggered to the URL configured in the Proxy Failure Webhook.
Response
200
{
"value": true
}
400
"Proxy is not reachable"