cURL
curl --request PATCH \
--url https://api.useanima.sh/v1/threads/{threadId}/labels \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"addLabels": [
"<string>"
],
"removeLabels": [
"<string>"
]
}
'import requests
url = "https://api.useanima.sh/v1/threads/{threadId}/labels"
payload = {
"addLabels": ["<string>"],
"removeLabels": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({addLabels: ['<string>'], removeLabels: ['<string>']})
};
fetch('https://api.useanima.sh/v1/threads/{threadId}/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.useanima.sh/v1/threads/{threadId}/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([
'addLabels' => [
'<string>'
],
'removeLabels' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.useanima.sh/v1/threads/{threadId}/labels"
payload := strings.NewReader("{\n \"addLabels\": [\n \"<string>\"\n ],\n \"removeLabels\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.useanima.sh/v1/threads/{threadId}/labels")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"addLabels\": [\n \"<string>\"\n ],\n \"removeLabels\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.useanima.sh/v1/threads/{threadId}/labels")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"addLabels\": [\n \"<string>\"\n ],\n \"removeLabels\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"threadId": "<string>",
"updatedCount": 123
}API Reference
Patch threads labels
PATCH
/
threads
/
{threadId}
/
labels
cURL
curl --request PATCH \
--url https://api.useanima.sh/v1/threads/{threadId}/labels \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"addLabels": [
"<string>"
],
"removeLabels": [
"<string>"
]
}
'import requests
url = "https://api.useanima.sh/v1/threads/{threadId}/labels"
payload = {
"addLabels": ["<string>"],
"removeLabels": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({addLabels: ['<string>'], removeLabels: ['<string>']})
};
fetch('https://api.useanima.sh/v1/threads/{threadId}/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.useanima.sh/v1/threads/{threadId}/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([
'addLabels' => [
'<string>'
],
'removeLabels' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.useanima.sh/v1/threads/{threadId}/labels"
payload := strings.NewReader("{\n \"addLabels\": [\n \"<string>\"\n ],\n \"removeLabels\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.useanima.sh/v1/threads/{threadId}/labels")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"addLabels\": [\n \"<string>\"\n ],\n \"removeLabels\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.useanima.sh/v1/threads/{threadId}/labels")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"addLabels\": [\n \"<string>\"\n ],\n \"removeLabels\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"threadId": "<string>",
"updatedCount": 123
}Authorizations
BearerAuthApiKeyAuth
JWT Bearer token obtained from authentication. Pass as: Authorization: Bearer
Path Parameters
Conversation to relabel — every message in it is updated
Body
application/json
Add and/or remove labels across a whole conversation in one atomic write. Supply at least one of addLabels/removeLabels. Use this rather than looping over PATCH /messages/{id}/labels: a loop that fails partway leaves the thread in two folders at once.
Labels to add to every message in the thread. Adding read removes unread and vice versa, per message, exactly as the single-message route does.
Maximum array length:
50Required string length:
1 - 64Labels to remove from every message in the thread.
Maximum array length:
50Required string length:
1 - 64