TypeScript SDK
import { Client } from "@notionhq/client"
const notion = new Client({ auth: process.env.NOTION_API_KEY })
const response = await notion.agents.query({
filter: { property: "agent_type", string: { equals: "custom_agent" } },
sorts: [{ property: "created_time", direction: "descending" }],
page_size: 10
})curl --request POST \
--url https://api.notion.com/v1/agents/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Notion-Version: <notion-version>' \
--data '
{
"query": "<string>",
"filter": {
"property": "id",
"id": {
"equals": "<string>"
}
},
"sorts": [
{}
],
"start_cursor": "<string>",
"page_size": 50,
"verbose": true,
"include_deleted": true
}
'import requests
url = "https://api.notion.com/v1/agents/query"
payload = {
"query": "<string>",
"filter": {
"property": "id",
"id": { "equals": "<string>" }
},
"sorts": [{}],
"start_cursor": "<string>",
"page_size": 50,
"verbose": True,
"include_deleted": True
}
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/query",
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([
'query' => '<string>',
'filter' => [
'property' => 'id',
'id' => [
'equals' => '<string>'
]
],
'sorts' => [
[
]
],
'start_cursor' => '<string>',
'page_size' => 50,
'verbose' => true,
'include_deleted' => true
]),
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/query"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"filter\": {\n \"property\": \"id\",\n \"id\": {\n \"equals\": \"<string>\"\n }\n },\n \"sorts\": [\n {}\n ],\n \"start_cursor\": \"<string>\",\n \"page_size\": 50,\n \"verbose\": true,\n \"include_deleted\": true\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/query")
.header("Notion-Version", "<notion-version>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"filter\": {\n \"property\": \"id\",\n \"id\": {\n \"equals\": \"<string>\"\n }\n },\n \"sorts\": [\n {}\n ],\n \"start_cursor\": \"<string>\",\n \"page_size\": 50,\n \"verbose\": true,\n \"include_deleted\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.notion.com/v1/agents/query")
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 \"query\": \"<string>\",\n \"filter\": {\n \"property\": \"id\",\n \"id\": {\n \"equals\": \"<string>\"\n }\n },\n \"sorts\": [\n {}\n ],\n \"start_cursor\": \"<string>\",\n \"page_size\": 50,\n \"verbose\": true,\n \"include_deleted\": true\n}"
response = http.request(request)
puts response.read_body{
"object": "list",
"type": "agent",
"results": [
{
"object": "agent",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"instructions_page_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"icon": {
"type": "emoji",
"emoji": "😀"
},
"model": {
"mode": "auto"
},
"connections": [
{
"type": "notion",
"name": "<string>",
"account": null,
"permissions": [
{
"target": {
"type": "page",
"id": "<string>"
},
"scopes": [
"<string>"
]
}
]
}
],
"created_by": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"agent_version": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"number": 123,
"published_at": "<string>"
},
"created_time": "2023-11-07T05:31:56Z",
"last_edited_time": "2023-11-07T05:31:56Z",
"last_run_at": "2023-11-07T05:31:56Z",
"credit_limit": 1,
"triggers": [
{
"type": "<string>",
"enabled": true,
"schedule": {
"frequency": "<string>",
"interval": 2,
"weekdays": [
"<string>"
],
"monthdays": [
2
],
"week_numbers": [
123
],
"hour": 1,
"minute": 1,
"timezone": "<string>",
"start_date": "<string>",
"end": {
"type": "date",
"end_at": "<string>"
}
},
"config": {}
}
],
"instructions": "<string>"
}
],
"has_more": true,
"next_cursor": "<string>"
}{
"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
Query agents
Find Custom Agents that an integration can access.
POST
/
v1
/
agents
/
query
TypeScript SDK
import { Client } from "@notionhq/client"
const notion = new Client({ auth: process.env.NOTION_API_KEY })
const response = await notion.agents.query({
filter: { property: "agent_type", string: { equals: "custom_agent" } },
sorts: [{ property: "created_time", direction: "descending" }],
page_size: 10
})curl --request POST \
--url https://api.notion.com/v1/agents/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Notion-Version: <notion-version>' \
--data '
{
"query": "<string>",
"filter": {
"property": "id",
"id": {
"equals": "<string>"
}
},
"sorts": [
{}
],
"start_cursor": "<string>",
"page_size": 50,
"verbose": true,
"include_deleted": true
}
'import requests
url = "https://api.notion.com/v1/agents/query"
payload = {
"query": "<string>",
"filter": {
"property": "id",
"id": { "equals": "<string>" }
},
"sorts": [{}],
"start_cursor": "<string>",
"page_size": 50,
"verbose": True,
"include_deleted": True
}
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/query",
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([
'query' => '<string>',
'filter' => [
'property' => 'id',
'id' => [
'equals' => '<string>'
]
],
'sorts' => [
[
]
],
'start_cursor' => '<string>',
'page_size' => 50,
'verbose' => true,
'include_deleted' => true
]),
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/query"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"filter\": {\n \"property\": \"id\",\n \"id\": {\n \"equals\": \"<string>\"\n }\n },\n \"sorts\": [\n {}\n ],\n \"start_cursor\": \"<string>\",\n \"page_size\": 50,\n \"verbose\": true,\n \"include_deleted\": true\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/query")
.header("Notion-Version", "<notion-version>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"filter\": {\n \"property\": \"id\",\n \"id\": {\n \"equals\": \"<string>\"\n }\n },\n \"sorts\": [\n {}\n ],\n \"start_cursor\": \"<string>\",\n \"page_size\": 50,\n \"verbose\": true,\n \"include_deleted\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.notion.com/v1/agents/query")
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 \"query\": \"<string>\",\n \"filter\": {\n \"property\": \"id\",\n \"id\": {\n \"equals\": \"<string>\"\n }\n },\n \"sorts\": [\n {}\n ],\n \"start_cursor\": \"<string>\",\n \"page_size\": 50,\n \"verbose\": true,\n \"include_deleted\": true\n}"
response = http.request(request)
puts response.read_body{
"object": "list",
"type": "agent",
"results": [
{
"object": "agent",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"instructions_page_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"icon": {
"type": "emoji",
"emoji": "😀"
},
"model": {
"mode": "auto"
},
"connections": [
{
"type": "notion",
"name": "<string>",
"account": null,
"permissions": [
{
"target": {
"type": "page",
"id": "<string>"
},
"scopes": [
"<string>"
]
}
]
}
],
"created_by": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"agent_version": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"number": 123,
"published_at": "<string>"
},
"created_time": "2023-11-07T05:31:56Z",
"last_edited_time": "2023-11-07T05:31:56Z",
"last_run_at": "2023-11-07T05:31:56Z",
"credit_limit": 1,
"triggers": [
{
"type": "<string>",
"enabled": true,
"schedule": {
"frequency": "<string>",
"interval": 2,
"weekdays": [
"<string>"
],
"monthdays": [
2
],
"week_numbers": [
123
],
"hour": 1,
"minute": 1,
"timezone": "<string>",
"start_date": "<string>",
"end": {
"type": "date",
"end_at": "<string>"
}
},
"config": {}
}
],
"instructions": "<string>"
}
],
"has_more": true,
"next_cursor": "<string>"
}{
"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": {}
}Use filters, sorting, and cursor pagination to find accessible Custom Agents.
AccessA personal access token returns the agents its user can read. A connection returns only agents explicitly shared with it. No matching agents returns an empty
results array.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
Search agent names and descriptions using a case-insensitive substring match.
Filter agents by public properties, optionally combined with and/or.
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
- Option 10
- Option 11
- Option 12
Show child attributes
Show child attributes
Ordered sort precedence. Defaults to created_time descending.
Required array length:
1 - 2 elementsShow child attributes
Show child attributes
Opaque continuation cursor from the previous page.
Number of agents to return. Maximum: 100.
Required range:
1 <= x <= 100Whether to include inline instructions for each agent. Defaults to false.
Whether to include soft-deleted agents. Defaults to false.
⌘I