Agents
Label agents in bulk
Applies one label change to up to 500 agents. clear removes keys, set replaces a key’s value, add adds values to a key that allows several, and remove removes values; they apply in that order. The change is all or nothing: an unknown key or a value the key doesn’t allow rejects the whole request. Returns how many agents changed. Requires agents:manage.
PATCH
/
core
/
agents
/
labels
Label agents in bulk
curl --request PATCH \
--url https://api.anyreach.ai/core/agents/labels \
--header 'Content-Type: application/json' \
--data '
{
"ids": [
"9b2c5f0e-6a1d-4c3e-8f7a-2d1b0c9e8a76"
],
"set": {
"industry": "Healthcare"
},
"add": {
"language": [
"Spanish"
]
}
}
'import requests
url = "https://api.anyreach.ai/core/agents/labels"
payload = {
"ids": ["9b2c5f0e-6a1d-4c3e-8f7a-2d1b0c9e8a76"],
"set": { "industry": "Healthcare" },
"add": { "language": ["Spanish"] }
}
headers = {"Content-Type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
ids: ['9b2c5f0e-6a1d-4c3e-8f7a-2d1b0c9e8a76'],
set: {industry: 'Healthcare'},
add: {language: ['Spanish']}
})
};
fetch('https://api.anyreach.ai/core/agents/labels', 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.anyreach.ai/core/agents/labels",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'ids' => [
'9b2c5f0e-6a1d-4c3e-8f7a-2d1b0c9e8a76'
],
'set' => [
'industry' => 'Healthcare'
],
'add' => [
'language' => [
'Spanish'
]
]
]),
CURLOPT_HTTPHEADER => [
"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.anyreach.ai/core/agents/labels"
payload := strings.NewReader("{\n \"ids\": [\n \"9b2c5f0e-6a1d-4c3e-8f7a-2d1b0c9e8a76\"\n ],\n \"set\": {\n \"industry\": \"Healthcare\"\n },\n \"add\": {\n \"language\": [\n \"Spanish\"\n ]\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
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.patch("https://api.anyreach.ai/core/agents/labels")
.header("Content-Type", "application/json")
.body("{\n \"ids\": [\n \"9b2c5f0e-6a1d-4c3e-8f7a-2d1b0c9e8a76\"\n ],\n \"set\": {\n \"industry\": \"Healthcare\"\n },\n \"add\": {\n \"language\": [\n \"Spanish\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.anyreach.ai/core/agents/labels")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"ids\": [\n \"9b2c5f0e-6a1d-4c3e-8f7a-2d1b0c9e8a76\"\n ],\n \"set\": {\n \"industry\": \"Healthcare\"\n },\n \"add\": {\n \"language\": [\n \"Spanish\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"updated": 1
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Headers
Organization ID for user PATs (pat_ prefix tokens)
Body
application/json
Response
Successful Response
⌘I
Label agents in bulk
curl --request PATCH \
--url https://api.anyreach.ai/core/agents/labels \
--header 'Content-Type: application/json' \
--data '
{
"ids": [
"9b2c5f0e-6a1d-4c3e-8f7a-2d1b0c9e8a76"
],
"set": {
"industry": "Healthcare"
},
"add": {
"language": [
"Spanish"
]
}
}
'import requests
url = "https://api.anyreach.ai/core/agents/labels"
payload = {
"ids": ["9b2c5f0e-6a1d-4c3e-8f7a-2d1b0c9e8a76"],
"set": { "industry": "Healthcare" },
"add": { "language": ["Spanish"] }
}
headers = {"Content-Type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
ids: ['9b2c5f0e-6a1d-4c3e-8f7a-2d1b0c9e8a76'],
set: {industry: 'Healthcare'},
add: {language: ['Spanish']}
})
};
fetch('https://api.anyreach.ai/core/agents/labels', 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.anyreach.ai/core/agents/labels",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'ids' => [
'9b2c5f0e-6a1d-4c3e-8f7a-2d1b0c9e8a76'
],
'set' => [
'industry' => 'Healthcare'
],
'add' => [
'language' => [
'Spanish'
]
]
]),
CURLOPT_HTTPHEADER => [
"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.anyreach.ai/core/agents/labels"
payload := strings.NewReader("{\n \"ids\": [\n \"9b2c5f0e-6a1d-4c3e-8f7a-2d1b0c9e8a76\"\n ],\n \"set\": {\n \"industry\": \"Healthcare\"\n },\n \"add\": {\n \"language\": [\n \"Spanish\"\n ]\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
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.patch("https://api.anyreach.ai/core/agents/labels")
.header("Content-Type", "application/json")
.body("{\n \"ids\": [\n \"9b2c5f0e-6a1d-4c3e-8f7a-2d1b0c9e8a76\"\n ],\n \"set\": {\n \"industry\": \"Healthcare\"\n },\n \"add\": {\n \"language\": [\n \"Spanish\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.anyreach.ai/core/agents/labels")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"ids\": [\n \"9b2c5f0e-6a1d-4c3e-8f7a-2d1b0c9e8a76\"\n ],\n \"set\": {\n \"industry\": \"Healthcare\"\n },\n \"add\": {\n \"language\": [\n \"Spanish\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"updated": 1
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}
