Search channels
curl --request POST \
--url https://api.z-api.io/instances/{instanceId}/token/{token}/search-newsletter \
--header 'Client-Token: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"limit": 123,
"filters": {
"countryCodes": [
{}
]
}
}
'import requests
url = "https://api.z-api.io/instances/{instanceId}/token/{token}/search-newsletter"
payload = {
"limit": 123,
"filters": { "countryCodes": [{}] }
}
headers = {
"Client-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Client-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({limit: 123, filters: {countryCodes: [{}]}})
};
fetch('https://api.z-api.io/instances/{instanceId}/token/{token}/search-newsletter', 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}/search-newsletter",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'limit' => 123,
'filters' => [
'countryCodes' => [
[
]
]
]
]),
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}/search-newsletter"
payload := strings.NewReader("{\n \"limit\": 123,\n \"filters\": {\n \"countryCodes\": [\n {}\n ]\n }\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.z-api.io/instances/{instanceId}/token/{token}/search-newsletter")
.header("Client-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"limit\": 123,\n \"filters\": {\n \"countryCodes\": [\n {}\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.z-api.io/instances/{instanceId}/token/{token}/search-newsletter")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Client-Token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"limit\": 123,\n \"filters\": {\n \"countryCodes\": [\n {}\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"creationTime": 123,
"state": "<string>",
"name": "<string>",
"description": "<string>",
"subscribersCount": "<string>",
"inviteLink": "<string>",
"verification": "<string>",
"picture": "<string>",
"preview": "<string>",
"viewMetadata": {
"mute": "<string>",
"role": "<string>"
}
}Newsletter
Search channels
Search channels through filters
POST
/
instances
/
{instanceId}
/
token
/
{token}
/
search-newsletter
Search channels
curl --request POST \
--url https://api.z-api.io/instances/{instanceId}/token/{token}/search-newsletter \
--header 'Client-Token: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"limit": 123,
"filters": {
"countryCodes": [
{}
]
}
}
'import requests
url = "https://api.z-api.io/instances/{instanceId}/token/{token}/search-newsletter"
payload = {
"limit": 123,
"filters": { "countryCodes": [{}] }
}
headers = {
"Client-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Client-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({limit: 123, filters: {countryCodes: [{}]}})
};
fetch('https://api.z-api.io/instances/{instanceId}/token/{token}/search-newsletter', 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}/search-newsletter",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'limit' => 123,
'filters' => [
'countryCodes' => [
[
]
]
]
]),
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}/search-newsletter"
payload := strings.NewReader("{\n \"limit\": 123,\n \"filters\": {\n \"countryCodes\": [\n {}\n ]\n }\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.z-api.io/instances/{instanceId}/token/{token}/search-newsletter")
.header("Client-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"limit\": 123,\n \"filters\": {\n \"countryCodes\": [\n {}\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.z-api.io/instances/{instanceId}/token/{token}/search-newsletter")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Client-Token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"limit\": 123,\n \"filters\": {\n \"countryCodes\": [\n {}\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"creationTime": 123,
"state": "<string>",
"name": "<string>",
"description": "<string>",
"subscribersCount": "<string>",
"inviteLink": "<string>",
"verification": "<string>",
"picture": "<string>",
"preview": "<string>",
"viewMetadata": {
"mute": "<string>",
"role": "<string>"
}
}Overview
This method returns a list of channel data, according to the search performed through filters passed in the request body.Attributes
Header
string
required
Your instance ID. Available in the Z-API panel under Instances.
string
required
Your Z-API instance token.
Body
number
required
Record limit
string
View type (RECOMMENDED, TRENDING, POPULAR or NEW)
string
Search text
Request Body
{
"limit": 50,
"view": "TRENDING",
"filters": {
"countryCodes": ["BR", "AF", "CA"]
},
"searchText": "Z-API"
}
Response
200
Returns an array of channel objects.string
Channel ID
number
Channel creation timestamp
string
Channel state (ACTIVE or NON_EXISTING)
string
Channel name
string
Channel description
string
Number of channel subscribers
string
Channel invite link
string
Verification status (VERIFIED or UNVERIFIED)
string
Channel image URL
string
Channel preview image URL
object
[
{
"id": "999999999999999999@newsletter",
"creationTime": 1695124988,
"state": "ACTIVE",
"name": "Channel name",
"description": "Description",
"subscribersCount": "150",
"inviteLink": "https://whatsapp.com/channel/...",
"verification": "VERIFIED",
"picture": "https://...",
"preview": "https://...",
"viewMetadata": {
"mute": "OFF",
"role": "OWNER"
}
}
]
The channel ID must always contain the @newsletter suffix, as this is the standard used by WhatsApp.