TypeScript SDK
import { Client } from "@notionhq/client"
const notion = new Client({ auth: process.env.NOTION_API_KEY })
const response = await notion.agents.batch({
operations: [
{
action: "update_status",
agent_id: "1f0c7c06-781b-4987-9986-5c8dd3028013",
fields: { status: "disabled" }
}
]
})curl --request POST \
--url https://api.notion.com/v1/agents/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Notion-Version: <notion-version>' \
--data '
{
"operations": [
{
"action": "update_status",
"agent_id": "<string>",
"fields": {}
}
]
}
'import requests
url = "https://api.notion.com/v1/agents/batch"
payload = { "operations": [
{
"action": "update_status",
"agent_id": "<string>",
"fields": {}
}
] }
headers = {
"Notion-Version": "<notion-version>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.notion.com/v1/agents/batch",
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([
'operations' => [
[
'action' => 'update_status',
'agent_id' => '<string>',
'fields' => [
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Notion-Version: <notion-version>"
],
]);
$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.notion.com/v1/agents/batch"
payload := strings.NewReader("{\n \"operations\": [\n {\n \"action\": \"update_status\",\n \"agent_id\": \"<string>\",\n \"fields\": {}\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Notion-Version", "<notion-version>")
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.post("https://api.notion.com/v1/agents/batch")
.header("Notion-Version", "<notion-version>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"operations\": [\n {\n \"action\": \"update_status\",\n \"agent_id\": \"<string>\",\n \"fields\": {}\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.notion.com/v1/agents/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Notion-Version"] = '<notion-version>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"operations\": [\n {\n \"action\": \"update_status\",\n \"agent_id\": \"<string>\",\n \"fields\": {}\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"object": "async_task",
"id": "<string>",
"status_url": "<string>",
"created_time": "2023-11-07T05:31:56Z",
"operation": {
"name": "<string>"
},
"poll_after_seconds": 1
}{
"object": "error",
"message": "<string>",
"status": 400,
"additional_data": {}
}{
"object": "error",
"message": "<string>",
"code": "unauthorized",
"status": 401,
"additional_data": {}
}{
"object": "error",
"message": "<string>",
"status": 403,
"additional_data": {}
}{
"object": "error",
"message": "<string>",
"status": 404,
"additional_data": {}
}{
"object": "error",
"message": "<string>",
"code": "row_limit_exceeded",
"status": 406,
"additional_data": {}
}{
"object": "error",
"message": "<string>",
"status": 409,
"additional_data": {}
}{
"object": "error",
"message": "<string>",
"code": "rate_limited",
"status": 429,
"additional_data": {}
}{
"object": "error",
"message": "<string>",
"code": "internal_server_error",
"status": 500,
"additional_data": {}
}{
"object": "error",
"message": "<string>",
"code": "service_unavailable",
"status": 503,
"additional_data": {}
}{
"object": "error",
"message": "<string>",
"code": "gateway_timeout",
"status": 504,
"additional_data": {}
}{
"object": "error",
"message": "<string>",
"code": "service_overload",
"status": 529,
"additional_data": {}
}Agents
Batch manage agent
Asynchronously apply multiple agent management operations.
POST
/
v1
/
agents
/
batch
TypeScript SDK
import { Client } from "@notionhq/client"
const notion = new Client({ auth: process.env.NOTION_API_KEY })
const response = await notion.agents.batch({
operations: [
{
action: "update_status",
agent_id: "1f0c7c06-781b-4987-9986-5c8dd3028013",
fields: { status: "disabled" }
}
]
})curl --request POST \
--url https://api.notion.com/v1/agents/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Notion-Version: <notion-version>' \
--data '
{
"operations": [
{
"action": "update_status",
"agent_id": "<string>",
"fields": {}
}
]
}
'import requests
url = "https://api.notion.com/v1/agents/batch"
payload = { "operations": [
{
"action": "update_status",
"agent_id": "<string>",
"fields": {}
}
] }
headers = {
"Notion-Version": "<notion-version>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.notion.com/v1/agents/batch",
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([
'operations' => [
[
'action' => 'update_status',
'agent_id' => '<string>',
'fields' => [
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Notion-Version: <notion-version>"
],
]);
$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.notion.com/v1/agents/batch"
payload := strings.NewReader("{\n \"operations\": [\n {\n \"action\": \"update_status\",\n \"agent_id\": \"<string>\",\n \"fields\": {}\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Notion-Version", "<notion-version>")
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.post("https://api.notion.com/v1/agents/batch")
.header("Notion-Version", "<notion-version>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"operations\": [\n {\n \"action\": \"update_status\",\n \"agent_id\": \"<string>\",\n \"fields\": {}\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.notion.com/v1/agents/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Notion-Version"] = '<notion-version>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"operations\": [\n {\n \"action\": \"update_status\",\n \"agent_id\": \"<string>\",\n \"fields\": {}\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"object": "async_task",
"id": "<string>",
"status_url": "<string>",
"created_time": "2023-11-07T05:31:56Z",
"operation": {
"name": "<string>"
},
"poll_after_seconds": 1
}{
"object": "error",
"message": "<string>",
"status": 400,
"additional_data": {}
}{
"object": "error",
"message": "<string>",
"code": "unauthorized",
"status": 401,
"additional_data": {}
}{
"object": "error",
"message": "<string>",
"status": 403,
"additional_data": {}
}{
"object": "error",
"message": "<string>",
"status": 404,
"additional_data": {}
}{
"object": "error",
"message": "<string>",
"code": "row_limit_exceeded",
"status": 406,
"additional_data": {}
}{
"object": "error",
"message": "<string>",
"status": 409,
"additional_data": {}
}{
"object": "error",
"message": "<string>",
"code": "rate_limited",
"status": 429,
"additional_data": {}
}{
"object": "error",
"message": "<string>",
"code": "internal_server_error",
"status": 500,
"additional_data": {}
}{
"object": "error",
"message": "<string>",
"code": "service_unavailable",
"status": 503,
"additional_data": {}
}{
"object": "error",
"message": "<string>",
"code": "gateway_timeout",
"status": 504,
"additional_data": {}
}{
"object": "error",
"message": "<string>",
"code": "service_overload",
"status": 529,
"additional_data": {}
}Each operation is authorized and applied independently. Poll the returned
status_url to retrieve the completed batch result.
Completed batch result
When the task succeeds,result is an agent_batch_result with a results array. Each entry includes index, action, agent_id, and outcome; use index to match it to the request because an agent can appear more than once.
| Outcome | Additional fields |
|---|---|
update_status success | status, pause_reason, and last_edited_time |
update_credit_limit success | credit_limit and last_edited_time |
delete success | status (deleted) and deleted_at |
| Error | error, a standard API error object |
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
The API version to use for this request. The latest version is 2026-03-11.
Available options:
2026-03-11 Body
application/json
The operations to apply, at least one and at most 100. Operations are applied in the order given, and the batch is not atomic: each operation succeeds or fails on its own, and per-operation outcomes are reported in the async task's result.
Required array length:
1 - 100 elementsOne action to apply to one agent. Each operation is authorized and applied on its own.
- Option 1
- Option 2
- Option 3
Show child attributes
Show child attributes
Response
Allowed value:
"async_task"Minimum string length:
1Minimum string length:
1Show child attributes
Show child attributes
Available options:
queued, running, retrying Required range:
x >= 0⌘I