@notionhq/client 5.28.0 → 5.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +21 -0
  2. package/build/package.json +1 -1
  3. package/build/src/Client.d.ts +18 -181
  4. package/build/src/Client.d.ts.map +1 -1
  5. package/build/src/api-endpoint-methods.d.ts +6 -197
  6. package/build/src/api-endpoint-methods.d.ts.map +1 -1
  7. package/build/src/api-endpoints/agent-skills.d.ts +26 -0
  8. package/build/src/api-endpoints/agent-skills.d.ts.map +1 -1
  9. package/build/src/api-endpoints/agent-skills.js +12 -1
  10. package/build/src/api-endpoints/agent-skills.js.map +1 -1
  11. package/build/src/api-endpoints/agents.d.ts +2091 -2266
  12. package/build/src/api-endpoints/agents.d.ts.map +1 -1
  13. package/build/src/api-endpoints/agents.js +118 -118
  14. package/build/src/api-endpoints/agents.js.map +1 -1
  15. package/build/src/api-endpoints/async-tasks.d.ts +7 -4
  16. package/build/src/api-endpoints/async-tasks.d.ts.map +1 -1
  17. package/build/src/api-endpoints/async-tasks.js.map +1 -1
  18. package/build/src/api-endpoints/blocks.d.ts +7 -4
  19. package/build/src/api-endpoints/blocks.d.ts.map +1 -1
  20. package/build/src/api-endpoints/blocks.js +1 -1
  21. package/build/src/api-endpoints/blocks.js.map +1 -1
  22. package/build/src/api-endpoints/comments.d.ts +9 -3
  23. package/build/src/api-endpoints/comments.d.ts.map +1 -1
  24. package/build/src/api-endpoints/comments.js +2 -1
  25. package/build/src/api-endpoints/comments.js.map +1 -1
  26. package/build/src/api-endpoints/common.d.ts +168 -21
  27. package/build/src/api-endpoints/common.d.ts.map +1 -1
  28. package/build/src/api-endpoints/common.js.map +1 -1
  29. package/build/src/api-endpoints/data-sources.d.ts +4 -1
  30. package/build/src/api-endpoints/data-sources.d.ts.map +1 -1
  31. package/build/src/api-endpoints/data-sources.js +2 -1
  32. package/build/src/api-endpoints/data-sources.js.map +1 -1
  33. package/build/src/api-endpoints/databases.d.ts +5 -2
  34. package/build/src/api-endpoints/databases.d.ts.map +1 -1
  35. package/build/src/api-endpoints/databases.js +2 -0
  36. package/build/src/api-endpoints/databases.js.map +1 -1
  37. package/build/src/api-endpoints/file-uploads.d.ts.map +1 -1
  38. package/build/src/api-endpoints/file-uploads.js.map +1 -1
  39. package/build/src/api-endpoints/meeting-notes.d.ts +8 -106
  40. package/build/src/api-endpoints/meeting-notes.d.ts.map +1 -1
  41. package/build/src/api-endpoints/meeting-notes.js.map +1 -1
  42. package/build/src/api-endpoints/oauth.d.ts +1 -0
  43. package/build/src/api-endpoints/oauth.d.ts.map +1 -1
  44. package/build/src/api-endpoints/oauth.js.map +1 -1
  45. package/build/src/api-endpoints/pages.d.ts +10 -5
  46. package/build/src/api-endpoints/pages.d.ts.map +1 -1
  47. package/build/src/api-endpoints/pages.js +5 -1
  48. package/build/src/api-endpoints/pages.js.map +1 -1
  49. package/build/src/api-endpoints/search.d.ts +5 -2
  50. package/build/src/api-endpoints/search.d.ts.map +1 -1
  51. package/build/src/api-endpoints/search.js +1 -1
  52. package/build/src/api-endpoints/search.js.map +1 -1
  53. package/build/src/api-endpoints/views.d.ts +2 -1
  54. package/build/src/api-endpoints/views.d.ts.map +1 -1
  55. package/build/src/api-endpoints/views.js.map +1 -1
  56. package/build/src/api-endpoints/webhooks.d.ts +6 -0
  57. package/build/src/api-endpoints/webhooks.d.ts.map +1 -1
  58. package/build/src/api-endpoints/webhooks.js.map +1 -1
  59. package/build/src/helpers.d.ts.map +1 -1
  60. package/build/src/helpers.js +2 -1
  61. package/build/src/helpers.js.map +1 -1
  62. package/build/src/index.d.ts +1 -1
  63. package/build/src/index.d.ts.map +1 -1
  64. package/build/src/index.js.map +1 -1
  65. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"agents.js","sourceRoot":"","sources":["../../../src/api-endpoints/agents.ts"],"names":[],"mappings":";AAAA,sBAAsB;AACtB,+CAA+C;;;AA0U/C;;GAEG;AAC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V,gBAAgB;QAChB,SAAS;QACT,eAAe;KAChB;IAED,IAAI,EAAE,GAAW,EAAE,CAAC,UAAU;CACtB,CAAA","sourcesContent":["// cspell:disable-file\n// Note: This is a generated file. DO NOT EDIT!\n\nimport type {\n EmptyObject,\n IdRequest,\n IdResponse,\n PageIconResponse,\n} from \"./common\"\n\n/**\n * Parameters for opening a session stream.\n */\nexport type UpdateSessionStreamParameters =\n | {\n message: string\n agent_id?: string | \"notion_ai\" | \"33333333-3333-3333-3333-333333333333\"\n session_id?: string\n attachments?: Array<{\n file_upload: {\n id: string\n }\n /**\n * Always `file_upload`\n */\n type?: \"file_upload\"\n name?: string\n }>\n metadata?: Record<string, string>\n prompt_context?: string\n }\n | {\n session_id: string\n actions: Array<{\n action_id: string\n /**\n * One of: `approve`, `reject`\n */\n option_id: \"approve\" | \"reject\"\n }>\n metadata?: Record<string, string>\n }\n | {\n session_id: string\n continue_from: string\n }\n\n/**\n * An event emitted by a session stream.\n */\nexport type UpdateSessionStreamResponse =\n | {\n /**\n * Always `session.snapshot`\n */\n type: \"session.snapshot\"\n session: {\n /**\n * Always `session`\n */\n object: \"session\"\n id: string\n agent_id: string\n title: string\n /**\n * One of: `queued`, `in_progress`, `requires_action`, `completed`, `failed`, `canceled`, `terminated`\n */\n status:\n | \"queued\"\n | \"in_progress\"\n | \"requires_action\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"terminated\"\n created_at: string\n updated_at: string\n required_actions?: Array<{\n action_id: string\n title: string\n options: Array<{\n /**\n * One of: `approve`, `reject`\n */\n id: \"approve\" | \"reject\"\n label: string\n }>\n }>\n error?: {\n code: string\n message: string\n retryable: boolean\n }\n }\n }\n | {\n /**\n * Always `event.provisional`\n */\n type: \"event.provisional\"\n event:\n | {\n /**\n * Always `session_event`\n */\n object: \"session_event\"\n id: string\n session_id: string\n created_at: string\n /**\n * Always `agent.message`\n */\n type: \"agent.message\"\n content: Array<{\n /**\n * Always `text`\n */\n type: \"text\"\n text: string\n }>\n }\n | {\n /**\n * Always `session_event`\n */\n object: \"session_event\"\n id: string\n session_id: string\n created_at: string\n /**\n * Always `agent.tool_use`\n */\n type: \"agent.tool_use\"\n tool_name: string\n }\n }\n | {\n /**\n * Always `event.committed`\n */\n type: \"event.committed\"\n event:\n | {\n /**\n * Always `session_event`\n */\n object: \"session_event\"\n id: string\n session_id: string\n sequence: number\n created_at: string\n /**\n * Always `user.message`\n */\n type: \"user.message\"\n content: Array<\n | {\n /**\n * Always `text`\n */\n type: \"text\"\n text: string\n }\n | {\n /**\n * Always `file`\n */\n type: \"file\"\n file_id: string\n }\n >\n metadata?: Record<string, string>\n }\n | {\n /**\n * Always `session_event`\n */\n object: \"session_event\"\n id: string\n session_id: string\n sequence: number\n created_at: string\n /**\n * Always `agent.message`\n */\n type: \"agent.message\"\n content: Array<{\n /**\n * Always `text`\n */\n type: \"text\"\n text: string\n }>\n }\n | {\n /**\n * Always `session_event`\n */\n object: \"session_event\"\n id: string\n session_id: string\n sequence: number\n created_at: string\n /**\n * Always `agent.tool_use`\n */\n type: \"agent.tool_use\"\n tool_name: string\n }\n | {\n /**\n * Always `session_event`\n */\n object: \"session_event\"\n id: string\n session_id: string\n sequence: number\n created_at: string\n /**\n * Always `agent.tool_result`\n */\n type: \"agent.tool_result\"\n tool_use_id: string\n tool_name: string\n is_error: boolean\n }\n | {\n /**\n * Always `session_event`\n */\n object: \"session_event\"\n id: string\n session_id: string\n sequence: number\n created_at: string\n /**\n * Always `session.status`\n */\n type: \"session.status\"\n /**\n * One of: `queued`, `in_progress`, `requires_action`, `completed`, `failed`, `canceled`, `terminated`\n */\n status:\n | \"queued\"\n | \"in_progress\"\n | \"requires_action\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"terminated\"\n required_actions?: Array<{\n action_id: string\n title: string\n options: Array<{\n /**\n * One of: `approve`, `reject`\n */\n id: \"approve\" | \"reject\"\n label: string\n }>\n }>\n error?: {\n code: string\n message: string\n retryable: boolean\n }\n usage?: {\n total_tokens: number\n input_tokens?: number\n output_tokens?: number\n }\n artifacts?: Array<\n | {\n /**\n * Always `page`\n */\n type: \"page\"\n url: string\n title: string\n }\n | {\n /**\n * Always `html_artifact`\n */\n type: \"html_artifact\"\n url: string\n page_url: string\n }\n >\n }\n }\n | {\n /**\n * Always `stream.timeout`\n */\n type: \"stream.timeout\"\n session_id: string\n message: string\n }\n | {\n /**\n * Always `stream.end`\n */\n type: \"stream.end\"\n session_id: string\n /**\n * One of: `requires_action`, `completed`, `failed`, `canceled`, `terminated`\n */\n status:\n | \"requires_action\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"terminated\"\n }\n | {\n /**\n * Always `stream.error`\n */\n type: \"stream.error\"\n error: {\n code: string\n message: string\n /**\n * One of: `true`, `false`\n */\n retryable: true | false\n }\n session_id?: string\n }\n\n/**\n * Open a session stream.\n */\nexport const updateSessionStream = {\n method: \"post\",\n pathParams: [],\n queryParams: [],\n bodyParams: [\n \"message\",\n \"agent_id\",\n \"session_id\",\n \"attachments\",\n \"metadata\",\n \"prompt_context\",\n \"actions\",\n \"continue_from\",\n ],\n headers: { Accept: \"text/event-stream\" },\n path: (): string => `sessions`,\n} as const\n\ntype AgentBatchBodyParameters = {\n // The operations to apply, at least one and at most 100. Operations are applied in the\n // order given, and the batch is not atomic: each operation succeeds or fails on its own,\n // and per-operation outcomes are reported in the async task's result.\n operations: Array<\n | {\n // Enable or disable one agent, equivalent to `PATCH /v1/agents/:agent_id/status`.\n action: \"update_status\"\n // The agent ID (a UUID), or `notion_ai` for the personal agent. Endpoint-specific\n // restrictions still apply.\n agent_id:\n | IdRequest\n | \"notion_ai\"\n | \"33333333-3333-3333-3333-333333333333\"\n // The status to apply to this agent.\n fields: {\n // \"active\" to re-enable an agent disabled through this API, or \"disabled\" to turn it\n // off.\n status: \"active\" | \"disabled\"\n }\n }\n | {\n // Set or clear one agent's credit limit, equivalent to `PATCH\n // /v1/agents/:agent_id/credit_limit`. Requires full access to the agent.\n action: \"update_credit_limit\"\n // The agent ID (a UUID), or `notion_ai` for the personal agent. Endpoint-specific\n // restrictions still apply.\n agent_id:\n | IdRequest\n | \"notion_ai\"\n | \"33333333-3333-3333-3333-333333333333\"\n // The credit limit to apply to this agent.\n fields: {\n // The per-agent credit limit as a non-negative integer, or null to clear the limit.\n credit_limit: number | null\n }\n }\n | {\n // Soft-delete one agent, equivalent to `DELETE /v1/agents/:agent_id`.\n action: \"delete\"\n // The agent ID (a UUID), or `notion_ai` for the personal agent. Endpoint-specific\n // restrictions still apply.\n agent_id:\n | IdRequest\n | \"notion_ai\"\n | \"33333333-3333-3333-3333-333333333333\"\n }\n >\n}\n\nexport type AgentBatchParameters = AgentBatchBodyParameters\n\nexport type AgentBatchResponse = {\n object: \"async_task\"\n id: string\n status_url: string\n created_time: string\n operation: { surface: \"rest\" | \"mcp\"; name: string }\n status: \"queued\" | \"running\" | \"retrying\"\n poll_after_seconds: number\n}\n\n/**\n * Apply many agent operations\n */\nexport const agentBatch = {\n method: \"post\",\n pathParams: [],\n queryParams: [],\n bodyParams: [\"operations\"],\n\n path: (): string => `agents/batch`,\n} as const\n\ntype CancelSessionPathParameters = {\n // The ID of the session to cancel.\n session_id: IdRequest\n}\n\ntype CancelSessionBodyParameters = {\n // A session event identifying the turn to cancel. If omitted, cancels the current\n // nonterminal turn.\n event_id?: string\n}\n\nexport type CancelSessionParameters = CancelSessionPathParameters &\n CancelSessionBodyParameters\n\nexport type CancelSessionResponse = {\n // Always `session`\n object: \"session\"\n id: string\n agent_id: string\n title: string\n // One of: `queued`, `in_progress`, `requires_action`, `completed`, `failed`, `canceled`,\n // `terminated`\n status:\n | \"queued\"\n | \"in_progress\"\n | \"requires_action\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"terminated\"\n created_at: string\n updated_at: string\n required_actions?: Array<{\n action_id: string\n title: string\n options: Array<{\n // One of: `approve`, `reject`\n id: \"approve\" | \"reject\"\n label: string\n }>\n }>\n error?: { code: string; message: string; retryable: boolean }\n}\n\n/**\n * Cancel a session\n */\nexport const cancelSession = {\n method: \"post\",\n pathParams: [\"session_id\"],\n queryParams: [],\n bodyParams: [\"event_id\"],\n\n path: (p: CancelSessionPathParameters): string =>\n `sessions/${p.session_id}/cancel`,\n} as const\n\ntype ChatWithAgentPathParameters = {\n // The ID of the agent to chat with. Use a UUID for custom agents or `notion_ai` for\n // Notion Agent (personal agent); the reserved UUID\n // `33333333-3333-3333-3333-333333333333` remains supported for backward compatibility.\n agent_id: IdRequest | \"notion_ai\" | \"33333333-3333-3333-3333-333333333333\"\n}\n\ntype ChatWithAgentQueryParameters = {\n // Whether to include agent thinking and structured message content parts. Defaults to\n // false.\n verbose?: boolean\n}\n\ntype ChatWithAgentBodyParameters = {\n // The message to send to the agent.\n message?: string\n // An array of file uploads to attach to this chat turn. Use the File Upload APIs to\n // create uploads and pass their IDs here.\n attachments?: Array<{\n // ID of a FileUpload object that has the status `uploaded`.\n file_upload: {\n // ID of a FileUpload object that has the status `uploaded`.\n id: string\n }\n // The type of the attachment. Only supports \"file_upload\".\n type?: \"file_upload\"\n // An optional display name override for the attachment.\n name?: string\n }>\n // Optional caller-provided string metadata persisted with the user message. user_id is\n // used for lifecycle correlation and does not change authorization.\n metadata?: Record<string, string>\n // Additional caller-provided context for the agent to consider while responding.\n prompt_context?: string\n /** @deprecated */\n\n // Deprecated. Use POST /v1/threads/:thread_id/messages to continue an existing thread.\n // If not provided, a new thread will be created.\n thread_id?: IdRequest\n}\n\nexport type ChatWithAgentParameters = ChatWithAgentPathParameters &\n ChatWithAgentQueryParameters &\n ChatWithAgentBodyParameters\n\nexport type ChatWithAgentResponse = {\n // Always `chat.invocation`\n object: \"chat.invocation\"\n agent_id: string\n thread_id: string\n invocation_id: string\n // Always `pending`\n status: \"pending\"\n}\n\n/**\n * Chat with agent\n */\nexport const chatWithAgent = {\n method: \"post\",\n pathParams: [\"agent_id\"],\n queryParams: [\"verbose\"],\n bodyParams: [\n \"message\",\n \"attachments\",\n \"metadata\",\n \"prompt_context\",\n \"thread_id\",\n ],\n\n path: (p: ChatWithAgentPathParameters): string => `agents/${p.agent_id}/chat`,\n} as const\n\ntype ContinueThreadPathParameters = {\n // The ID of the thread.\n thread_id: IdRequest\n}\n\ntype ContinueThreadBodyParameters =\n | {\n action_id: IdRequest\n // One of: `approve`, `reject`\n option_id: \"approve\" | \"reject\"\n }\n | {\n action_id: IdRequest\n // Always `use_connection`\n option_id: \"use_connection\"\n input: { connection_id: IdRequest }\n }\n\nexport type ContinueThreadParameters = ContinueThreadPathParameters &\n ContinueThreadBodyParameters\n\nexport type ContinueThreadResponse = {\n // Always `chat.invocation`\n object: \"chat.invocation\"\n agent_id: string\n thread_id: string\n invocation_id: string\n // Always `pending`\n status: \"pending\"\n}\n\n/**\n * Continue a thread\n */\nexport const continueThread = {\n method: \"post\",\n pathParams: [\"thread_id\"],\n queryParams: [],\n bodyParams: [\"action_id\", \"option_id\", \"input\"],\n\n path: (p: ContinueThreadPathParameters): string =>\n `threads/${p.thread_id}/continue`,\n} as const\n\ntype CreateExternalAgentStubVaultPathParameters = {\n // The ID of the agent backing this external agent session.\n agent_id: IdRequest | \"33333333-3333-3333-3333-333333333333\"\n}\n\ntype CreateExternalAgentStubVaultBodyParameters = {\n // Provider-defined vault name.\n name: string\n // Write-only credential input.\n credential: {\n // Write-only bearer credential.\n value: string\n // Credential expiry as an RFC 3339 instant.\n expires_at: string\n }\n // Credential target.\n target: {\n // MCP server target.\n type: \"mcp_server\"\n // The exact target server URL.\n server_url: string\n // Target authorization metadata.\n authorization: {\n // Bearer authorization.\n type: \"bearer\"\n }\n }\n}\n\nexport type CreateExternalAgentStubVaultParameters =\n CreateExternalAgentStubVaultPathParameters &\n CreateExternalAgentStubVaultBodyParameters\n\nexport type CreateExternalAgentStubVaultResponse = {\n id: string\n name: string\n credential: { expires_at: string }\n target: {\n // Always `mcp_server`\n type: \"mcp_server\"\n server_url: string\n authorization: {\n // Always `bearer`\n type: \"bearer\"\n }\n }\n // One of: `active`, `expired`\n status: \"active\" | \"expired\"\n version: number\n created_at: string\n updated_at: string\n}\n\n/**\n * Create external agent stub vault\n */\nexport const createExternalAgentStubVault = {\n method: \"post\",\n pathParams: [\"agent_id\"],\n queryParams: [],\n bodyParams: [\"name\", \"credential\", \"target\"],\n\n path: (p: CreateExternalAgentStubVaultPathParameters): string =>\n `external_agent_stub/${p.agent_id}/vaults`,\n} as const\n\ntype DeleteAgentPathParameters = {\n // The agent ID (a UUID), or `notion_ai` for the personal agent. The personal agent\n // cannot be deleted.\n agent_id: IdRequest | \"notion_ai\" | \"33333333-3333-3333-3333-333333333333\"\n}\n\nexport type DeleteAgentParameters = DeleteAgentPathParameters\n\nexport type DeleteAgentResponse = {\n agent_id: IdResponse\n // Always \"deleted\": the agent has been soft-deleted (recoverable).\n status: \"deleted\"\n // ISO 8601 timestamp of when the agent was deleted.\n deleted_at: string\n}\n\n/**\n * Delete agent\n */\nexport const deleteAgent = {\n method: \"delete\",\n pathParams: [\"agent_id\"],\n queryParams: [],\n bodyParams: [],\n\n path: (p: DeleteAgentPathParameters): string => `agents/${p.agent_id}`,\n} as const\n\ntype GetAgentPathParameters = {\n // The agent ID (a UUID), or `notion_ai` for the personal agent. Endpoint-specific\n // restrictions still apply.\n agent_id: IdRequest | \"notion_ai\" | \"33333333-3333-3333-3333-333333333333\"\n}\n\ntype GetAgentQueryParameters = {\n // Whether to include the agent's inline instructions. Defaults to false.\n verbose?: boolean\n}\n\nexport type GetAgentParameters = GetAgentPathParameters &\n GetAgentQueryParameters\n\nexport type GetAgentResponse = {\n // Always `agent`\n object: \"agent\"\n id: IdResponse | \"notion_ai\"\n // What kind of agent this is: \"notion_ai\" is the personal agent; \"custom_agent\" is a\n // standalone agent you chat with; \"autofill_custom_agent\" fills a database property;\n // \"external\" runs through an external provider.\n agent_type:\n | \"notion_ai\"\n | \"custom_agent\"\n | \"autofill_custom_agent\"\n | \"external\"\n name: string\n description: string | null\n instructions_page_id: IdResponse | null\n icon:\n | PageIconResponse\n | {\n // Type of icon. In this case, a custom agent avatar.\n type: \"custom_agent_avatar\"\n // The static and animated URLs for the agent avatar.\n custom_agent_avatar: {\n // The URL of the static custom agent avatar.\n static_url: string\n // The URL of the animated custom agent avatar.\n animated_url: string\n }\n }\n | null\n // The model the agent runs on: auto (Notion selects) or a pinned model.\n model:\n | {\n // Always `auto`\n mode: \"auto\"\n }\n | {\n // Always `pinned`\n mode: \"pinned\"\n // The public model this agent maps to (e.g. \"claude-sonnet-5\"), or null for a\n // pre-release / early-access model.\n id: string | null\n }\n // Integrations the agent is connected to (Notion, Slack, Discord, MCP servers, and other\n // connectors), each with an account and per-target permissions.\n connections: Array<\n | {\n // Always `notion`\n type: \"notion\"\n name: string\n account: null\n permissions: Array<{\n target:\n | {\n // Always `page`\n type: \"page\"\n id: string\n }\n | {\n // Always `database_property`\n type: \"database_property\"\n data_source_id: string\n property_id: string\n }\n | {\n // Always `agent`\n type: \"agent\"\n id: string\n }\n | {\n // Always `workspace`\n type: \"workspace\"\n }\n | {\n // Always `owner_private_pages`\n type: \"owner_private_pages\"\n }\n | {\n // Always `web_search`\n type: \"web_search\"\n // Domains web search is restricted to, or null when unrestricted.\n allowed_domains: Array<string> | null\n }\n | {\n // Always `notion_help_docs_search`\n type: \"notion_help_docs_search\"\n }\n // Content roles (\"reader\" | \"comment_only\" | \"read_and_write\" | \"editor\") for scoped\n // targets, or search verbs (\"allow\" | \"disallow\") for the search targets.\n scopes: Array<string>\n }>\n }\n | {\n // Always `slack`\n type: \"slack\"\n name: string\n // The linked Slack workspace, null when none is linked, or \"hidden\" when the caller\n // lacks edit access to the agent.\n account:\n | {\n // Always `slack_workspace`\n type: \"slack_workspace\"\n team_id: string\n }\n | \"hidden\"\n | null\n permissions: Array<{\n target:\n | {\n // Always `slack_channel`\n type: \"slack_channel\"\n id: string\n }\n | {\n // Always `slack_all_public_channels`\n type: \"slack_all_public_channels\"\n }\n | {\n // Always `slack_all_channels`\n type: \"slack_all_channels\"\n }\n // Slack verbs granted on this target (\"read\" | \"write\" | \"reply_in_thread\" | \"react\").\n scopes: Array<string>\n }>\n }\n | {\n // Always `discord`\n type: \"discord\"\n name: string\n // The linked Discord server, null when none is linked, or \"hidden\" when the caller lacks\n // edit access to the agent.\n account:\n | {\n // Always `discord_server`\n type: \"discord_server\"\n id: string\n }\n | \"hidden\"\n | null\n permissions: Array<{\n target:\n | {\n // Always `discord_channel`\n type: \"discord_channel\"\n id: string\n }\n | {\n // Always `discord_all_channels`\n type: \"discord_all_channels\"\n }\n // Discord verbs granted on this target (\"read\" | \"write\" | \"reply_in_thread\" | \"react\").\n scopes: Array<string>\n }>\n }\n | {\n // Always `mcp_server`\n type: \"mcp_server\"\n name: string\n // The MCP server host, null when none is linked, or \"hidden\" when the caller lacks edit\n // access to the agent.\n account:\n | {\n // Always `mcp_server`\n type: \"mcp_server\"\n // The MCP server host (never the full URL, which can carry credentials or private path\n // components).\n server_host: string\n }\n | \"hidden\"\n | null\n // The tools the agent may call, null when all tools are enabled (including any the\n // server adds later), or \"hidden\" when the caller lacks edit access to the agent.\n enabled_tools:\n | Array<{ name: string; title: string | null }>\n | \"hidden\"\n | null\n // Whether read / write tool calls run without a confirmation step.\n run_tools_automatically: {\n // Whether read tool calls run without a confirmation step.\n read: boolean\n // Whether write tool calls run without a confirmation step.\n write: boolean\n }\n }\n | {\n // Always `custom_mcp_server`\n type: \"custom_mcp_server\"\n name: string\n // The MCP server host, null when none is linked, or \"hidden\" when the caller lacks edit\n // access to the agent.\n account:\n | {\n // Always `mcp_server`\n type: \"mcp_server\"\n // The MCP server host (never the full URL, which can carry credentials or private path\n // components).\n server_host: string\n }\n | \"hidden\"\n | null\n // The tools the agent may call, null when all tools are enabled (including any the\n // server adds later), or \"hidden\" when the caller lacks edit access to the agent.\n enabled_tools:\n | Array<{ name: string; title: string | null }>\n | \"hidden\"\n | null\n // Whether read / write tool calls run without a confirmation step.\n run_tools_automatically: {\n // Whether read tool calls run without a confirmation step.\n read: boolean\n // Whether write tool calls run without a confirmation step.\n write: boolean\n }\n }\n | {\n // The connector's machine name (e.g. \"github\", \"google_drive\").\n type:\n | \"asana\"\n | \"box\"\n | \"browser\"\n | \"calendar\"\n | \"computer\"\n | \"confluence\"\n | \"cursor\"\n | \"files\"\n | \"fs\"\n | \"github\"\n | \"gmail\"\n | \"google_calendar\"\n | \"google_drive\"\n | \"google_drive_oauth\"\n | \"gtm\"\n | \"helpdocs\"\n | \"images\"\n | \"jira\"\n | \"linear\"\n | \"mail\"\n | \"marketplace\"\n | \"memory\"\n | \"microsoft_teams\"\n | \"outlook\"\n | \"salesforce\"\n | \"search\"\n | \"security\"\n | \"sharepoint\"\n | \"skills\"\n | \"system\"\n | \"test\"\n | \"web\"\n | \"webhooks\"\n | \"worker\"\n | \"workers\"\n name: string\n // The provider-side account identifier, null when none is linked, or \"hidden\" when the\n // caller lacks edit access to the agent.\n account: string | null\n permissions: Array<{\n target: { type: string; id: string }\n // The scopes granted on this target.\n scopes: Array<string>\n }>\n }\n >\n // \"active\" when the agent can run; \"disabled\" when it is paused (see pause_reason);\n // \"deleted\" when it has been removed.\n status: \"active\" | \"disabled\" | \"deleted\"\n // Why the agent is paused when status is \"disabled\" (e.g. \"credit_limit\",\n // \"disabled_from_workspace_settings\"); null when active.\n pause_reason:\n | \"run_limit\"\n | \"credit_limit\"\n | \"runaway_credit_usage\"\n | \"workspace_credit_limit\"\n | \"failure_limit\"\n | \"mark_session_failed_autopause\"\n | \"disabled_from_workspace_settings\"\n | \"disabled_from_api\"\n | \"disabled_from_agent_settings\"\n | \"disabled_due_to_no_members_with_access\"\n | \"disabled_due_to_lack_of_editors\"\n | \"disabled_by_notion\"\n | \"internal_error\"\n | \"needs_user_review\"\n | \"tool_unavailable\"\n | null\n created_by: {\n // Always `user`\n object: \"user\"\n // Always `user`\n type: \"user\"\n // The ID of the user that created this agent.\n id: IdResponse\n } | null\n version: {\n // The ID of the published artifact.\n id: IdResponse\n // The version number.\n number: number\n // The ISO 8601 timestamp when this version was published.\n published_at: string\n } | null\n agent_version: {\n // The ID of the published artifact.\n id: IdResponse\n // The version number.\n number: number\n // The ISO 8601 timestamp when this version was published.\n published_at: string\n } | null\n // Whether the draft has edits not yet in the published version, or \"hidden\" when the\n // caller lacks edit access to the agent.\n has_unpublished_changes: boolean | \"hidden\"\n // ISO 8601 timestamp of the agent's most recent run, null if it has never run, or\n // \"hidden\" when the caller lacks edit access to the agent.\n last_run_time: string | \"hidden\" | null\n // ISO 8601 timestamp of the agent's most recent run, null if it has never run, or\n // \"hidden\" when the caller lacks edit access to the agent.\n last_run_at: string | \"hidden\" | null\n // The per-agent credit limit that applies to this agent, null when uncapped, or \"hidden\"\n // when the caller lacks full access to the agent. This is the effective limit computed\n // at runtime, folding in both the agent's own limit and any workspace-admin default.\n credit_limit: number | \"hidden\" | null\n // The agent's configured triggers, each with a machine type, an enabled flag, and (for\n // recurrence triggers) a structured schedule.\n triggers: Array<{\n // Machine trigger type (e.g. \"notion.agent.mentioned\", \"recurrence\",\n // \"slack.reaction.added\").\n type: string\n // Whether this trigger is currently enabled.\n enabled: boolean\n // Structured recurrence cadence. Present only for recurrence triggers.\n schedule?: {\n // Base cadence unit (\"hour\" | \"day\" | \"week\" | \"month\" | \"year\").\n frequency: string\n // Multiplier on the frequency (e.g. every 2 weeks).\n interval: number\n // Days of the week the schedule runs (e.g. \"monday\"). Present for weekly cadences and\n // monthly weekday restrictions.\n weekdays?: Array<string>\n // Days of the month the schedule runs. Present for monthly monthday restrictions.\n monthdays?: Array<number>\n // Week-of-month ordinals for a monthly weekday restriction (e.g. [2, 3] for the 2nd and\n // 3rd occurrence); -1 means the last week.\n week_numbers?: Array<number>\n // Hour of day (0–23) the schedule runs.\n hour?: number\n // Minute of the hour (0–59) the schedule runs.\n minute?: number\n // IANA timezone (e.g. \"America/New_York\").\n timezone?: string\n // ISO 8601 timestamp the schedule starts from.\n start_date?: string\n // When the schedule stops, when it is bounded.\n end?:\n | {\n // Always `date`\n type: \"date\"\n // ISO 8601 timestamp when the schedule stops.\n end_at: string\n }\n | {\n // Always `count`\n type: \"count\"\n // Number of occurrences after which the schedule stops.\n occurrences: number\n }\n }\n // Remaining per-type trigger configuration (e.g. watched channel ids, reaction config),\n // keys in snake_case. Present only when the trigger carries such state.\n config?: Record<string, Record<string, never>>\n }>\n // Date and time when this agent was created.\n created_time?: string\n // Date and time when this agent was last edited.\n last_edited_time?: string\n // The agent's inline instructions when verbose=true, or null when its instructions are\n // stored on a page.\n instructions?: string | null\n}\n\n/**\n * Get agent\n */\nexport const getAgent = {\n method: \"get\",\n pathParams: [\"agent_id\"],\n queryParams: [\"verbose\"],\n bodyParams: [],\n\n path: (p: GetAgentPathParameters): string => `agents/${p.agent_id}`,\n} as const\n\ntype DeleteExternalAgentStubVaultPathParameters = {\n // The ID of the agent backing this external agent session.\n agent_id: IdRequest | \"33333333-3333-3333-3333-333333333333\"\n // The provider-owned vault ID.\n vault_id: string\n}\n\nexport type DeleteExternalAgentStubVaultParameters =\n DeleteExternalAgentStubVaultPathParameters\n\nexport type DeleteExternalAgentStubVaultResponse = EmptyObject\n\n/**\n * Delete external agent stub vault\n */\nexport const deleteExternalAgentStubVault = {\n method: \"delete\",\n pathParams: [\"agent_id\", \"vault_id\"],\n queryParams: [],\n bodyParams: [],\n\n path: (p: DeleteExternalAgentStubVaultPathParameters): string =>\n `external_agent_stub/${p.agent_id}/vaults/${p.vault_id}`,\n} as const\n\ntype UpdateExternalAgentStubVaultPathParameters = {\n // The ID of the agent backing this external agent session.\n agent_id: IdRequest | \"33333333-3333-3333-3333-333333333333\"\n // The provider-owned vault ID.\n vault_id: string\n}\n\ntype UpdateExternalAgentStubVaultBodyParameters = {\n // The last observed vault version.\n expected_version: number\n // Replacement write-only credential.\n credential: {\n // Write-only bearer credential.\n value: string\n // Credential expiry as an RFC 3339 instant.\n expires_at: string\n }\n}\n\nexport type UpdateExternalAgentStubVaultParameters =\n UpdateExternalAgentStubVaultPathParameters &\n UpdateExternalAgentStubVaultBodyParameters\n\nexport type UpdateExternalAgentStubVaultResponse = {\n id: string\n name: string\n credential: { expires_at: string }\n target: {\n // Always `mcp_server`\n type: \"mcp_server\"\n server_url: string\n authorization: {\n // Always `bearer`\n type: \"bearer\"\n }\n }\n // One of: `active`, `expired`\n status: \"active\" | \"expired\"\n version: number\n created_at: string\n updated_at: string\n}\n\n/**\n * Update external agent stub vault\n */\nexport const updateExternalAgentStubVault = {\n method: \"patch\",\n pathParams: [\"agent_id\", \"vault_id\"],\n queryParams: [],\n bodyParams: [\"expected_version\", \"credential\"],\n\n path: (p: UpdateExternalAgentStubVaultPathParameters): string =>\n `external_agent_stub/${p.agent_id}/vaults/${p.vault_id}`,\n} as const\n\ntype GetInsightsPathParameters = {\n // The agent ID (a UUID), or `notion_ai` for the personal agent. Endpoint-specific\n // restrictions still apply.\n agent_id: IdRequest | \"notion_ai\" | \"33333333-3333-3333-3333-333333333333\"\n}\n\ntype GetInsightsQueryParameters = {\n // Start of the insights window, as an epoch timestamp in seconds. Must be supplied\n // together with `end_time`; if either is omitted the window defaults to the current\n // billing period.\n start_time?: number\n // End of the insights window, as an epoch timestamp in seconds. Must be supplied\n // together with `start_time`; if either is omitted the window defaults to the current\n // billing period.\n end_time?: number\n}\n\nexport type GetInsightsParameters = GetInsightsPathParameters &\n GetInsightsQueryParameters\n\nexport type GetInsightsResponse = {\n // Always `agent_insights`\n object: \"agent_insights\"\n id: IdResponse | \"notion_ai\"\n name: string\n // One of: `notion_ai`, `custom_agent`, `autofill_custom_agent`\n agent_type: \"notion_ai\" | \"custom_agent\" | \"autofill_custom_agent\"\n // One of: `active`, `disabled`, `deleted`\n status: \"active\" | \"disabled\" | \"deleted\"\n pause_reason:\n | \"run_limit\"\n | \"credit_limit\"\n | \"runaway_credit_usage\"\n | \"workspace_credit_limit\"\n | \"failure_limit\"\n | \"mark_session_failed_autopause\"\n | \"disabled_from_workspace_settings\"\n | \"disabled_from_api\"\n | \"disabled_from_agent_settings\"\n | \"disabled_due_to_no_members_with_access\"\n | \"disabled_due_to_lack_of_editors\"\n | \"disabled_by_notion\"\n | \"internal_error\"\n | \"needs_user_review\"\n | \"tool_unavailable\"\n | null\n created_by: {\n id: string\n // One of: `user`, `bot`\n type: \"user\" | \"bot\"\n } | null\n // Premium AI credits consumed by this agent within the window.\n total_credits_used: number\n // Enforced per-agent credit limit; null when none is configured, and \"hidden\" when the\n // caller lacks full access to the agent.\n credit_limit: number | \"hidden\" | null\n // Number of runs recorded for this agent within the window.\n runs_completed: number\n}\n\n/**\n * Get agent insights\n */\nexport const getInsights = {\n method: \"get\",\n pathParams: [\"agent_id\"],\n queryParams: [\"start_time\", \"end_time\"],\n bodyParams: [],\n\n path: (p: GetInsightsPathParameters): string =>\n `agents/${p.agent_id}/insights`,\n} as const\n\ntype ListAgentsQueryParameters = {\n // Filter agents by name (case-insensitive substring match).\n name?: string\n // Filter agents by one or more agent types.\n agent_type?: Array<\n \"notion_ai\" | \"custom_agent\" | \"autofill_custom_agent\" | \"external\"\n >\n // Filter agents by one or more agent IDs. Use `notion_ai` for Notion Agent (personal\n // agent).\n agent_ids?: Array<\n IdRequest | \"notion_ai\" | \"33333333-3333-3333-3333-333333333333\"\n >\n // Filter agents by one or more creator IDs. Use \"me\" for the user associated with the\n // API token.\n created_by?: Array<IdRequest | \"me\">\n // If supplied, this endpoint will return a page of results starting after the cursor\n // provided. If not supplied, this endpoint will return the first page of results.\n start_cursor?: string | null\n // The number of items from the full list desired in the response. Maximum: 100\n page_size?: number\n // Whether to include inline instructions for each agent. Defaults to false.\n verbose?: boolean\n}\n\nexport type ListAgentsParameters = ListAgentsQueryParameters\n\nexport type ListAgentsResponse = {\n // Always `list`\n object: \"list\"\n // Always `agent`\n type: \"agent\"\n results: Array<{\n // Always `agent`\n object: \"agent\"\n id: IdResponse | \"notion_ai\"\n // Agent kind: the Notion AI personal agent, a custom agent, a database autofill custom\n // agent, or an external agent.\n agent_type:\n | \"notion_ai\"\n | \"custom_agent\"\n | \"autofill_custom_agent\"\n | \"external\"\n name: string\n description: string | null\n instructions_page_id: IdResponse | null\n icon:\n | PageIconResponse\n | {\n // Type of icon. In this case, a custom agent avatar.\n type: \"custom_agent_avatar\"\n // The static and animated URLs for the agent avatar.\n custom_agent_avatar: {\n // The URL of the static custom agent avatar.\n static_url: string\n // The URL of the animated custom agent avatar.\n animated_url: string\n }\n }\n | null\n version: {\n // The ID of the published artifact.\n id: IdResponse\n // The version number.\n number: number\n // The ISO 8601 timestamp when this version was published.\n published_at: string\n } | null\n agent_version: {\n // The ID of the published artifact.\n id: IdResponse\n // The version number.\n number: number\n // The ISO 8601 timestamp when this version was published.\n published_at: string\n } | null\n // The model the agent runs on: auto (Notion selects) or a pinned model.\n model:\n | {\n // Always `auto`\n mode: \"auto\"\n }\n | {\n // Always `pinned`\n mode: \"pinned\"\n // The public model this agent maps to (e.g. \"claude-sonnet-5\"), or null for a\n // pre-release / early-access model.\n id: string | null\n }\n // Non-Notion integrations the agent is connected to, using the same account and\n // permission shape as get agent.\n connections: Array<\n | {\n // Always `notion`\n type: \"notion\"\n name: string\n account: null\n permissions: Array<{\n target:\n | {\n // Always `page`\n type: \"page\"\n id: string\n }\n | {\n // Always `database_property`\n type: \"database_property\"\n data_source_id: string\n property_id: string\n }\n | {\n // Always `agent`\n type: \"agent\"\n id: string\n }\n | {\n // Always `workspace`\n type: \"workspace\"\n }\n | {\n // Always `owner_private_pages`\n type: \"owner_private_pages\"\n }\n | {\n // Always `web_search`\n type: \"web_search\"\n // Domains web search is restricted to, or null when unrestricted.\n allowed_domains: Array<string> | null\n }\n | {\n // Always `notion_help_docs_search`\n type: \"notion_help_docs_search\"\n }\n // Content roles (\"reader\" | \"comment_only\" | \"read_and_write\" | \"editor\") for scoped\n // targets, or search verbs (\"allow\" | \"disallow\") for the search targets.\n scopes: Array<string>\n }>\n }\n | {\n // Always `slack`\n type: \"slack\"\n name: string\n // The linked Slack workspace, null when none is linked, or \"hidden\" when the caller\n // lacks edit access to the agent.\n account:\n | {\n // Always `slack_workspace`\n type: \"slack_workspace\"\n team_id: string\n }\n | \"hidden\"\n | null\n permissions: Array<{\n target:\n | {\n // Always `slack_channel`\n type: \"slack_channel\"\n id: string\n }\n | {\n // Always `slack_all_public_channels`\n type: \"slack_all_public_channels\"\n }\n | {\n // Always `slack_all_channels`\n type: \"slack_all_channels\"\n }\n // Slack verbs granted on this target (\"read\" | \"write\" | \"reply_in_thread\" | \"react\").\n scopes: Array<string>\n }>\n }\n | {\n // Always `discord`\n type: \"discord\"\n name: string\n // The linked Discord server, null when none is linked, or \"hidden\" when the caller lacks\n // edit access to the agent.\n account:\n | {\n // Always `discord_server`\n type: \"discord_server\"\n id: string\n }\n | \"hidden\"\n | null\n permissions: Array<{\n target:\n | {\n // Always `discord_channel`\n type: \"discord_channel\"\n id: string\n }\n | {\n // Always `discord_all_channels`\n type: \"discord_all_channels\"\n }\n // Discord verbs granted on this target (\"read\" | \"write\" | \"reply_in_thread\" | \"react\").\n scopes: Array<string>\n }>\n }\n | {\n // Always `mcp_server`\n type: \"mcp_server\"\n name: string\n // The MCP server host, null when none is linked, or \"hidden\" when the caller lacks edit\n // access to the agent.\n account:\n | {\n // Always `mcp_server`\n type: \"mcp_server\"\n // The MCP server host (never the full URL, which can carry credentials or private path\n // components).\n server_host: string\n }\n | \"hidden\"\n | null\n // The tools the agent may call, null when all tools are enabled (including any the\n // server adds later), or \"hidden\" when the caller lacks edit access to the agent.\n enabled_tools:\n | Array<{ name: string; title: string | null }>\n | \"hidden\"\n | null\n // Whether read / write tool calls run without a confirmation step.\n run_tools_automatically: {\n // Whether read tool calls run without a confirmation step.\n read: boolean\n // Whether write tool calls run without a confirmation step.\n write: boolean\n }\n }\n | {\n // Always `custom_mcp_server`\n type: \"custom_mcp_server\"\n name: string\n // The MCP server host, null when none is linked, or \"hidden\" when the caller lacks edit\n // access to the agent.\n account:\n | {\n // Always `mcp_server`\n type: \"mcp_server\"\n // The MCP server host (never the full URL, which can carry credentials or private path\n // components).\n server_host: string\n }\n | \"hidden\"\n | null\n // The tools the agent may call, null when all tools are enabled (including any the\n // server adds later), or \"hidden\" when the caller lacks edit access to the agent.\n enabled_tools:\n | Array<{ name: string; title: string | null }>\n | \"hidden\"\n | null\n // Whether read / write tool calls run without a confirmation step.\n run_tools_automatically: {\n // Whether read tool calls run without a confirmation step.\n read: boolean\n // Whether write tool calls run without a confirmation step.\n write: boolean\n }\n }\n | {\n // The connector's machine name (e.g. \"github\", \"google_drive\").\n type:\n | \"asana\"\n | \"box\"\n | \"browser\"\n | \"calendar\"\n | \"computer\"\n | \"confluence\"\n | \"cursor\"\n | \"files\"\n | \"fs\"\n | \"github\"\n | \"gmail\"\n | \"google_calendar\"\n | \"google_drive\"\n | \"google_drive_oauth\"\n | \"gtm\"\n | \"helpdocs\"\n | \"images\"\n | \"jira\"\n | \"linear\"\n | \"mail\"\n | \"marketplace\"\n | \"memory\"\n | \"microsoft_teams\"\n | \"outlook\"\n | \"salesforce\"\n | \"search\"\n | \"security\"\n | \"sharepoint\"\n | \"skills\"\n | \"system\"\n | \"test\"\n | \"web\"\n | \"webhooks\"\n | \"worker\"\n | \"workers\"\n name: string\n // The provider-side account identifier, null when none is linked, or \"hidden\" when the\n // caller lacks edit access to the agent.\n account: string | null\n permissions: Array<{\n target: { type: string; id: string }\n // The scopes granted on this target.\n scopes: Array<string>\n }>\n }\n >\n // Agent status. Disabled agents remain listed; deleted agents are currently excluded\n // from list responses.\n status: \"active\" | \"disabled\" | \"deleted\"\n created_by: {\n // Always `user`\n object: \"user\"\n // Always `user`\n type: \"user\"\n // The ID of the user that created this agent.\n id: IdResponse\n } | null\n // Date and time when this agent was created, or null for the personal agent.\n created_time: string | null\n // Date and time when this agent was last edited, or null for the personal agent.\n last_edited_time: string | null\n // Date and time when this agent was last invoked, null when no invocation is available,\n // or \"hidden\" when the caller lacks edit access to the agent.\n last_run_time: string | \"hidden\" | null\n // Date and time when this agent was last invoked, null when no invocation is available,\n // or \"hidden\" when the caller lacks edit access to the agent.\n last_run_at: string | \"hidden\" | null\n // The agent's inline instructions when verbose=true, or null when its instructions are\n // stored on a page.\n instructions?: string | null\n }>\n has_more: boolean\n next_cursor: string | null\n}\n\n/**\n * List agents\n */\nexport const listAgents = {\n method: \"get\",\n pathParams: [],\n queryParams: [\n \"name\",\n \"agent_type\",\n \"agent_ids\",\n \"created_by\",\n \"start_cursor\",\n \"page_size\",\n \"verbose\",\n ],\n bodyParams: [],\n\n path: (): string => `agents`,\n} as const\n\ntype ListExternalAgentStubSessionEventsPathParameters = {\n // The ID of the agent backing this external agent session.\n agent_id: IdRequest | \"33333333-3333-3333-3333-333333333333\"\n // The provider-owned session ID returned when the session was created.\n session_id: IdRequest\n}\n\ntype ListExternalAgentStubSessionEventsQueryParameters = {\n // Opaque cursor returned by a previous call. Only events strictly after this cursor are\n // returned.\n cursor?: string\n}\n\nexport type ListExternalAgentStubSessionEventsParameters =\n ListExternalAgentStubSessionEventsPathParameters &\n ListExternalAgentStubSessionEventsQueryParameters\n\nexport type ListExternalAgentStubSessionEventsResponse = {\n events: Array<\n | {\n // Always `assistant.thinking`\n type: \"assistant.thinking\"\n text: string\n }\n | {\n // Always `assistant.message`\n type: \"assistant.message\"\n text: string\n }\n | {\n // Always `tool.started`\n type: \"tool.started\"\n tool_call_id: string\n tool_name?: string\n input?: Record<string, never>\n }\n | {\n // Always `tool.output`\n type: \"tool.output\"\n tool_call_id: string\n output?: Record<string, never>\n is_error?: boolean\n }\n | {\n // Always `error`\n type: \"error\"\n error: {\n code: string\n message: string\n retryable: boolean\n additional_data?: Record<string, string | Array<string>>\n }\n }\n >\n is_running: boolean\n next_cursor?: string\n}\n\n/**\n * List external agent stub session events\n */\nexport const listExternalAgentStubSessionEvents = {\n method: \"get\",\n pathParams: [\"agent_id\", \"session_id\"],\n queryParams: [\"cursor\"],\n bodyParams: [],\n\n path: (p: ListExternalAgentStubSessionEventsPathParameters): string =>\n `external_agent_stub/${p.agent_id}/sessions/${p.session_id}/events`,\n} as const\n\ntype ListThreadMessagesPathParameters = {\n // The ID of the thread.\n thread_id: IdRequest\n}\n\ntype ListThreadMessagesQueryParameters = {\n // Whether to include agent thinking and structured message content parts. Defaults to\n // false.\n verbose?: boolean\n // Filter messages by role (user or agent).\n role?: \"user\" | \"agent\"\n // If supplied, this endpoint will return a page of results starting after the cursor\n // provided. If not supplied, this endpoint will return the first page of results.\n start_cursor?: string | null\n // The number of items from the full list desired in the response. Maximum: 100\n page_size?: number\n}\n\nexport type ListThreadMessagesParameters = ListThreadMessagesPathParameters &\n ListThreadMessagesQueryParameters\n\nexport type ListThreadMessagesResponse = {\n // Always `list`\n object: \"list\"\n // Always `thread_message`\n type: \"thread_message\"\n results: Array<{\n // Always `thread_message`\n object: \"thread_message\"\n id: IdResponse\n // One of: `user`, `agent`\n role: \"user\" | \"agent\"\n content: string\n // Date and time when this message was created.\n created_time: string\n parent: {\n // The parent type.\n type: \"thread\"\n // The ID of the parent thread.\n id: IdResponse\n }\n attachments?: Array<{\n name: string\n content_type: string\n url: string\n // The time when the attachment URL will expire.\n expiry_time?: string\n }>\n content_parts?: Array<\n | {\n // Always `text`\n type: \"text\"\n text: string\n }\n | {\n // Always `thinking`\n type: \"thinking\"\n text: string\n }\n | {\n // Always `tool_call`\n type: \"tool_call\"\n tool_call_id: string | null\n tool_name: string\n results?: Array<{\n id: IdResponse\n agent_step_id: IdResponse | null\n tool_call_id: string | null\n tool_name: string\n tool_type: string\n state: string\n started_at: number\n finished_at: number | null\n duration_ms: number | null\n }>\n }\n | {\n // Always `follow_ups`\n type: \"follow_ups\"\n follow_ups: Array<{ label: string; message: string }>\n }\n | {\n // Always `custom_agent_template_picker`\n type: \"custom_agent_template_picker\"\n }\n >\n pending_user_actions?: Array<{\n id: IdResponse\n // Always `tool_confirmation`\n type: \"tool_confirmation\"\n title: string\n requirements: Array<\n | {\n // Always `general`\n type: \"general\"\n }\n | {\n // Always `manage_workers`\n type: \"manage_workers\"\n }\n | {\n // Always `url_safety`\n type: \"url_safety\"\n urls: Array<string>\n required_by_workspace_policy?: boolean\n }\n | {\n // Always `permission_escalation`\n type: \"permission_escalation\"\n destination_title?: string\n source_titles?: Array<string>\n }\n | {\n // Always `delete_content`\n type: \"delete_content\"\n page_count: number\n database_count: number\n meeting_notes_block_count?: number\n }\n | {\n // Always `connect_integration`\n type: \"connect_integration\"\n integration_type: string\n integration_name: string\n handoff_url: string\n }\n | {\n // Always `admin_mode`\n type: \"admin_mode\"\n explanation?: string\n }\n >\n options: Array<\n | {\n // Always `approve`\n id: \"approve\"\n label: string\n }\n | {\n // Always `reject`\n id: \"reject\"\n label: string\n }\n | {\n // Always `use_connection`\n id: \"use_connection\"\n label: string\n input: {\n // Always `connection_id`\n type: \"connection_id\"\n // Always `true`\n required: true\n }\n }\n >\n }>\n }>\n has_more: boolean\n next_cursor: string | null\n}\n\n/**\n * List thread messages\n */\nexport const listThreadMessages = {\n method: \"get\",\n pathParams: [\"thread_id\"],\n queryParams: [\"verbose\", \"role\", \"start_cursor\", \"page_size\"],\n bodyParams: [],\n\n path: (p: ListThreadMessagesPathParameters): string =>\n `threads/${p.thread_id}/messages`,\n} as const\n\ntype SendThreadMessagePathParameters = {\n // The ID of the thread.\n thread_id: IdRequest\n}\n\ntype SendThreadMessageBodyParameters = {\n // The message to send to the agent.\n message?: string\n // An array of file uploads to attach to this chat turn. Use the File Upload APIs to\n // create uploads and pass their IDs here.\n attachments?: Array<{\n // ID of a FileUpload object that has the status `uploaded`.\n file_upload: {\n // ID of a FileUpload object that has the status `uploaded`.\n id: string\n }\n // The type of the attachment. Only supports \"file_upload\".\n type?: \"file_upload\"\n // An optional display name override for the attachment.\n name?: string\n }>\n // Optional caller-provided string metadata persisted with the user message. user_id is\n // used for lifecycle correlation and does not change authorization.\n metadata?: Record<string, string>\n // Additional caller-provided context for the agent to consider while responding.\n prompt_context?: string\n}\n\nexport type SendThreadMessageParameters = SendThreadMessagePathParameters &\n SendThreadMessageBodyParameters\n\nexport type SendThreadMessageResponse = {\n // Always `chat.invocation`\n object: \"chat.invocation\"\n agent_id: string\n thread_id: string\n invocation_id: string\n // Always `pending`\n status: \"pending\"\n}\n\n/**\n * Send a thread message\n */\nexport const sendThreadMessage = {\n method: \"post\",\n pathParams: [\"thread_id\"],\n queryParams: [],\n bodyParams: [\"message\", \"attachments\", \"metadata\", \"prompt_context\"],\n\n path: (p: SendThreadMessagePathParameters): string =>\n `threads/${p.thread_id}/messages`,\n} as const\n\ntype ListThreadsPathParameters = {\n // The ID of the agent. Use a UUID for custom agents or `notion_ai` for Notion Agent\n // (personal agent); the reserved UUID `33333333-3333-3333-3333-333333333333` remains\n // supported for backward compatibility.\n agent_id: IdRequest | \"notion_ai\" | \"33333333-3333-3333-3333-333333333333\"\n}\n\ntype ListThreadsQueryParameters = {\n // Filter threads by ID (exact match).\n id?: IdRequest\n // Filter threads by title (case-insensitive substring match).\n title?: string\n // Filter threads by status.\n status?: \"pending\" | \"requires_action\" | \"completed\" | \"failed\" | \"canceled\"\n // Filter threads by agent activity state. Defaults to `all`.\n activity?: \"all\" | \"pending\" | \"in_progress\" | \"failed\" | \"success\"\n // Filter threads by one or more creator IDs. Use \"me\" for the API bot and user\n // associated with the API token.\n created_by?: Array<IdRequest | \"me\">\n // Filter threads by one or more IDs of actors who last used them. Use \"me\" for the API\n // bot and user associated with the API token.\n last_used_by?: Array<IdRequest | \"me\">\n // Timestamp used to sort threads. Defaults to `created_time`.\n sort_by?: \"created_time\" | \"last_used_time\"\n // Sort direction. Defaults to `descending`.\n sort_direction?: \"ascending\" | \"descending\"\n // If supplied, this endpoint will return a page of results starting after the cursor\n // provided. If not supplied, this endpoint will return the first page of results.\n start_cursor?: string | null\n // The number of items from the full list desired in the response. Maximum: 100\n page_size?: number\n}\n\nexport type ListThreadsParameters = ListThreadsPathParameters &\n ListThreadsQueryParameters\n\nexport type ListThreadsResponse = {\n // Always `list`\n object: \"list\"\n // Always `thread`\n type: \"thread\"\n results: Array<{\n // Always `thread`\n object: \"thread\"\n id: IdResponse\n title: string\n // One of: `pending`, `requires_action`, `completed`, `canceled`, `failed`\n status: \"pending\" | \"requires_action\" | \"completed\" | \"canceled\" | \"failed\"\n // Date and time when this thread was created.\n created_time: string\n // Date and time when this thread was last updated.\n last_edited_time: string\n created_by: {\n // The ID of the actor that created this thread: a bot for an integration-created thread,\n // a user for one created in the Notion app.\n id: IdResponse\n // The creator type. Threads a caller can see because it has access to the agent, such as\n // a trigger's runs or a teammate's chats, may be created by either a bot or a user.\n type: \"bot\" | \"user\"\n }\n agent_version: {\n // The ID of the published artifact.\n id: IdResponse\n // The version number.\n number: number\n // The ISO 8601 timestamp when this version was published.\n published_at: string\n } | null\n models:\n | {\n // Always `auto`\n type: \"auto\"\n }\n | {\n // Always `pinned`\n type: \"pinned\"\n // The public model this thread is pinned to (e.g. \"claude-sonnet-5\"), with null for a\n // pre-release / early-access model. Empty when the thread has no model recorded yet.\n // Reflects the thread's configuration at creation, so a model changed mid-conversation\n // is not reflected here.\n ids: Array<string | null>\n }\n error?: string\n // How this thread started: the type of the trigger that ran it, or \"chat\".\n trigger_type?: string\n // Labels describing how the thread ran (triggered, chat, setup). Null when the caller\n // lacks edit access to the agent.\n type_labels?: Array<string> | null\n // Emails of the users who participated in this thread. Null when the caller lacks edit\n // access to the agent.\n chat_user_emails?: Array<string> | null\n // Types of tool this thread called. Null when the caller lacks edit access to the agent.\n tool_types?: Array<string> | null\n // Number of tool calls in this thread. Null when the caller lacks edit access to the\n // agent.\n tool_call_count?: number | null\n // Premium AI credits this thread consumed. Null when the caller lacks edit access to the\n // agent.\n credits_used?: number | null\n // Runs completed in this thread. Null when the caller lacks edit access to the agent, or\n // when the thread predates run tracking.\n runs_completed?: number | null\n pending_user_actions?: Array<{\n id: IdResponse\n // Always `tool_confirmation`\n type: \"tool_confirmation\"\n title: string\n requirements: Array<\n | {\n // Always `general`\n type: \"general\"\n }\n | {\n // Always `manage_workers`\n type: \"manage_workers\"\n }\n | {\n // Always `url_safety`\n type: \"url_safety\"\n urls: Array<string>\n required_by_workspace_policy?: boolean\n }\n | {\n // Always `permission_escalation`\n type: \"permission_escalation\"\n destination_title?: string\n source_titles?: Array<string>\n }\n | {\n // Always `delete_content`\n type: \"delete_content\"\n page_count: number\n database_count: number\n meeting_notes_block_count?: number\n }\n | {\n // Always `connect_integration`\n type: \"connect_integration\"\n integration_type: string\n integration_name: string\n handoff_url: string\n }\n | {\n // Always `admin_mode`\n type: \"admin_mode\"\n explanation?: string\n }\n >\n options: Array<\n | {\n // Always `approve`\n id: \"approve\"\n label: string\n }\n | {\n // Always `reject`\n id: \"reject\"\n label: string\n }\n | {\n // Always `use_connection`\n id: \"use_connection\"\n label: string\n input: {\n // Always `connection_id`\n type: \"connection_id\"\n // Always `true`\n required: true\n }\n }\n >\n }>\n }>\n has_more: boolean\n next_cursor: string | null\n}\n\n/**\n * List threads\n */\nexport const listThreads = {\n method: \"get\",\n pathParams: [\"agent_id\"],\n queryParams: [\n \"id\",\n \"title\",\n \"status\",\n \"activity\",\n \"created_by\",\n \"last_used_by\",\n \"sort_by\",\n \"sort_direction\",\n \"start_cursor\",\n \"page_size\",\n ],\n bodyParams: [],\n\n path: (p: ListThreadsPathParameters): string =>\n `agents/${p.agent_id}/threads`,\n} as const\n\ntype QueryAgentsBodyParameters = {\n // Search agent names and descriptions using a case-insensitive substring match.\n query?: string\n // Filter agents by public properties, optionally combined with and/or.\n filter?:\n | { property: \"id\"; id: { equals: string } }\n | {\n property: \"agent_type\"\n string: {\n equals: \"notion_ai\" | \"custom_agent\" | \"autofill_custom_agent\"\n }\n }\n | { property: \"created_by\"; people: { contains: string } }\n | { property: \"created_time\"; date: { after?: string; before?: string } }\n | { property: \"favorited\"; checkbox: { equals: boolean } }\n | { property: \"connections\"; mcp_server: { contains: string } }\n | {\n property: \"status\"\n status: { in: Array<\"active\" | \"disabled\" | \"deleted\"> }\n }\n | { property: \"model_mode\"; select: { equals: \"auto\" | \"pinned\" } }\n | { property: \"agent_version\"; number: { equals: number } }\n | { property: \"last_run_at\"; date: { after?: string; before?: string } }\n | {\n and: Array<\n | { property: \"id\"; id: { equals: string } }\n | {\n property: \"agent_type\"\n string: {\n equals: \"notion_ai\" | \"custom_agent\" | \"autofill_custom_agent\"\n }\n }\n | { property: \"created_by\"; people: { contains: string } }\n | {\n property: \"created_time\"\n date: { after?: string; before?: string }\n }\n | { property: \"favorited\"; checkbox: { equals: boolean } }\n | { property: \"connections\"; mcp_server: { contains: string } }\n | {\n property: \"status\"\n status: { in: Array<\"active\" | \"disabled\" | \"deleted\"> }\n }\n | { property: \"model_mode\"; select: { equals: \"auto\" | \"pinned\" } }\n | { property: \"agent_version\"; number: { equals: number } }\n | {\n property: \"last_run_at\"\n date: { after?: string; before?: string }\n }\n | {\n and: Array<\n | { property: \"id\"; id: { equals: string } }\n | {\n property: \"agent_type\"\n string: {\n equals:\n | \"notion_ai\"\n | \"custom_agent\"\n | \"autofill_custom_agent\"\n }\n }\n | { property: \"created_by\"; people: { contains: string } }\n | {\n property: \"created_time\"\n date: { after?: string; before?: string }\n }\n | { property: \"favorited\"; checkbox: { equals: boolean } }\n | { property: \"connections\"; mcp_server: { contains: string } }\n | {\n property: \"status\"\n status: { in: Array<\"active\" | \"disabled\" | \"deleted\"> }\n }\n | {\n property: \"model_mode\"\n select: { equals: \"auto\" | \"pinned\" }\n }\n | { property: \"agent_version\"; number: { equals: number } }\n | {\n property: \"last_run_at\"\n date: { after?: string; before?: string }\n }\n >\n }\n | {\n or: Array<\n | { property: \"id\"; id: { equals: string } }\n | {\n property: \"agent_type\"\n string: {\n equals:\n | \"notion_ai\"\n | \"custom_agent\"\n | \"autofill_custom_agent\"\n }\n }\n | { property: \"created_by\"; people: { contains: string } }\n | {\n property: \"created_time\"\n date: { after?: string; before?: string }\n }\n | { property: \"favorited\"; checkbox: { equals: boolean } }\n | { property: \"connections\"; mcp_server: { contains: string } }\n | {\n property: \"status\"\n status: { in: Array<\"active\" | \"disabled\" | \"deleted\"> }\n }\n | {\n property: \"model_mode\"\n select: { equals: \"auto\" | \"pinned\" }\n }\n | { property: \"agent_version\"; number: { equals: number } }\n | {\n property: \"last_run_at\"\n date: { after?: string; before?: string }\n }\n >\n }\n >\n }\n | {\n or: Array<\n | { property: \"id\"; id: { equals: string } }\n | {\n property: \"agent_type\"\n string: {\n equals: \"notion_ai\" | \"custom_agent\" | \"autofill_custom_agent\"\n }\n }\n | { property: \"created_by\"; people: { contains: string } }\n | {\n property: \"created_time\"\n date: { after?: string; before?: string }\n }\n | { property: \"favorited\"; checkbox: { equals: boolean } }\n | { property: \"connections\"; mcp_server: { contains: string } }\n | {\n property: \"status\"\n status: { in: Array<\"active\" | \"disabled\" | \"deleted\"> }\n }\n | { property: \"model_mode\"; select: { equals: \"auto\" | \"pinned\" } }\n | { property: \"agent_version\"; number: { equals: number } }\n | {\n property: \"last_run_at\"\n date: { after?: string; before?: string }\n }\n | {\n and: Array<\n | { property: \"id\"; id: { equals: string } }\n | {\n property: \"agent_type\"\n string: {\n equals:\n | \"notion_ai\"\n | \"custom_agent\"\n | \"autofill_custom_agent\"\n }\n }\n | { property: \"created_by\"; people: { contains: string } }\n | {\n property: \"created_time\"\n date: { after?: string; before?: string }\n }\n | { property: \"favorited\"; checkbox: { equals: boolean } }\n | { property: \"connections\"; mcp_server: { contains: string } }\n | {\n property: \"status\"\n status: { in: Array<\"active\" | \"disabled\" | \"deleted\"> }\n }\n | {\n property: \"model_mode\"\n select: { equals: \"auto\" | \"pinned\" }\n }\n | { property: \"agent_version\"; number: { equals: number } }\n | {\n property: \"last_run_at\"\n date: { after?: string; before?: string }\n }\n >\n }\n | {\n or: Array<\n | { property: \"id\"; id: { equals: string } }\n | {\n property: \"agent_type\"\n string: {\n equals:\n | \"notion_ai\"\n | \"custom_agent\"\n | \"autofill_custom_agent\"\n }\n }\n | { property: \"created_by\"; people: { contains: string } }\n | {\n property: \"created_time\"\n date: { after?: string; before?: string }\n }\n | { property: \"favorited\"; checkbox: { equals: boolean } }\n | { property: \"connections\"; mcp_server: { contains: string } }\n | {\n property: \"status\"\n status: { in: Array<\"active\" | \"disabled\" | \"deleted\"> }\n }\n | {\n property: \"model_mode\"\n select: { equals: \"auto\" | \"pinned\" }\n }\n | { property: \"agent_version\"; number: { equals: number } }\n | {\n property: \"last_run_at\"\n date: { after?: string; before?: string }\n }\n >\n }\n >\n }\n // Ordered sort precedence. Defaults to created_time descending.\n sorts?: Array<{\n // Timestamp used to sort agents.\n property: \"created_time\" | \"last_run_at\"\n // Sort direction.\n direction: \"ascending\" | \"descending\"\n }>\n // Opaque continuation cursor from the previous page.\n start_cursor?: string | null\n // Number of agents to return. Maximum: 100.\n page_size?: number\n // Whether to include inline instructions for each agent. Defaults to false.\n verbose?: boolean\n // Whether to include soft-deleted agents. Defaults to false.\n include_deleted?: boolean\n}\n\nexport type QueryAgentsParameters = QueryAgentsBodyParameters\n\nexport type QueryAgentsResponse = {\n // Always `list`\n object: \"list\"\n // Always `agent`\n type: \"agent\"\n results: Array<\n | {\n // Always `agent`\n object: \"agent\"\n id: IdResponse\n // What kind of agent this is: \"custom_agent\" is a standalone agent you chat with;\n // \"autofill_custom_agent\" fills a database property.\n agent_type: \"custom_agent\" | \"autofill_custom_agent\"\n name: string\n description: string | null\n instructions_page_id: IdResponse | null\n icon:\n | PageIconResponse\n | {\n // Type of icon. In this case, a custom agent avatar.\n type: \"custom_agent_avatar\"\n // The static and animated URLs for the agent avatar.\n custom_agent_avatar: {\n // The URL of the static custom agent avatar.\n static_url: string\n // The URL of the animated custom agent avatar.\n animated_url: string\n }\n }\n | null\n // The model selection: automatic, or pinned to a public model ID.\n model:\n | {\n // Always `auto`\n mode: \"auto\"\n }\n | {\n // Always `pinned`\n mode: \"pinned\"\n // The public model this agent maps to (e.g. \"claude-sonnet-5\"), or null for a\n // pre-release / early-access model.\n id: string | null\n }\n // Integrations the agent is connected to (Notion, Slack, Discord, MCP servers, and other\n // connectors), each with an account and per-target permissions.\n connections: Array<\n | {\n // Always `notion`\n type: \"notion\"\n name: string\n account: null\n permissions: Array<{\n target:\n | {\n // Always `page`\n type: \"page\"\n id: string\n }\n | {\n // Always `database_property`\n type: \"database_property\"\n data_source_id: string\n property_id: string\n }\n | {\n // Always `agent`\n type: \"agent\"\n id: string\n }\n | {\n // Always `workspace`\n type: \"workspace\"\n }\n | {\n // Always `owner_private_pages`\n type: \"owner_private_pages\"\n }\n | {\n // Always `web_search`\n type: \"web_search\"\n // Domains web search is restricted to, or null when unrestricted.\n allowed_domains: Array<string> | null\n }\n | {\n // Always `notion_help_docs_search`\n type: \"notion_help_docs_search\"\n }\n // Content roles (\"reader\" | \"comment_only\" | \"read_and_write\" | \"editor\") for scoped\n // targets, or search verbs (\"allow\" | \"disallow\") for the search targets.\n scopes: Array<string>\n }>\n }\n | {\n // Always `slack`\n type: \"slack\"\n name: string\n // The linked Slack workspace, null when none is linked, or \"hidden\" when the caller\n // lacks edit access to the agent.\n account:\n | {\n // Always `slack_workspace`\n type: \"slack_workspace\"\n team_id: string\n }\n | \"hidden\"\n | null\n permissions: Array<{\n target:\n | {\n // Always `slack_channel`\n type: \"slack_channel\"\n id: string\n }\n | {\n // Always `slack_all_public_channels`\n type: \"slack_all_public_channels\"\n }\n | {\n // Always `slack_all_channels`\n type: \"slack_all_channels\"\n }\n // Slack verbs granted on this target (\"read\" | \"write\" | \"reply_in_thread\" | \"react\").\n scopes: Array<string>\n }>\n }\n | {\n // Always `discord`\n type: \"discord\"\n name: string\n // The linked Discord server, null when none is linked, or \"hidden\" when the caller lacks\n // edit access to the agent.\n account:\n | {\n // Always `discord_server`\n type: \"discord_server\"\n id: string\n }\n | \"hidden\"\n | null\n permissions: Array<{\n target:\n | {\n // Always `discord_channel`\n type: \"discord_channel\"\n id: string\n }\n | {\n // Always `discord_all_channels`\n type: \"discord_all_channels\"\n }\n // Discord verbs granted on this target (\"read\" | \"write\" | \"reply_in_thread\" | \"react\").\n scopes: Array<string>\n }>\n }\n | {\n // Always `mcp_server`\n type: \"mcp_server\"\n name: string\n // The MCP server host, null when none is linked, or \"hidden\" when the caller lacks edit\n // access to the agent.\n account:\n | {\n // Always `mcp_server`\n type: \"mcp_server\"\n // The MCP server host (never the full URL, which can carry credentials or private path\n // components).\n server_host: string\n }\n | \"hidden\"\n | null\n // The tools the agent may call, null when all tools are enabled (including any the\n // server adds later), or \"hidden\" when the caller lacks edit access to the agent.\n enabled_tools:\n | Array<{ name: string; title: string | null }>\n | \"hidden\"\n | null\n // Whether read / write tool calls run without a confirmation step.\n run_tools_automatically: {\n // Whether read tool calls run without a confirmation step.\n read: boolean\n // Whether write tool calls run without a confirmation step.\n write: boolean\n }\n }\n | {\n // Always `custom_mcp_server`\n type: \"custom_mcp_server\"\n name: string\n // The MCP server host, null when none is linked, or \"hidden\" when the caller lacks edit\n // access to the agent.\n account:\n | {\n // Always `mcp_server`\n type: \"mcp_server\"\n // The MCP server host (never the full URL, which can carry credentials or private path\n // components).\n server_host: string\n }\n | \"hidden\"\n | null\n // The tools the agent may call, null when all tools are enabled (including any the\n // server adds later), or \"hidden\" when the caller lacks edit access to the agent.\n enabled_tools:\n | Array<{ name: string; title: string | null }>\n | \"hidden\"\n | null\n // Whether read / write tool calls run without a confirmation step.\n run_tools_automatically: {\n // Whether read tool calls run without a confirmation step.\n read: boolean\n // Whether write tool calls run without a confirmation step.\n write: boolean\n }\n }\n | {\n // The connector's machine name (e.g. \"github\", \"google_drive\").\n type:\n | \"asana\"\n | \"box\"\n | \"browser\"\n | \"calendar\"\n | \"computer\"\n | \"confluence\"\n | \"cursor\"\n | \"files\"\n | \"fs\"\n | \"github\"\n | \"gmail\"\n | \"google_calendar\"\n | \"google_drive\"\n | \"google_drive_oauth\"\n | \"gtm\"\n | \"helpdocs\"\n | \"images\"\n | \"jira\"\n | \"linear\"\n | \"mail\"\n | \"marketplace\"\n | \"memory\"\n | \"microsoft_teams\"\n | \"outlook\"\n | \"salesforce\"\n | \"search\"\n | \"security\"\n | \"sharepoint\"\n | \"skills\"\n | \"system\"\n | \"test\"\n | \"web\"\n | \"webhooks\"\n | \"worker\"\n | \"workers\"\n name: string\n // The provider-side account identifier, null when none is linked, or \"hidden\" when the\n // caller lacks edit access to the agent.\n account: string | null\n permissions: Array<{\n target: { type: string; id: string }\n // The scopes granted on this target.\n scopes: Array<string>\n }>\n }\n >\n // \"active\" when the agent can run; \"disabled\" when it is paused (see pause_reason);\n // \"deleted\" when it has been removed.\n status: \"active\" | \"disabled\" | \"deleted\"\n // Why the agent is paused when status is \"disabled\" (e.g. \"credit_limit\",\n // \"disabled_from_workspace_settings\"); null when active.\n pause_reason:\n | \"run_limit\"\n | \"credit_limit\"\n | \"runaway_credit_usage\"\n | \"workspace_credit_limit\"\n | \"failure_limit\"\n | \"mark_session_failed_autopause\"\n | \"disabled_from_workspace_settings\"\n | \"disabled_from_api\"\n | \"disabled_from_agent_settings\"\n | \"disabled_due_to_no_members_with_access\"\n | \"disabled_due_to_lack_of_editors\"\n | \"disabled_by_notion\"\n | \"internal_error\"\n | \"needs_user_review\"\n | \"tool_unavailable\"\n | null\n created_by: {\n // One of: `user`, `bot`\n type: \"user\" | \"bot\"\n // The ID of the user or bot that created this agent.\n id: IdResponse\n } | null\n agent_version: {\n // The ID of the published artifact.\n id: IdResponse\n // The version number.\n number: number\n // The ISO 8601 timestamp when this version was published.\n published_at: string\n } | null\n // Date and time when this agent was created.\n created_time: string\n // Date and time when this agent was last edited.\n last_edited_time: string\n // ISO 8601 timestamp of the agent's most recent run, null if it has never run, or\n // \"hidden\" when the caller lacks edit access to the agent.\n last_run_at: string | \"hidden\" | null\n // The per-agent credit limit that applies to this agent, null when uncapped, or \"hidden\"\n // when the caller lacks full access to the agent. This is the effective limit computed\n // at runtime, folding in both the agent's own limit and any workspace-admin default.\n credit_limit: number | \"hidden\" | null\n // The agent's configured triggers, each with a machine type, an enabled flag, and a\n // structured recurrence schedule when applicable.\n triggers: Array<{\n // Machine trigger type (e.g. \"notion.agent.mentioned\", \"recurrence\",\n // \"slack.reaction.added\").\n type: string\n // Whether this trigger is currently enabled.\n enabled: boolean\n // Structured recurrence cadence. Present only for recurrence triggers.\n schedule?: {\n // Base cadence unit (\"hour\" | \"day\" | \"week\" | \"month\" | \"year\").\n frequency: string\n // Multiplier on the frequency (e.g. every 2 weeks).\n interval: number\n // Days of the week the schedule runs (e.g. \"monday\"). Present for weekly cadences and\n // monthly weekday restrictions.\n weekdays?: Array<string>\n // Days of the month the schedule runs. Present for monthly monthday restrictions.\n monthdays?: Array<number>\n // Week-of-month ordinals for a monthly weekday restriction (e.g. [2, 3] for the 2nd and\n // 3rd occurrence); -1 means the last week.\n week_numbers?: Array<number>\n // Hour of day (0–23) the schedule runs.\n hour?: number\n // Minute of the hour (0–59) the schedule runs.\n minute?: number\n // IANA timezone (e.g. \"America/New_York\").\n timezone?: string\n // ISO 8601 timestamp the schedule starts from.\n start_date?: string\n // When the schedule stops, when it is bounded.\n end?:\n | {\n // Always `date`\n type: \"date\"\n // ISO 8601 timestamp when the schedule stops.\n end_at: string\n }\n | {\n // Always `count`\n type: \"count\"\n // Number of occurrences after which the schedule stops.\n occurrences: number\n }\n }\n // Remaining per-type trigger configuration (e.g. watched channel ids, reaction config),\n // keys in snake_case. Present only when the trigger carries such state.\n config?: Record<string, Record<string, never>>\n }>\n // The agent's inline instructions when verbose=true, or null when its instructions are\n // stored on a page.\n instructions?: string | null\n }\n | {\n // Always `agent`\n object: \"agent\"\n // Always `notion_ai`\n id: \"notion_ai\"\n // Always `notion_ai`\n agent_type: \"notion_ai\"\n name: string\n description: null\n instructions_page_id: null\n icon:\n | PageIconResponse\n | {\n // Type of icon. In this case, a custom agent avatar.\n type: \"custom_agent_avatar\"\n // The static and animated URLs for the agent avatar.\n custom_agent_avatar: {\n // The URL of the static custom agent avatar.\n static_url: string\n // The URL of the animated custom agent avatar.\n animated_url: string\n }\n }\n model:\n | {\n // Always `auto`\n mode: \"auto\"\n }\n | {\n // Always `pinned`\n mode: \"pinned\"\n // The public model this agent maps to (e.g. \"claude-sonnet-5\"), or null for a\n // pre-release / early-access model.\n id: string | null\n }\n connections: Array<\n | {\n // Always `notion`\n type: \"notion\"\n name: string\n account: null\n permissions: Array<{\n target:\n | {\n // Always `page`\n type: \"page\"\n id: string\n }\n | {\n // Always `database_property`\n type: \"database_property\"\n data_source_id: string\n property_id: string\n }\n | {\n // Always `agent`\n type: \"agent\"\n id: string\n }\n | {\n // Always `workspace`\n type: \"workspace\"\n }\n | {\n // Always `owner_private_pages`\n type: \"owner_private_pages\"\n }\n | {\n // Always `web_search`\n type: \"web_search\"\n // Domains web search is restricted to, or null when unrestricted.\n allowed_domains: Array<string> | null\n }\n | {\n // Always `notion_help_docs_search`\n type: \"notion_help_docs_search\"\n }\n // Content roles (\"reader\" | \"comment_only\" | \"read_and_write\" | \"editor\") for scoped\n // targets, or search verbs (\"allow\" | \"disallow\") for the search targets.\n scopes: Array<string>\n }>\n }\n | {\n // Always `slack`\n type: \"slack\"\n name: string\n // The linked Slack workspace, null when none is linked, or \"hidden\" when the caller\n // lacks edit access to the agent.\n account:\n | {\n // Always `slack_workspace`\n type: \"slack_workspace\"\n team_id: string\n }\n | \"hidden\"\n | null\n permissions: Array<{\n target:\n | {\n // Always `slack_channel`\n type: \"slack_channel\"\n id: string\n }\n | {\n // Always `slack_all_public_channels`\n type: \"slack_all_public_channels\"\n }\n | {\n // Always `slack_all_channels`\n type: \"slack_all_channels\"\n }\n // Slack verbs granted on this target (\"read\" | \"write\" | \"reply_in_thread\" | \"react\").\n scopes: Array<string>\n }>\n }\n | {\n // Always `discord`\n type: \"discord\"\n name: string\n // The linked Discord server, null when none is linked, or \"hidden\" when the caller lacks\n // edit access to the agent.\n account:\n | {\n // Always `discord_server`\n type: \"discord_server\"\n id: string\n }\n | \"hidden\"\n | null\n permissions: Array<{\n target:\n | {\n // Always `discord_channel`\n type: \"discord_channel\"\n id: string\n }\n | {\n // Always `discord_all_channels`\n type: \"discord_all_channels\"\n }\n // Discord verbs granted on this target (\"read\" | \"write\" | \"reply_in_thread\" | \"react\").\n scopes: Array<string>\n }>\n }\n | {\n // Always `mcp_server`\n type: \"mcp_server\"\n name: string\n // The MCP server host, null when none is linked, or \"hidden\" when the caller lacks edit\n // access to the agent.\n account:\n | {\n // Always `mcp_server`\n type: \"mcp_server\"\n // The MCP server host (never the full URL, which can carry credentials or private path\n // components).\n server_host: string\n }\n | \"hidden\"\n | null\n // The tools the agent may call, null when all tools are enabled (including any the\n // server adds later), or \"hidden\" when the caller lacks edit access to the agent.\n enabled_tools:\n | Array<{ name: string; title: string | null }>\n | \"hidden\"\n | null\n // Whether read / write tool calls run without a confirmation step.\n run_tools_automatically: {\n // Whether read tool calls run without a confirmation step.\n read: boolean\n // Whether write tool calls run without a confirmation step.\n write: boolean\n }\n }\n | {\n // Always `custom_mcp_server`\n type: \"custom_mcp_server\"\n name: string\n // The MCP server host, null when none is linked, or \"hidden\" when the caller lacks edit\n // access to the agent.\n account:\n | {\n // Always `mcp_server`\n type: \"mcp_server\"\n // The MCP server host (never the full URL, which can carry credentials or private path\n // components).\n server_host: string\n }\n | \"hidden\"\n | null\n // The tools the agent may call, null when all tools are enabled (including any the\n // server adds later), or \"hidden\" when the caller lacks edit access to the agent.\n enabled_tools:\n | Array<{ name: string; title: string | null }>\n | \"hidden\"\n | null\n // Whether read / write tool calls run without a confirmation step.\n run_tools_automatically: {\n // Whether read tool calls run without a confirmation step.\n read: boolean\n // Whether write tool calls run without a confirmation step.\n write: boolean\n }\n }\n | {\n // The connector's machine name (e.g. \"github\", \"google_drive\").\n type:\n | \"asana\"\n | \"box\"\n | \"browser\"\n | \"calendar\"\n | \"computer\"\n | \"confluence\"\n | \"cursor\"\n | \"files\"\n | \"fs\"\n | \"github\"\n | \"gmail\"\n | \"google_calendar\"\n | \"google_drive\"\n | \"google_drive_oauth\"\n | \"gtm\"\n | \"helpdocs\"\n | \"images\"\n | \"jira\"\n | \"linear\"\n | \"mail\"\n | \"marketplace\"\n | \"memory\"\n | \"microsoft_teams\"\n | \"outlook\"\n | \"salesforce\"\n | \"search\"\n | \"security\"\n | \"sharepoint\"\n | \"skills\"\n | \"system\"\n | \"test\"\n | \"web\"\n | \"webhooks\"\n | \"worker\"\n | \"workers\"\n name: string\n // The provider-side account identifier, null when none is linked, or \"hidden\" when the\n // caller lacks edit access to the agent.\n account: string | null\n permissions: Array<{\n target: { type: string; id: string }\n // The scopes granted on this target.\n scopes: Array<string>\n }>\n }\n >\n // Always `active`\n status: \"active\"\n pause_reason: null\n created_by: null\n agent_version: null\n created_time: null\n last_edited_time: null\n last_run_at: null\n credit_limit: null\n triggers: Array<{\n // Machine trigger type (e.g. \"notion.agent.mentioned\", \"recurrence\",\n // \"slack.reaction.added\").\n type: string\n // Whether this trigger is currently enabled.\n enabled: boolean\n // Structured recurrence cadence. Present only for recurrence triggers.\n schedule?: {\n // Base cadence unit (\"hour\" | \"day\" | \"week\" | \"month\" | \"year\").\n frequency: string\n // Multiplier on the frequency (e.g. every 2 weeks).\n interval: number\n // Days of the week the schedule runs (e.g. \"monday\"). Present for weekly cadences and\n // monthly weekday restrictions.\n weekdays?: Array<string>\n // Days of the month the schedule runs. Present for monthly monthday restrictions.\n monthdays?: Array<number>\n // Week-of-month ordinals for a monthly weekday restriction (e.g. [2, 3] for the 2nd and\n // 3rd occurrence); -1 means the last week.\n week_numbers?: Array<number>\n // Hour of day (0–23) the schedule runs.\n hour?: number\n // Minute of the hour (0–59) the schedule runs.\n minute?: number\n // IANA timezone (e.g. \"America/New_York\").\n timezone?: string\n // ISO 8601 timestamp the schedule starts from.\n start_date?: string\n // When the schedule stops, when it is bounded.\n end?:\n | {\n // Always `date`\n type: \"date\"\n // ISO 8601 timestamp when the schedule stops.\n end_at: string\n }\n | {\n // Always `count`\n type: \"count\"\n // Number of occurrences after which the schedule stops.\n occurrences: number\n }\n }\n // Remaining per-type trigger configuration (e.g. watched channel ids, reaction config),\n // keys in snake_case. Present only when the trigger carries such state.\n config?: Record<string, Record<string, never>>\n }>\n }\n >\n has_more: boolean\n next_cursor: string | null\n}\n\n/**\n * Query agents\n */\nexport const queryAgents = {\n method: \"post\",\n pathParams: [],\n queryParams: [],\n bodyParams: [\n \"query\",\n \"filter\",\n \"sorts\",\n \"start_cursor\",\n \"page_size\",\n \"verbose\",\n \"include_deleted\",\n ],\n\n path: (): string => `agents/query`,\n} as const\n\ntype QuerySessionEventsPathParameters = {\n // The ID of the session whose events should be queried.\n session_id: IdRequest\n}\n\ntype QuerySessionEventsBodyParameters = {\n // A session event property filter, or an and/or compound filter nested up to three\n // levels deep.\n filter?:\n | { property: \"id\"; string: { equals: string } }\n | {\n property: \"type\"\n event_type: {\n equals?:\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n in?: Array<\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n >\n }\n }\n | {\n property: \"sequence\"\n number: {\n greater_than?: number\n greater_than_or_equal_to?: number\n less_than?: number\n less_than_or_equal_to?: number\n }\n }\n | {\n property: \"created_at\"\n timestamp: {\n equals?: string\n before?: string\n after?: string\n on_or_before?: string\n on_or_after?: string\n }\n }\n | {\n and: Array<\n | { property: \"id\"; string: { equals: string } }\n | {\n property: \"type\"\n event_type: {\n equals?:\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n in?: Array<\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n >\n }\n }\n | {\n property: \"sequence\"\n number: {\n greater_than?: number\n greater_than_or_equal_to?: number\n less_than?: number\n less_than_or_equal_to?: number\n }\n }\n | {\n property: \"created_at\"\n timestamp: {\n equals?: string\n before?: string\n after?: string\n on_or_before?: string\n on_or_after?: string\n }\n }\n | {\n and: Array<\n | { property: \"id\"; string: { equals: string } }\n | {\n property: \"type\"\n event_type: {\n equals?:\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n in?: Array<\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n >\n }\n }\n | {\n property: \"sequence\"\n number: {\n greater_than?: number\n greater_than_or_equal_to?: number\n less_than?: number\n less_than_or_equal_to?: number\n }\n }\n | {\n property: \"created_at\"\n timestamp: {\n equals?: string\n before?: string\n after?: string\n on_or_before?: string\n on_or_after?: string\n }\n }\n | {\n and: Array<\n | { property: \"id\"; string: { equals: string } }\n | {\n property: \"type\"\n event_type: {\n equals?:\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n in?: Array<\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n >\n }\n }\n | {\n property: \"sequence\"\n number: {\n greater_than?: number\n greater_than_or_equal_to?: number\n less_than?: number\n less_than_or_equal_to?: number\n }\n }\n | {\n property: \"created_at\"\n timestamp: {\n equals?: string\n before?: string\n after?: string\n on_or_before?: string\n on_or_after?: string\n }\n }\n >\n }\n | {\n or: Array<\n | { property: \"id\"; string: { equals: string } }\n | {\n property: \"type\"\n event_type: {\n equals?:\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n in?: Array<\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n >\n }\n }\n | {\n property: \"sequence\"\n number: {\n greater_than?: number\n greater_than_or_equal_to?: number\n less_than?: number\n less_than_or_equal_to?: number\n }\n }\n | {\n property: \"created_at\"\n timestamp: {\n equals?: string\n before?: string\n after?: string\n on_or_before?: string\n on_or_after?: string\n }\n }\n >\n }\n >\n }\n | {\n or: Array<\n | { property: \"id\"; string: { equals: string } }\n | {\n property: \"type\"\n event_type: {\n equals?:\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n in?: Array<\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n >\n }\n }\n | {\n property: \"sequence\"\n number: {\n greater_than?: number\n greater_than_or_equal_to?: number\n less_than?: number\n less_than_or_equal_to?: number\n }\n }\n | {\n property: \"created_at\"\n timestamp: {\n equals?: string\n before?: string\n after?: string\n on_or_before?: string\n on_or_after?: string\n }\n }\n | {\n and: Array<\n | { property: \"id\"; string: { equals: string } }\n | {\n property: \"type\"\n event_type: {\n equals?:\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n in?: Array<\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n >\n }\n }\n | {\n property: \"sequence\"\n number: {\n greater_than?: number\n greater_than_or_equal_to?: number\n less_than?: number\n less_than_or_equal_to?: number\n }\n }\n | {\n property: \"created_at\"\n timestamp: {\n equals?: string\n before?: string\n after?: string\n on_or_before?: string\n on_or_after?: string\n }\n }\n >\n }\n | {\n or: Array<\n | { property: \"id\"; string: { equals: string } }\n | {\n property: \"type\"\n event_type: {\n equals?:\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n in?: Array<\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n >\n }\n }\n | {\n property: \"sequence\"\n number: {\n greater_than?: number\n greater_than_or_equal_to?: number\n less_than?: number\n less_than_or_equal_to?: number\n }\n }\n | {\n property: \"created_at\"\n timestamp: {\n equals?: string\n before?: string\n after?: string\n on_or_before?: string\n on_or_after?: string\n }\n }\n >\n }\n >\n }\n >\n }\n | {\n or: Array<\n | { property: \"id\"; string: { equals: string } }\n | {\n property: \"type\"\n event_type: {\n equals?:\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n in?: Array<\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n >\n }\n }\n | {\n property: \"sequence\"\n number: {\n greater_than?: number\n greater_than_or_equal_to?: number\n less_than?: number\n less_than_or_equal_to?: number\n }\n }\n | {\n property: \"created_at\"\n timestamp: {\n equals?: string\n before?: string\n after?: string\n on_or_before?: string\n on_or_after?: string\n }\n }\n | {\n and: Array<\n | { property: \"id\"; string: { equals: string } }\n | {\n property: \"type\"\n event_type: {\n equals?:\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n in?: Array<\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n >\n }\n }\n | {\n property: \"sequence\"\n number: {\n greater_than?: number\n greater_than_or_equal_to?: number\n less_than?: number\n less_than_or_equal_to?: number\n }\n }\n | {\n property: \"created_at\"\n timestamp: {\n equals?: string\n before?: string\n after?: string\n on_or_before?: string\n on_or_after?: string\n }\n }\n | {\n and: Array<\n | { property: \"id\"; string: { equals: string } }\n | {\n property: \"type\"\n event_type: {\n equals?:\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n in?: Array<\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n >\n }\n }\n | {\n property: \"sequence\"\n number: {\n greater_than?: number\n greater_than_or_equal_to?: number\n less_than?: number\n less_than_or_equal_to?: number\n }\n }\n | {\n property: \"created_at\"\n timestamp: {\n equals?: string\n before?: string\n after?: string\n on_or_before?: string\n on_or_after?: string\n }\n }\n >\n }\n | {\n or: Array<\n | { property: \"id\"; string: { equals: string } }\n | {\n property: \"type\"\n event_type: {\n equals?:\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n in?: Array<\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n >\n }\n }\n | {\n property: \"sequence\"\n number: {\n greater_than?: number\n greater_than_or_equal_to?: number\n less_than?: number\n less_than_or_equal_to?: number\n }\n }\n | {\n property: \"created_at\"\n timestamp: {\n equals?: string\n before?: string\n after?: string\n on_or_before?: string\n on_or_after?: string\n }\n }\n >\n }\n >\n }\n | {\n or: Array<\n | { property: \"id\"; string: { equals: string } }\n | {\n property: \"type\"\n event_type: {\n equals?:\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n in?: Array<\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n >\n }\n }\n | {\n property: \"sequence\"\n number: {\n greater_than?: number\n greater_than_or_equal_to?: number\n less_than?: number\n less_than_or_equal_to?: number\n }\n }\n | {\n property: \"created_at\"\n timestamp: {\n equals?: string\n before?: string\n after?: string\n on_or_before?: string\n on_or_after?: string\n }\n }\n | {\n and: Array<\n | { property: \"id\"; string: { equals: string } }\n | {\n property: \"type\"\n event_type: {\n equals?:\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n in?: Array<\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n >\n }\n }\n | {\n property: \"sequence\"\n number: {\n greater_than?: number\n greater_than_or_equal_to?: number\n less_than?: number\n less_than_or_equal_to?: number\n }\n }\n | {\n property: \"created_at\"\n timestamp: {\n equals?: string\n before?: string\n after?: string\n on_or_before?: string\n on_or_after?: string\n }\n }\n >\n }\n | {\n or: Array<\n | { property: \"id\"; string: { equals: string } }\n | {\n property: \"type\"\n event_type: {\n equals?:\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n in?: Array<\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n >\n }\n }\n | {\n property: \"sequence\"\n number: {\n greater_than?: number\n greater_than_or_equal_to?: number\n less_than?: number\n less_than_or_equal_to?: number\n }\n }\n | {\n property: \"created_at\"\n timestamp: {\n equals?: string\n before?: string\n after?: string\n on_or_before?: string\n on_or_after?: string\n }\n }\n >\n }\n >\n }\n >\n }\n // Ordered sort precedence. Defaults to sequence ascending.\n sorts?: Array<{\n // One of: `sequence`, `created_at`\n property: \"sequence\" | \"created_at\"\n // One of: `ascending`, `descending`\n direction: \"ascending\" | \"descending\"\n }>\n // The continuation cursor returned by the previous page.\n start_cursor?: string | null\n // The number of events to return. Maximum: 100.\n page_size?: number\n}\n\nexport type QuerySessionEventsParameters = QuerySessionEventsPathParameters &\n QuerySessionEventsBodyParameters\n\nexport type QuerySessionEventsResponse = {\n // Always `list`\n object: \"list\"\n // Always `session_event`\n type: \"session_event\"\n session_event: Record<string, never>\n results: Array<\n | {\n // Always `session_event`\n object: \"session_event\"\n id: string\n session_id: string\n sequence: number\n created_at: string\n // Always `user.message`\n type: \"user.message\"\n content: Array<\n | {\n // Always `text`\n type: \"text\"\n text: string\n }\n | {\n // Always `file`\n type: \"file\"\n name: string\n content_type: string\n url: string\n expiry_time?: string\n }\n >\n created_by: {\n id: string\n // One of: `user`, `bot`\n type: \"user\" | \"bot\"\n } | null\n metadata: Record<string, string> | null\n }\n | {\n // Always `session_event`\n object: \"session_event\"\n id: string\n session_id: string\n sequence: number\n created_at: string\n // Always `agent.message`\n type: \"agent.message\"\n content: Array<\n | {\n // Always `text`\n type: \"text\"\n text: string\n }\n | {\n // Always `file`\n type: \"file\"\n name: string\n content_type: string\n url: string\n expiry_time?: string\n }\n >\n created_by: {\n id: string\n // One of: `user`, `bot`\n type: \"user\" | \"bot\"\n } | null\n metadata: { model: string } | null\n }\n | {\n // Always `session_event`\n object: \"session_event\"\n id: string\n session_id: string\n sequence: number\n created_at: string\n // Always `agent.thinking`\n type: \"agent.thinking\"\n content: Array<{\n // Always `text`\n type: \"text\"\n text: string\n }>\n }\n | {\n // Always `session_event`\n object: \"session_event\"\n id: string\n session_id: string\n sequence: number\n created_at: string\n // Always `agent.tool_use`\n type: \"agent.tool_use\"\n tool_name: string\n }\n | {\n // Always `session_event`\n object: \"session_event\"\n id: string\n session_id: string\n sequence: number\n created_at: string\n // Always `agent.tool_result`\n type: \"agent.tool_result\"\n tool_use_id: string\n tool_name: string\n is_error: boolean\n }\n | {\n // Always `session_event`\n object: \"session_event\"\n id: string\n session_id: string\n sequence: number\n created_at: string\n // Always `session.status`\n type: \"session.status\"\n // One of: `requires_action`, `completed`, `failed`, `canceled`, `terminated`\n status:\n | \"requires_action\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"terminated\"\n required_actions?: Array<{\n action_id: string\n title: string\n options: Array<{\n // One of: `approve`, `reject`\n id: \"approve\" | \"reject\"\n label: string\n }>\n }>\n error?: { code: string; message: string; retryable: boolean }\n }\n >\n has_more: boolean\n next_cursor: string | null\n}\n\n/**\n * Query session events\n */\nexport const querySessionEvents = {\n method: \"post\",\n pathParams: [\"session_id\"],\n queryParams: [],\n bodyParams: [\"filter\", \"sorts\", \"start_cursor\", \"page_size\"],\n\n path: (p: QuerySessionEventsPathParameters): string =>\n `sessions/${p.session_id}/events/query`,\n} as const\n\ntype QuerySessionsBodyParameters = {\n // A case-insensitive substring search over session titles.\n query?: string\n // A session property filter, or an and/or compound filter nested up to two levels deep.\n filter?:\n | {\n // Filter sessions by id.\n property: \"id\"\n // An exact string comparison.\n string: {\n // Return sessions with this exact value.\n equals: string\n }\n }\n | {\n // Filter sessions by agent_id.\n property: \"agent_id\"\n // An exact string comparison.\n string: {\n // Return sessions with this exact value.\n equals: string\n }\n }\n | {\n // Filter sessions by status.\n property: \"status\"\n // A session status comparison.\n status: {\n // Return sessions with this status.\n equals?:\n | \"queued\"\n | \"in_progress\"\n | \"requires_action\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"terminated\"\n // Return sessions with any of these statuses.\n in?: Array<\n | \"queued\"\n | \"in_progress\"\n | \"requires_action\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"terminated\"\n >\n }\n }\n | {\n // The session timestamp to compare.\n property: \"created_at\" | \"updated_at\"\n // A timestamp range.\n timestamp: {\n // Return sessions before this time.\n before?: string\n // Return sessions after this time.\n after?: string\n // Return sessions at or before this time.\n on_or_before?: string\n // Return sessions at or after this time.\n on_or_after?: string\n }\n }\n | {\n // Return sessions that match every child filter.\n and: Array<\n | {\n // Filter sessions by id.\n property: \"id\"\n // An exact string comparison.\n string: {\n // Return sessions with this exact value.\n equals: string\n }\n }\n | {\n // Filter sessions by agent_id.\n property: \"agent_id\"\n // An exact string comparison.\n string: {\n // Return sessions with this exact value.\n equals: string\n }\n }\n | {\n // Filter sessions by status.\n property: \"status\"\n // A session status comparison.\n status: {\n // Return sessions with this status.\n equals?:\n | \"queued\"\n | \"in_progress\"\n | \"requires_action\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"terminated\"\n // Return sessions with any of these statuses.\n in?: Array<\n | \"queued\"\n | \"in_progress\"\n | \"requires_action\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"terminated\"\n >\n }\n }\n | {\n // The session timestamp to compare.\n property: \"created_at\" | \"updated_at\"\n // A timestamp range.\n timestamp: {\n // Return sessions before this time.\n before?: string\n // Return sessions after this time.\n after?: string\n // Return sessions at or before this time.\n on_or_before?: string\n // Return sessions at or after this time.\n on_or_after?: string\n }\n }\n | {\n // Return sessions that match every child filter.\n and: Array<\n | {\n // Filter sessions by id.\n property: \"id\"\n // An exact string comparison.\n string: {\n // Return sessions with this exact value.\n equals: string\n }\n }\n | {\n // Filter sessions by agent_id.\n property: \"agent_id\"\n // An exact string comparison.\n string: {\n // Return sessions with this exact value.\n equals: string\n }\n }\n | {\n // Filter sessions by status.\n property: \"status\"\n // A session status comparison.\n status: {\n // Return sessions with this status.\n equals?:\n | \"queued\"\n | \"in_progress\"\n | \"requires_action\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"terminated\"\n // Return sessions with any of these statuses.\n in?: Array<\n | \"queued\"\n | \"in_progress\"\n | \"requires_action\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"terminated\"\n >\n }\n }\n | {\n // The session timestamp to compare.\n property: \"created_at\" | \"updated_at\"\n // A timestamp range.\n timestamp: {\n // Return sessions before this time.\n before?: string\n // Return sessions after this time.\n after?: string\n // Return sessions at or before this time.\n on_or_before?: string\n // Return sessions at or after this time.\n on_or_after?: string\n }\n }\n >\n }\n | {\n // Return sessions that match any child filter.\n or: Array<\n | {\n // Filter sessions by id.\n property: \"id\"\n // An exact string comparison.\n string: {\n // Return sessions with this exact value.\n equals: string\n }\n }\n | {\n // Filter sessions by agent_id.\n property: \"agent_id\"\n // An exact string comparison.\n string: {\n // Return sessions with this exact value.\n equals: string\n }\n }\n | {\n // Filter sessions by status.\n property: \"status\"\n // A session status comparison.\n status: {\n // Return sessions with this status.\n equals?:\n | \"queued\"\n | \"in_progress\"\n | \"requires_action\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"terminated\"\n // Return sessions with any of these statuses.\n in?: Array<\n | \"queued\"\n | \"in_progress\"\n | \"requires_action\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"terminated\"\n >\n }\n }\n | {\n // The session timestamp to compare.\n property: \"created_at\" | \"updated_at\"\n // A timestamp range.\n timestamp: {\n // Return sessions before this time.\n before?: string\n // Return sessions after this time.\n after?: string\n // Return sessions at or before this time.\n on_or_before?: string\n // Return sessions at or after this time.\n on_or_after?: string\n }\n }\n >\n }\n >\n }\n | {\n // Return sessions that match any child filter.\n or: Array<\n | {\n // Filter sessions by id.\n property: \"id\"\n // An exact string comparison.\n string: {\n // Return sessions with this exact value.\n equals: string\n }\n }\n | {\n // Filter sessions by agent_id.\n property: \"agent_id\"\n // An exact string comparison.\n string: {\n // Return sessions with this exact value.\n equals: string\n }\n }\n | {\n // Filter sessions by status.\n property: \"status\"\n // A session status comparison.\n status: {\n // Return sessions with this status.\n equals?:\n | \"queued\"\n | \"in_progress\"\n | \"requires_action\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"terminated\"\n // Return sessions with any of these statuses.\n in?: Array<\n | \"queued\"\n | \"in_progress\"\n | \"requires_action\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"terminated\"\n >\n }\n }\n | {\n // The session timestamp to compare.\n property: \"created_at\" | \"updated_at\"\n // A timestamp range.\n timestamp: {\n // Return sessions before this time.\n before?: string\n // Return sessions after this time.\n after?: string\n // Return sessions at or before this time.\n on_or_before?: string\n // Return sessions at or after this time.\n on_or_after?: string\n }\n }\n | {\n // Return sessions that match every child filter.\n and: Array<\n | {\n // Filter sessions by id.\n property: \"id\"\n // An exact string comparison.\n string: {\n // Return sessions with this exact value.\n equals: string\n }\n }\n | {\n // Filter sessions by agent_id.\n property: \"agent_id\"\n // An exact string comparison.\n string: {\n // Return sessions with this exact value.\n equals: string\n }\n }\n | {\n // Filter sessions by status.\n property: \"status\"\n // A session status comparison.\n status: {\n // Return sessions with this status.\n equals?:\n | \"queued\"\n | \"in_progress\"\n | \"requires_action\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"terminated\"\n // Return sessions with any of these statuses.\n in?: Array<\n | \"queued\"\n | \"in_progress\"\n | \"requires_action\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"terminated\"\n >\n }\n }\n | {\n // The session timestamp to compare.\n property: \"created_at\" | \"updated_at\"\n // A timestamp range.\n timestamp: {\n // Return sessions before this time.\n before?: string\n // Return sessions after this time.\n after?: string\n // Return sessions at or before this time.\n on_or_before?: string\n // Return sessions at or after this time.\n on_or_after?: string\n }\n }\n >\n }\n | {\n // Return sessions that match any child filter.\n or: Array<\n | {\n // Filter sessions by id.\n property: \"id\"\n // An exact string comparison.\n string: {\n // Return sessions with this exact value.\n equals: string\n }\n }\n | {\n // Filter sessions by agent_id.\n property: \"agent_id\"\n // An exact string comparison.\n string: {\n // Return sessions with this exact value.\n equals: string\n }\n }\n | {\n // Filter sessions by status.\n property: \"status\"\n // A session status comparison.\n status: {\n // Return sessions with this status.\n equals?:\n | \"queued\"\n | \"in_progress\"\n | \"requires_action\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"terminated\"\n // Return sessions with any of these statuses.\n in?: Array<\n | \"queued\"\n | \"in_progress\"\n | \"requires_action\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"terminated\"\n >\n }\n }\n | {\n // The session timestamp to compare.\n property: \"created_at\" | \"updated_at\"\n // A timestamp range.\n timestamp: {\n // Return sessions before this time.\n before?: string\n // Return sessions after this time.\n after?: string\n // Return sessions at or before this time.\n on_or_before?: string\n // Return sessions at or after this time.\n on_or_after?: string\n }\n }\n >\n }\n >\n }\n // Ordered sort precedence. Defaults to updated_at descending.\n sorts?: Array<{\n // One of: `created_at`, `updated_at`\n property: \"created_at\" | \"updated_at\"\n // One of: `ascending`, `descending`\n direction: \"ascending\" | \"descending\"\n }>\n // The continuation cursor returned by the previous page.\n start_cursor?: string | null\n // The number of sessions to return. Maximum: 100.\n page_size?: number\n}\n\nexport type QuerySessionsParameters = QuerySessionsBodyParameters\n\nexport type QuerySessionsResponse = {\n // Always `list`\n object: \"list\"\n // Always `session`\n type: \"session\"\n session: Record<string, never>\n // Sessions found in this bounded scan. Access filtering can leave this array empty while\n // has_more is true.\n results: Array<{\n // Always `session`\n object: \"session\"\n id: string\n agent_id: string\n title: string\n // One of: `queued`, `in_progress`, `requires_action`, `completed`, `failed`, `canceled`,\n // `terminated`\n status:\n | \"queued\"\n | \"in_progress\"\n | \"requires_action\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"terminated\"\n created_by: {\n id: string\n // One of: `user`, `bot`\n type: \"user\" | \"bot\"\n }\n agent_version: { id: string; number: number; published_at: string } | null\n models:\n | {\n // Always `auto`\n type: \"auto\"\n }\n | {\n // Always `pinned`\n type: \"pinned\"\n ids: Array<string | null>\n }\n created_at: string\n updated_at: string\n required_actions?: Array<{\n action_id: string\n title: string\n options: Array<{\n // One of: `approve`, `reject`\n id: \"approve\" | \"reject\"\n label: string\n }>\n }>\n error?: { code: string; message: string; retryable: boolean }\n trigger_type?: string\n type_labels?: Array<string> | null\n chat_user_emails?: Array<string> | null\n tool_types?: Array<string> | null\n tool_call_count?: number | null\n credits_used?: number | null\n runs_completed?: number | null\n message_count?: number | null\n }>\n // Whether more session candidates remain after this bounded scan.\n has_more: boolean\n // Pass this cursor as start_cursor when has_more is true, even when results is empty.\n next_cursor: string | null\n}\n\n/**\n * Query sessions\n */\nexport const querySessions = {\n method: \"post\",\n pathParams: [],\n queryParams: [],\n bodyParams: [\"query\", \"filter\", \"sorts\", \"start_cursor\", \"page_size\"],\n\n path: (): string => `sessions/query`,\n} as const\n\ntype QueryThreadMessagesPathParameters = {\n // The ID of the thread.\n thread_id: IdRequest\n}\n\ntype QueryThreadMessagesBodyParameters = {\n // Whether to include agent thinking and structured message content parts. Defaults to\n // false.\n verbose?: boolean\n // Opaque continuation cursor from the previous page.\n start_cursor?: string | null\n // Number of messages to return. Maximum: 100.\n page_size?: number\n}\n\nexport type QueryThreadMessagesParameters = QueryThreadMessagesPathParameters &\n QueryThreadMessagesBodyParameters\n\nexport type QueryThreadMessagesResponse = {\n // Always `list`\n object: \"list\"\n // Always `thread_message`\n type: \"thread_message\"\n results: Array<{\n // Always `thread_message`\n object: \"thread_message\"\n id: IdResponse\n // One of: `user`, `agent`\n role: \"user\" | \"agent\"\n content: string\n // Date and time when this message was created.\n created_time: string\n parent: {\n // The parent type.\n type: \"thread\"\n // The ID of the parent thread.\n id: IdResponse\n }\n attachments?: Array<{\n name: string\n content_type: string\n url: string\n // The time when the attachment URL will expire.\n expiry_time?: string\n }>\n content_parts?: Array<\n | {\n // Always `text`\n type: \"text\"\n text: string\n }\n | {\n // Always `thinking`\n type: \"thinking\"\n text: string\n }\n | {\n // Always `tool_call`\n type: \"tool_call\"\n tool_call_id: string | null\n tool_name: string\n results?: Array<{\n id: IdResponse\n agent_step_id: IdResponse | null\n tool_call_id: string | null\n tool_name: string\n tool_type: string\n state: string\n started_at: number\n finished_at: number | null\n duration_ms: number | null\n }>\n }\n | {\n // Always `follow_ups`\n type: \"follow_ups\"\n follow_ups: Array<{ label: string; message: string }>\n }\n | {\n // Always `custom_agent_template_picker`\n type: \"custom_agent_template_picker\"\n }\n >\n pending_user_actions?: Array<{\n id: IdResponse\n // Always `tool_confirmation`\n type: \"tool_confirmation\"\n title: string\n requirements: Array<\n | {\n // Always `general`\n type: \"general\"\n }\n | {\n // Always `manage_workers`\n type: \"manage_workers\"\n }\n | {\n // Always `url_safety`\n type: \"url_safety\"\n urls: Array<string>\n required_by_workspace_policy?: boolean\n }\n | {\n // Always `permission_escalation`\n type: \"permission_escalation\"\n destination_title?: string\n source_titles?: Array<string>\n }\n | {\n // Always `delete_content`\n type: \"delete_content\"\n page_count: number\n database_count: number\n meeting_notes_block_count?: number\n }\n | {\n // Always `connect_integration`\n type: \"connect_integration\"\n integration_type: string\n integration_name: string\n handoff_url: string\n }\n | {\n // Always `admin_mode`\n type: \"admin_mode\"\n explanation?: string\n }\n >\n options: Array<\n | {\n // Always `approve`\n id: \"approve\"\n label: string\n }\n | {\n // Always `reject`\n id: \"reject\"\n label: string\n }\n | {\n // Always `use_connection`\n id: \"use_connection\"\n label: string\n input: {\n // Always `connection_id`\n type: \"connection_id\"\n // Always `true`\n required: true\n }\n }\n >\n }>\n }>\n has_more: boolean\n next_cursor: string | null\n}\n\n/**\n * Query thread messages\n */\nexport const queryThreadMessages = {\n method: \"post\",\n pathParams: [\"thread_id\"],\n queryParams: [],\n bodyParams: [\"verbose\", \"start_cursor\", \"page_size\"],\n\n path: (p: QueryThreadMessagesPathParameters): string =>\n `threads/${p.thread_id}/messages/query`,\n} as const\n\ntype QueryThreadsPathParameters = {\n // The ID of the agent. Use a UUID for custom agents or `notion_ai` for Notion Agent\n // (personal agent); the reserved UUID `33333333-3333-3333-3333-333333333333` remains\n // supported for backward compatibility.\n agent_id: IdRequest | \"notion_ai\" | \"33333333-3333-3333-3333-333333333333\"\n}\n\ntype QueryThreadsBodyParameters = {\n // Search thread titles.\n query?: string\n // Thread filters.\n filter?: {\n // Filter threads by ID (exact match).\n id?: IdRequest\n // Filter by one or more activity statuses. `all` cannot be combined with another status.\n status?: Array<\"all\" | \"pending\" | \"in_progress\" | \"failed\" | \"success\">\n // Filter by creator IDs or \"me\".\n created_by?: Array<IdRequest | \"me\">\n // Filter by last-used actor IDs or \"me\".\n last_used_by?: Array<IdRequest | \"me\">\n // Filter to threads containing a public-facing message in the requested time window.\n message_time?: {\n // Inclusive start of the message time window. Defaults to the Unix epoch.\n start?: string\n // Exclusive end of the message time window. Defaults to the current time.\n end?: string\n }\n }\n // Ordered sort precedence. Defaults to last_used_time descending.\n sorts?: Array<{\n // Timestamp used to sort threads.\n timestamp: \"created_time\" | \"last_used_time\"\n // Sort direction.\n direction: \"ascending\" | \"descending\"\n }>\n // Opaque continuation cursor from the previous page.\n start_cursor?: string | null\n // Number of threads to return. Maximum: 100.\n page_size?: number\n}\n\nexport type QueryThreadsParameters = QueryThreadsPathParameters &\n QueryThreadsBodyParameters\n\nexport type QueryThreadsResponse = {\n // Always `list`\n object: \"list\"\n // Always `thread`\n type: \"thread\"\n results: Array<{\n // Always `thread`\n object: \"thread\"\n id: IdResponse\n title: string\n // One of: `pending`, `requires_action`, `completed`, `canceled`, `failed`\n status: \"pending\" | \"requires_action\" | \"completed\" | \"canceled\" | \"failed\"\n // Date and time when this thread was created.\n created_time: string\n // Date and time when this thread was last updated.\n last_edited_time: string\n created_by: {\n // The ID of the actor that created this thread: a bot for an integration-created thread,\n // a user for one created in the Notion app.\n id: IdResponse\n // The creator type. Threads a caller can see because it has access to the agent, such as\n // a trigger's runs or a teammate's chats, may be created by either a bot or a user.\n type: \"bot\" | \"user\"\n }\n agent_version: {\n // The ID of the published artifact.\n id: IdResponse\n // The version number.\n number: number\n // The ISO 8601 timestamp when this version was published.\n published_at: string\n } | null\n models:\n | {\n // Always `auto`\n type: \"auto\"\n }\n | {\n // Always `pinned`\n type: \"pinned\"\n // The public model this thread is pinned to (e.g. \"claude-sonnet-5\"), with null for a\n // pre-release / early-access model. Empty when the thread has no model recorded yet.\n // Reflects the thread's configuration at creation, so a model changed mid-conversation\n // is not reflected here.\n ids: Array<string | null>\n }\n error?: string\n // How this thread started: the type of the trigger that ran it, or \"chat\".\n trigger_type?: string\n // Labels describing how the thread ran (triggered, chat, setup). Null when the caller\n // lacks edit access to the agent.\n type_labels?: Array<string> | null\n // Emails of the users who participated in this thread. Null when the caller lacks edit\n // access to the agent.\n chat_user_emails?: Array<string> | null\n // Types of tool this thread called. Null when the caller lacks edit access to the agent.\n tool_types?: Array<string> | null\n // Number of tool calls in this thread. Null when the caller lacks edit access to the\n // agent.\n tool_call_count?: number | null\n // Premium AI credits this thread consumed. Null when the caller lacks edit access to the\n // agent.\n credits_used?: number | null\n // Runs completed in this thread. Null when the caller lacks edit access to the agent, or\n // when the thread predates run tracking.\n runs_completed?: number | null\n pending_user_actions?: Array<{\n id: IdResponse\n // Always `tool_confirmation`\n type: \"tool_confirmation\"\n title: string\n requirements: Array<\n | {\n // Always `general`\n type: \"general\"\n }\n | {\n // Always `manage_workers`\n type: \"manage_workers\"\n }\n | {\n // Always `url_safety`\n type: \"url_safety\"\n urls: Array<string>\n required_by_workspace_policy?: boolean\n }\n | {\n // Always `permission_escalation`\n type: \"permission_escalation\"\n destination_title?: string\n source_titles?: Array<string>\n }\n | {\n // Always `delete_content`\n type: \"delete_content\"\n page_count: number\n database_count: number\n meeting_notes_block_count?: number\n }\n | {\n // Always `connect_integration`\n type: \"connect_integration\"\n integration_type: string\n integration_name: string\n handoff_url: string\n }\n | {\n // Always `admin_mode`\n type: \"admin_mode\"\n explanation?: string\n }\n >\n options: Array<\n | {\n // Always `approve`\n id: \"approve\"\n label: string\n }\n | {\n // Always `reject`\n id: \"reject\"\n label: string\n }\n | {\n // Always `use_connection`\n id: \"use_connection\"\n label: string\n input: {\n // Always `connection_id`\n type: \"connection_id\"\n // Always `true`\n required: true\n }\n }\n >\n }>\n }>\n has_more: boolean\n next_cursor: string | null\n}\n\n/**\n * Query threads\n */\nexport const queryThreads = {\n method: \"post\",\n pathParams: [\"agent_id\"],\n queryParams: [],\n bodyParams: [\"query\", \"filter\", \"sorts\", \"start_cursor\", \"page_size\"],\n\n path: (p: QueryThreadsPathParameters): string =>\n `agents/${p.agent_id}/threads/query`,\n} as const\n\ntype RetrieveSessionPathParameters = {\n // The ID of the session to retrieve.\n session_id: IdRequest\n}\n\nexport type RetrieveSessionParameters = RetrieveSessionPathParameters\n\nexport type RetrieveSessionResponse = {\n // Always `session`\n object: \"session\"\n id: string\n agent_id: string\n title: string\n // One of: `queued`, `in_progress`, `requires_action`, `completed`, `failed`, `canceled`,\n // `terminated`\n status:\n | \"queued\"\n | \"in_progress\"\n | \"requires_action\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"terminated\"\n created_at: string\n updated_at: string\n created_by: {\n id: string\n // One of: `user`, `bot`\n type: \"user\" | \"bot\"\n }\n agent_version: { id: string; number: number; published_at: string } | null\n models:\n | {\n // Always `auto`\n type: \"auto\"\n }\n | {\n // Always `pinned`\n type: \"pinned\"\n ids: Array<string | null>\n }\n required_actions?: Array<{\n action_id: string\n title: string\n options: Array<{\n // One of: `approve`, `reject`\n id: \"approve\" | \"reject\"\n label: string\n }>\n }>\n error?: { code: string; message: string; retryable: boolean }\n trigger_type?: string\n type_labels?: Array<string> | null\n chat_user_emails?: Array<string> | null\n tool_types?: Array<string> | null\n tool_call_count?: number | null\n credits_used?: number | null\n runs_completed?: number | null\n message_count?: number | null\n}\n\n/**\n * Retrieve a session\n */\nexport const retrieveSession = {\n method: \"get\",\n pathParams: [\"session_id\"],\n queryParams: [],\n bodyParams: [],\n\n path: (p: RetrieveSessionPathParameters): string =>\n `sessions/${p.session_id}`,\n} as const\n\ntype SendExternalAgentStubSessionMessagePathParameters = {\n // The ID of the agent backing this external agent session.\n agent_id: IdRequest | \"33333333-3333-3333-3333-333333333333\"\n // The provider-owned session ID returned when the session was created.\n session_id: IdRequest\n}\n\ntype SendExternalAgentStubSessionMessageBodyParameters = {\n // Text message to send to the agent.\n message: string\n // Idempotency key for this message submission. Accepted but not yet used for\n // deduplication by the stub.\n client_message_id?: string\n}\n\nexport type SendExternalAgentStubSessionMessageParameters =\n SendExternalAgentStubSessionMessagePathParameters &\n SendExternalAgentStubSessionMessageBodyParameters\n\nexport type SendExternalAgentStubSessionMessageResponse = {\n accepted: boolean\n run_id?: string\n}\n\n/**\n * Send external agent stub session message\n */\nexport const sendExternalAgentStubSessionMessage = {\n method: \"post\",\n pathParams: [\"agent_id\", \"session_id\"],\n queryParams: [],\n bodyParams: [\"message\", \"client_message_id\"],\n\n path: (p: SendExternalAgentStubSessionMessagePathParameters): string =>\n `external_agent_stub/${p.agent_id}/sessions/${p.session_id}/messages`,\n} as const\n\ntype StartExternalAgentStubSessionPathParameters = {\n // The ID of the agent backing this external agent session.\n agent_id: IdRequest | \"33333333-3333-3333-3333-333333333333\"\n}\n\ntype StartExternalAgentStubSessionBodyParameters = {\n // External Agent API wire version.\n spec_version?: \"v1\"\n // Idempotency key for one session-creation intent.\n client_reference_id?: string\n // Vault-backed session configuration.\n configs?: {\n // The ordered MCP server configuration.\n mcp_servers: Array<{\n // MCP server name.\n name: string\n // MCP server URL.\n server_url: string\n // Credential vault reference or deliberate no-auth.\n credential:\n | {\n // Vault-backed credential reference.\n type: \"vault\"\n // Provider-owned vault ID.\n vault_id: string\n }\n | {\n // No authorization credential.\n type: \"none\"\n }\n }>\n }\n // Preferred model hint. The stub echoes it back and may ignore it.\n model?: string\n // Working directory hint. Not applicable to this provider; echoed back.\n cwd?: string\n // BCP 47 locale identifier such as `en-US`.\n locale?: string\n // Session-scoped instructions for the external agent.\n system_prompt?: string\n}\n\nexport type StartExternalAgentStubSessionParameters =\n StartExternalAgentStubSessionPathParameters &\n StartExternalAgentStubSessionBodyParameters\n\nexport type StartExternalAgentStubSessionResponse = {\n session_id: string\n model?: string\n cwd?: string\n last_active_at?: string\n}\n\n/**\n * Start external agent stub session\n */\nexport const startExternalAgentStubSession = {\n method: \"post\",\n pathParams: [\"agent_id\"],\n queryParams: [],\n bodyParams: [\n \"spec_version\",\n \"client_reference_id\",\n \"configs\",\n \"model\",\n \"cwd\",\n \"locale\",\n \"system_prompt\",\n ],\n\n path: (p: StartExternalAgentStubSessionPathParameters): string =>\n `external_agent_stub/${p.agent_id}/sessions`,\n} as const\n\ntype UpdateAgentCreditLimitPathParameters = {\n // The ID of the custom agent (a UUID). The personal agent (Notion AI) is not supported\n // by this endpoint.\n agent_id: IdRequest | \"notion_ai\" | \"33333333-3333-3333-3333-333333333333\"\n}\n\ntype UpdateAgentCreditLimitBodyParameters = {\n // The per-agent credit limit as a non-negative integer, or null to clear the limit.\n credit_limit: number | null\n}\n\nexport type UpdateAgentCreditLimitParameters =\n UpdateAgentCreditLimitPathParameters & UpdateAgentCreditLimitBodyParameters\n\nexport type UpdateAgentCreditLimitResponse = {\n agent_id: IdResponse\n // The agent's editor-set per-agent credit limit; null when no limit applies.\n credit_limit: number | null\n // ISO 8601 timestamp of when the agent was last edited.\n last_edited_time: string\n}\n\n/**\n * Update agent credit limit\n */\nexport const updateAgentCreditLimit = {\n method: \"patch\",\n pathParams: [\"agent_id\"],\n queryParams: [],\n bodyParams: [\"credit_limit\"],\n\n path: (p: UpdateAgentCreditLimitPathParameters): string =>\n `agents/${p.agent_id}/credit_limit`,\n} as const\n\ntype UpdateAgentStatusPathParameters = {\n // The agent ID (a UUID), or `notion_ai` for the personal agent. Endpoint-specific\n // restrictions still apply.\n agent_id: IdRequest | \"notion_ai\" | \"33333333-3333-3333-3333-333333333333\"\n}\n\ntype UpdateAgentStatusBodyParameters = {\n // Set to \"active\" to re-enable an agent that was disabled through this API, or\n // \"disabled\" to turn off a running agent.\n status: \"active\" | \"disabled\"\n}\n\nexport type UpdateAgentStatusParameters = UpdateAgentStatusPathParameters &\n UpdateAgentStatusBodyParameters\n\nexport type UpdateAgentStatusResponse = {\n agent_id: IdResponse\n // \"active\" when the agent can run; \"disabled\" when it is paused (see pause_reason);\n // \"deleted\" when it has been removed.\n status: \"active\" | \"disabled\" | \"deleted\"\n // Why the agent is paused when status is \"disabled\" (e.g. \"disabled_from_api\",\n // \"credit_limit\"); null when active or deleted.\n pause_reason:\n | \"run_limit\"\n | \"credit_limit\"\n | \"runaway_credit_usage\"\n | \"workspace_credit_limit\"\n | \"failure_limit\"\n | \"mark_session_failed_autopause\"\n | \"disabled_from_workspace_settings\"\n | \"disabled_from_api\"\n | \"disabled_from_agent_settings\"\n | \"disabled_due_to_no_members_with_access\"\n | \"disabled_due_to_lack_of_editors\"\n | \"disabled_by_notion\"\n | \"internal_error\"\n | \"needs_user_review\"\n | \"tool_unavailable\"\n | null\n // ISO 8601 timestamp of when the agent was last edited.\n last_edited_time: string\n}\n\n/**\n * Update agent status\n */\nexport const updateAgentStatus = {\n method: \"patch\",\n pathParams: [\"agent_id\"],\n queryParams: [],\n bodyParams: [\"status\"],\n\n path: (p: UpdateAgentStatusPathParameters): string =>\n `agents/${p.agent_id}/status`,\n} as const\n\ntype UpdateSessionBodyParameters =\n | {\n message: string\n agent_id?:\n | IdRequest\n | \"notion_ai\"\n | \"33333333-3333-3333-3333-333333333333\"\n session_id?: IdRequest\n attachments?: Array<{\n file_upload: { id: string }\n // Always `file_upload`\n type?: \"file_upload\"\n name?: string\n }>\n metadata?: Record<string, string>\n prompt_context?: string\n }\n | {\n session_id: IdRequest\n actions: Array<{\n action_id: IdRequest\n // One of: `approve`, `reject`\n option_id: \"approve\" | \"reject\"\n }>\n metadata?: Record<string, string>\n }\n | { session_id: IdRequest; continue_from: string }\n\nexport type UpdateSessionParameters = UpdateSessionBodyParameters\n\nexport type UpdateSessionResponse = {\n // Always `session`\n object: \"session\"\n id: string\n agent_id: string\n title: string\n // One of: `queued`, `in_progress`, `requires_action`, `completed`, `failed`, `canceled`,\n // `terminated`\n status:\n | \"queued\"\n | \"in_progress\"\n | \"requires_action\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"terminated\"\n created_at: string\n updated_at: string\n required_actions?: Array<{\n action_id: string\n title: string\n options: Array<{\n // One of: `approve`, `reject`\n id: \"approve\" | \"reject\"\n label: string\n }>\n }>\n error?: { code: string; message: string; retryable: boolean }\n}\n\n/**\n * Update a session\n */\nexport const updateSession = {\n method: \"post\",\n pathParams: [],\n queryParams: [],\n bodyParams: [\n \"message\",\n \"agent_id\",\n \"session_id\",\n \"attachments\",\n \"metadata\",\n \"prompt_context\",\n \"actions\",\n \"continue_from\",\n ],\n\n path: (): string => `sessions`,\n} as const\n"]}
1
+ {"version":3,"file":"agents.js","sourceRoot":"","sources":["../../../src/api-endpoints/agents.ts"],"names":[],"mappings":";AAAA,sBAAsB;AACtB,+CAA+C;;;AA+U/C;;GAEG;AACU,QAAA,mBAAmB,GAAG;IACjC,MAAM,EAAE,MAAM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uBAAuB,CAAC,CAAC,QAAQ,WAAW;CACtC,CAAA","sourcesContent":["// cspell:disable-file\n// Note: This is a generated file. DO NOT EDIT!\n\nimport type {\n EmptyObject,\n IdRequest,\n IdResponse,\n PageIconResponse,\n SessionAgentIdFilter,\n SessionIdFilter,\n SessionNestedFilter,\n SessionStatusFilter,\n SessionTimestampFilter,\n} from \"./common\"\n\n/**\n * Parameters for opening a session stream.\n */\nexport type UpdateSessionStreamParameters =\n | {\n message: string\n agent_id?: string | \"notion_ai\" | \"33333333-3333-3333-3333-333333333333\"\n session_id?: string\n attachments?: Array<{\n file_upload: {\n id: string\n }\n /**\n * Always `file_upload`\n */\n type?: \"file_upload\"\n name?: string\n }>\n metadata?: Record<string, string>\n prompt_context?: string\n }\n | {\n session_id: string\n actions: Array<{\n action_id: string\n /**\n * One of: `approve`, `reject`\n */\n option_id: \"approve\" | \"reject\"\n }>\n metadata?: Record<string, string>\n }\n | {\n session_id: string\n continue_from: string\n }\n\n/**\n * An event emitted by a session stream.\n */\nexport type UpdateSessionStreamResponse =\n | {\n /**\n * Always `session.snapshot`\n */\n type: \"session.snapshot\"\n session: {\n /**\n * Always `session`\n */\n object: \"session\"\n id: string\n agent_id: string\n title: string\n /**\n * One of: `queued`, `in_progress`, `requires_action`, `completed`, `failed`, `canceled`, `terminated`\n */\n status:\n | \"queued\"\n | \"in_progress\"\n | \"requires_action\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"terminated\"\n created_at: string\n updated_at: string\n required_actions?: Array<{\n action_id: string\n title: string\n options: Array<{\n /**\n * One of: `approve`, `reject`\n */\n id: \"approve\" | \"reject\"\n label: string\n }>\n }>\n error?: {\n code: string\n message: string\n retryable: boolean\n }\n }\n }\n | {\n /**\n * Always `event.provisional`\n */\n type: \"event.provisional\"\n event:\n | {\n /**\n * Always `session_event`\n */\n object: \"session_event\"\n id: string\n session_id: string\n created_at: string\n /**\n * Always `agent.message`\n */\n type: \"agent.message\"\n content: Array<{\n /**\n * Always `text`\n */\n type: \"text\"\n text: string\n }>\n }\n | {\n /**\n * Always `session_event`\n */\n object: \"session_event\"\n id: string\n session_id: string\n created_at: string\n /**\n * Always `agent.tool_use`\n */\n type: \"agent.tool_use\"\n tool_name: string\n }\n }\n | {\n /**\n * Always `event.committed`\n */\n type: \"event.committed\"\n event:\n | {\n /**\n * Always `session_event`\n */\n object: \"session_event\"\n id: string\n session_id: string\n sequence: number\n created_at: string\n /**\n * Always `user.message`\n */\n type: \"user.message\"\n content: Array<\n | {\n /**\n * Always `text`\n */\n type: \"text\"\n text: string\n }\n | {\n /**\n * Always `file`\n */\n type: \"file\"\n file_id: string\n }\n >\n metadata?: Record<string, string>\n }\n | {\n /**\n * Always `session_event`\n */\n object: \"session_event\"\n id: string\n session_id: string\n sequence: number\n created_at: string\n /**\n * Always `agent.message`\n */\n type: \"agent.message\"\n content: Array<{\n /**\n * Always `text`\n */\n type: \"text\"\n text: string\n }>\n }\n | {\n /**\n * Always `session_event`\n */\n object: \"session_event\"\n id: string\n session_id: string\n sequence: number\n created_at: string\n /**\n * Always `agent.tool_use`\n */\n type: \"agent.tool_use\"\n tool_name: string\n }\n | {\n /**\n * Always `session_event`\n */\n object: \"session_event\"\n id: string\n session_id: string\n sequence: number\n created_at: string\n /**\n * Always `agent.tool_result`\n */\n type: \"agent.tool_result\"\n tool_use_id: string\n tool_name: string\n is_error: boolean\n }\n | {\n /**\n * Always `session_event`\n */\n object: \"session_event\"\n id: string\n session_id: string\n sequence: number\n created_at: string\n /**\n * Always `session.status`\n */\n type: \"session.status\"\n /**\n * One of: `queued`, `in_progress`, `requires_action`, `completed`, `failed`, `canceled`, `terminated`\n */\n status:\n | \"queued\"\n | \"in_progress\"\n | \"requires_action\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"terminated\"\n required_actions?: Array<{\n action_id: string\n title: string\n options: Array<{\n /**\n * One of: `approve`, `reject`\n */\n id: \"approve\" | \"reject\"\n label: string\n }>\n }>\n error?: {\n code: string\n message: string\n retryable: boolean\n }\n usage?: {\n total_tokens: number\n input_tokens?: number\n output_tokens?: number\n }\n artifacts?: Array<\n | {\n /**\n * Always `page`\n */\n type: \"page\"\n url: string\n title: string\n }\n | {\n /**\n * Always `html_artifact`\n */\n type: \"html_artifact\"\n url: string\n page_url: string\n }\n >\n }\n }\n | {\n /**\n * Always `stream.timeout`\n */\n type: \"stream.timeout\"\n session_id: string\n message: string\n }\n | {\n /**\n * Always `stream.end`\n */\n type: \"stream.end\"\n session_id: string\n /**\n * One of: `requires_action`, `completed`, `failed`, `canceled`, `terminated`\n */\n status:\n | \"requires_action\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"terminated\"\n }\n | {\n /**\n * Always `stream.error`\n */\n type: \"stream.error\"\n error: {\n code: string\n message: string\n /**\n * One of: `true`, `false`\n */\n retryable: true | false\n }\n session_id?: string\n }\n\n/**\n * Open a session stream.\n */\nexport const updateSessionStream = {\n method: \"post\",\n pathParams: [],\n queryParams: [],\n bodyParams: [\n \"message\",\n \"agent_id\",\n \"session_id\",\n \"attachments\",\n \"metadata\",\n \"prompt_context\",\n \"actions\",\n \"continue_from\",\n ],\n headers: { Accept: \"text/event-stream\" },\n path: (): string => `sessions`,\n} as const\n\ntype QueryAgentsBodyParameters = {\n // Search agent names and descriptions using a case-insensitive substring match.\n query?: string\n // Filter agents by public properties, optionally combined with and/or.\n filter?:\n | { property: \"id\"; id: { equals: string } }\n | {\n property: \"agent_type\"\n string: {\n equals: \"notion_ai\" | \"custom_agent\" | \"autofill_custom_agent\"\n }\n }\n | { property: \"created_by\"; people: { contains: string } }\n | { property: \"created_time\"; date: { after?: string; before?: string } }\n | { property: \"favorited\"; checkbox: { equals: boolean } }\n | { property: \"connections\"; mcp_server: { contains: string } }\n | {\n property: \"status\"\n status: { in: Array<\"active\" | \"disabled\" | \"deleted\"> }\n }\n | { property: \"model_mode\"; select: { equals: \"auto\" | \"pinned\" } }\n | { property: \"agent_version\"; number: { equals: number } }\n | { property: \"last_run_at\"; date: { after?: string; before?: string } }\n | {\n and: Array<\n | { property: \"id\"; id: { equals: string } }\n | {\n property: \"agent_type\"\n string: {\n equals: \"notion_ai\" | \"custom_agent\" | \"autofill_custom_agent\"\n }\n }\n | { property: \"created_by\"; people: { contains: string } }\n | {\n property: \"created_time\"\n date: { after?: string; before?: string }\n }\n | { property: \"favorited\"; checkbox: { equals: boolean } }\n | { property: \"connections\"; mcp_server: { contains: string } }\n | {\n property: \"status\"\n status: { in: Array<\"active\" | \"disabled\" | \"deleted\"> }\n }\n | { property: \"model_mode\"; select: { equals: \"auto\" | \"pinned\" } }\n | { property: \"agent_version\"; number: { equals: number } }\n | {\n property: \"last_run_at\"\n date: { after?: string; before?: string }\n }\n | {\n and: Array<\n | { property: \"id\"; id: { equals: string } }\n | {\n property: \"agent_type\"\n string: {\n equals:\n | \"notion_ai\"\n | \"custom_agent\"\n | \"autofill_custom_agent\"\n }\n }\n | { property: \"created_by\"; people: { contains: string } }\n | {\n property: \"created_time\"\n date: { after?: string; before?: string }\n }\n | { property: \"favorited\"; checkbox: { equals: boolean } }\n | { property: \"connections\"; mcp_server: { contains: string } }\n | {\n property: \"status\"\n status: { in: Array<\"active\" | \"disabled\" | \"deleted\"> }\n }\n | {\n property: \"model_mode\"\n select: { equals: \"auto\" | \"pinned\" }\n }\n | { property: \"agent_version\"; number: { equals: number } }\n | {\n property: \"last_run_at\"\n date: { after?: string; before?: string }\n }\n >\n }\n | {\n or: Array<\n | { property: \"id\"; id: { equals: string } }\n | {\n property: \"agent_type\"\n string: {\n equals:\n | \"notion_ai\"\n | \"custom_agent\"\n | \"autofill_custom_agent\"\n }\n }\n | { property: \"created_by\"; people: { contains: string } }\n | {\n property: \"created_time\"\n date: { after?: string; before?: string }\n }\n | { property: \"favorited\"; checkbox: { equals: boolean } }\n | { property: \"connections\"; mcp_server: { contains: string } }\n | {\n property: \"status\"\n status: { in: Array<\"active\" | \"disabled\" | \"deleted\"> }\n }\n | {\n property: \"model_mode\"\n select: { equals: \"auto\" | \"pinned\" }\n }\n | { property: \"agent_version\"; number: { equals: number } }\n | {\n property: \"last_run_at\"\n date: { after?: string; before?: string }\n }\n >\n }\n >\n }\n | {\n or: Array<\n | { property: \"id\"; id: { equals: string } }\n | {\n property: \"agent_type\"\n string: {\n equals: \"notion_ai\" | \"custom_agent\" | \"autofill_custom_agent\"\n }\n }\n | { property: \"created_by\"; people: { contains: string } }\n | {\n property: \"created_time\"\n date: { after?: string; before?: string }\n }\n | { property: \"favorited\"; checkbox: { equals: boolean } }\n | { property: \"connections\"; mcp_server: { contains: string } }\n | {\n property: \"status\"\n status: { in: Array<\"active\" | \"disabled\" | \"deleted\"> }\n }\n | { property: \"model_mode\"; select: { equals: \"auto\" | \"pinned\" } }\n | { property: \"agent_version\"; number: { equals: number } }\n | {\n property: \"last_run_at\"\n date: { after?: string; before?: string }\n }\n | {\n and: Array<\n | { property: \"id\"; id: { equals: string } }\n | {\n property: \"agent_type\"\n string: {\n equals:\n | \"notion_ai\"\n | \"custom_agent\"\n | \"autofill_custom_agent\"\n }\n }\n | { property: \"created_by\"; people: { contains: string } }\n | {\n property: \"created_time\"\n date: { after?: string; before?: string }\n }\n | { property: \"favorited\"; checkbox: { equals: boolean } }\n | { property: \"connections\"; mcp_server: { contains: string } }\n | {\n property: \"status\"\n status: { in: Array<\"active\" | \"disabled\" | \"deleted\"> }\n }\n | {\n property: \"model_mode\"\n select: { equals: \"auto\" | \"pinned\" }\n }\n | { property: \"agent_version\"; number: { equals: number } }\n | {\n property: \"last_run_at\"\n date: { after?: string; before?: string }\n }\n >\n }\n | {\n or: Array<\n | { property: \"id\"; id: { equals: string } }\n | {\n property: \"agent_type\"\n string: {\n equals:\n | \"notion_ai\"\n | \"custom_agent\"\n | \"autofill_custom_agent\"\n }\n }\n | { property: \"created_by\"; people: { contains: string } }\n | {\n property: \"created_time\"\n date: { after?: string; before?: string }\n }\n | { property: \"favorited\"; checkbox: { equals: boolean } }\n | { property: \"connections\"; mcp_server: { contains: string } }\n | {\n property: \"status\"\n status: { in: Array<\"active\" | \"disabled\" | \"deleted\"> }\n }\n | {\n property: \"model_mode\"\n select: { equals: \"auto\" | \"pinned\" }\n }\n | { property: \"agent_version\"; number: { equals: number } }\n | {\n property: \"last_run_at\"\n date: { after?: string; before?: string }\n }\n >\n }\n >\n }\n // Ordered sort precedence. Defaults to created_time descending.\n sorts?: Array<{\n // Timestamp used to sort agents.\n property: \"created_time\" | \"last_run_at\"\n // Sort direction.\n direction: \"ascending\" | \"descending\"\n }>\n // Opaque continuation cursor from the previous page.\n start_cursor?: string | null\n // Number of agents to return. Maximum: 100.\n page_size?: number\n // Whether to include inline instructions for each agent. Defaults to false.\n verbose?: boolean\n // Whether to include soft-deleted agents. Defaults to false.\n include_deleted?: boolean\n}\n\nexport type QueryAgentsParameters = QueryAgentsBodyParameters\n\nexport type QueryAgentsResponse = {\n // Always `list`\n object: \"list\"\n // Always `agent`\n type: \"agent\"\n results: Array<\n | {\n // Always `agent`\n object: \"agent\"\n id: IdResponse\n // What kind of agent this is: \"custom_agent\" is a standalone agent you chat with;\n // \"autofill_custom_agent\" fills a database property.\n agent_type: \"custom_agent\" | \"autofill_custom_agent\"\n name: string\n description: string | null\n instructions_page_id: IdResponse | null\n icon:\n | PageIconResponse\n | {\n // Type of icon. In this case, a custom agent avatar.\n type: \"custom_agent_avatar\"\n // The static and animated URLs for the agent avatar.\n custom_agent_avatar: {\n // The URL of the static custom agent avatar.\n static_url: string\n // The URL of the animated custom agent avatar.\n animated_url: string\n }\n }\n | null\n // The model selection: automatic, or pinned to a public model ID.\n model:\n | {\n // Always `auto`\n mode: \"auto\"\n }\n | {\n // Always `pinned`\n mode: \"pinned\"\n // The public model this agent maps to (e.g. \"claude-sonnet-5\"), or null for a\n // pre-release / early-access model.\n id: string | null\n }\n // Integrations the agent is connected to (Notion, Slack, Discord, MCP servers, and other\n // connectors), each with an account and per-target permissions.\n connections: Array<\n | {\n // Always `notion`\n type: \"notion\"\n name: string\n account: null\n permissions: Array<{\n target:\n | {\n // Always `page`\n type: \"page\"\n id: string\n }\n | {\n // Always `database_property`\n type: \"database_property\"\n data_source_id: string\n property_id: string\n }\n | {\n // Always `agent`\n type: \"agent\"\n id: string\n }\n | {\n // Always `workspace`\n type: \"workspace\"\n }\n | {\n // Always `owner_private_pages`\n type: \"owner_private_pages\"\n }\n | {\n // Always `web_search`\n type: \"web_search\"\n // Domains web search is restricted to, or null when unrestricted.\n allowed_domains: Array<string> | null\n }\n | {\n // Always `notion_help_docs_search`\n type: \"notion_help_docs_search\"\n }\n // Content roles (\"reader\" | \"comment_only\" | \"read_and_write\" | \"editor\") for scoped\n // targets, or search verbs (\"allow\" | \"disallow\") for the search targets.\n scopes: Array<string>\n }>\n }\n | {\n // Always `slack`\n type: \"slack\"\n name: string\n // The linked Slack workspace, null when none is linked, or \"hidden\" when the caller\n // lacks edit access to the agent.\n account:\n | {\n // Always `slack_workspace`\n type: \"slack_workspace\"\n team_id: string\n }\n | \"hidden\"\n | null\n permissions: Array<{\n target:\n | {\n // Always `slack_channel`\n type: \"slack_channel\"\n id: string\n }\n | {\n // Always `slack_all_public_channels`\n type: \"slack_all_public_channels\"\n }\n | {\n // Always `slack_all_channels`\n type: \"slack_all_channels\"\n }\n // Slack verbs granted on this target (\"read\" | \"write\" | \"reply_in_thread\" | \"react\").\n scopes: Array<string>\n }>\n }\n | {\n // Always `discord`\n type: \"discord\"\n name: string\n // The linked Discord server, null when none is linked, or \"hidden\" when the caller lacks\n // edit access to the agent.\n account:\n | {\n // Always `discord_server`\n type: \"discord_server\"\n id: string\n }\n | \"hidden\"\n | null\n permissions: Array<{\n target:\n | {\n // Always `discord_channel`\n type: \"discord_channel\"\n id: string\n }\n | {\n // Always `discord_all_channels`\n type: \"discord_all_channels\"\n }\n // Discord verbs granted on this target (\"read\" | \"write\" | \"reply_in_thread\" | \"react\").\n scopes: Array<string>\n }>\n }\n | {\n // Always `mcp_server`\n type: \"mcp_server\"\n name: string\n // The MCP server host, null when none is linked, or \"hidden\" when the caller lacks edit\n // access to the agent.\n account:\n | {\n // Always `mcp_server`\n type: \"mcp_server\"\n // The MCP server host (never the full URL, which can carry credentials or private path\n // components).\n server_host: string\n }\n | \"hidden\"\n | null\n // The tools the agent may call, null when all tools are enabled (including any the\n // server adds later), or \"hidden\" when the caller lacks edit access to the agent.\n enabled_tools:\n | Array<{ name: string; title: string | null }>\n | \"hidden\"\n | null\n // Whether read / write tool calls run without a confirmation step.\n run_tools_automatically: {\n // Whether read tool calls run without a confirmation step.\n read: boolean\n // Whether write tool calls run without a confirmation step.\n write: boolean\n }\n }\n | {\n // Always `custom_mcp_server`\n type: \"custom_mcp_server\"\n name: string\n // The MCP server host, null when none is linked, or \"hidden\" when the caller lacks edit\n // access to the agent.\n account:\n | {\n // Always `mcp_server`\n type: \"mcp_server\"\n // The MCP server host (never the full URL, which can carry credentials or private path\n // components).\n server_host: string\n }\n | \"hidden\"\n | null\n // The tools the agent may call, null when all tools are enabled (including any the\n // server adds later), or \"hidden\" when the caller lacks edit access to the agent.\n enabled_tools:\n | Array<{ name: string; title: string | null }>\n | \"hidden\"\n | null\n // Whether read / write tool calls run without a confirmation step.\n run_tools_automatically: {\n // Whether read tool calls run without a confirmation step.\n read: boolean\n // Whether write tool calls run without a confirmation step.\n write: boolean\n }\n }\n | {\n // The connector's machine name (e.g. \"github\", \"google_drive\").\n type:\n | \"asana\"\n | \"box\"\n | \"calendar\"\n | \"computer\"\n | \"confluence\"\n | \"cursor\"\n | \"feedback\"\n | \"files\"\n | \"fs\"\n | \"github\"\n | \"gmail\"\n | \"google_calendar\"\n | \"google_drive\"\n | \"google_drive_oauth\"\n | \"gtm\"\n | \"helpdocs\"\n | \"images\"\n | \"jira\"\n | \"linear\"\n | \"mail\"\n | \"marketplace\"\n | \"memory\"\n | \"microsoft_teams\"\n | \"microsoft_teams_oauth\"\n | \"outlook\"\n | \"salesforce\"\n | \"search\"\n | \"security\"\n | \"sharepoint\"\n | \"sharepoint_oauth\"\n | \"shopify\"\n | \"skills\"\n | \"system\"\n | \"test\"\n | \"web\"\n | \"webhooks\"\n | \"worker\"\n | \"workers\"\n name: string\n // The provider-side account identifier, null when none is linked, or \"hidden\" when the\n // caller lacks edit access to the agent.\n account: string | null\n permissions: Array<{\n target: { type: string; id: string }\n // The scopes granted on this target.\n scopes: Array<string>\n }>\n }\n >\n // \"active\" when the agent can run; \"disabled\" when it is paused (see pause_reason);\n // \"deleted\" when it has been removed.\n status: \"active\" | \"disabled\" | \"deleted\"\n // Why the agent is paused when status is \"disabled\" (e.g. \"credit_limit\",\n // \"disabled_from_workspace_settings\"); null when active.\n pause_reason:\n | \"run_limit\"\n | \"credit_limit\"\n | \"runaway_credit_usage\"\n | \"workspace_credit_limit\"\n | \"owner_allowance_limit\"\n | \"failure_limit\"\n | \"mark_session_failed_autopause\"\n | \"disabled_from_workspace_settings\"\n | \"disabled_from_workspace_settings_but_resumable\"\n | \"disabled_from_api\"\n | \"disabled_from_agent_settings\"\n | \"disabled_due_to_no_members_with_access\"\n | \"disabled_due_to_lack_of_editors\"\n | \"disabled_by_notion\"\n | \"internal_error\"\n | \"needs_user_review\"\n | \"tool_unavailable\"\n | null\n created_by: {\n // One of: `user`, `bot`\n type: \"user\" | \"bot\"\n // The ID of the user or bot that created this agent.\n id: IdResponse\n } | null\n agent_version: {\n // The ID of the published artifact.\n id: IdResponse\n // The version number.\n number: number\n // The ISO 8601 timestamp when this version was published.\n published_at: string\n } | null\n // Date and time when this agent was created.\n created_time: string\n // Date and time when this agent was last edited.\n last_edited_time: string\n // ISO 8601 timestamp of the agent's most recent run, null if it has never run, or\n // \"hidden\" when the caller lacks edit access to the agent.\n last_run_at: string | \"hidden\" | null\n // The per-agent credit limit that applies to this agent, null when uncapped, or \"hidden\"\n // when the caller lacks full access to the agent. This is the effective limit computed\n // at runtime, folding in both the agent's own limit and any workspace-admin default.\n credit_limit: number | \"hidden\" | null\n // The agent's configured triggers, each with a machine type, an enabled flag, and a\n // structured recurrence schedule when applicable.\n triggers: Array<{\n // Machine trigger type (e.g. \"notion.agent.mentioned\", \"recurrence\",\n // \"slack.reaction.added\").\n type: string\n // Whether this trigger is currently enabled.\n enabled: boolean\n // Structured recurrence cadence. Present only for recurrence triggers.\n schedule?: {\n // Base cadence unit (\"hour\" | \"day\" | \"week\" | \"month\" | \"year\").\n frequency: string\n // Multiplier on the frequency (e.g. every 2 weeks).\n interval: number\n // Days of the week the schedule runs (e.g. \"monday\"). Present for weekly cadences and\n // monthly weekday restrictions.\n weekdays?: Array<string>\n // Days of the month the schedule runs. Present for monthly monthday restrictions.\n monthdays?: Array<number>\n // Week-of-month ordinals for a monthly weekday restriction (e.g. [2, 3] for the 2nd and\n // 3rd occurrence); -1 means the last week.\n week_numbers?: Array<number>\n // Hour of day (0–23) the schedule runs.\n hour?: number\n // Minute of the hour (0–59) the schedule runs.\n minute?: number\n // IANA timezone (e.g. \"America/New_York\").\n timezone?: string\n // ISO 8601 timestamp the schedule starts from.\n start_date?: string\n // When the schedule stops, when it is bounded.\n end?:\n | {\n // Always `date`\n type: \"date\"\n // ISO 8601 timestamp when the schedule stops.\n end_at: string\n }\n | {\n // Always `count`\n type: \"count\"\n // Number of occurrences after which the schedule stops.\n occurrences: number\n }\n }\n // Remaining per-type trigger configuration (e.g. watched channel ids, reaction config),\n // keys in snake_case. Present only when the trigger carries such state.\n config?: Record<string, Record<string, never>>\n }>\n // The agent's inline instructions when verbose=true, or null when its instructions are\n // stored on a page.\n instructions?: string | null\n }\n | {\n // Always `agent`\n object: \"agent\"\n // Always `notion_ai`\n id: \"notion_ai\"\n // Always `notion_ai`\n agent_type: \"notion_ai\"\n name: string\n description: null\n instructions_page_id: null\n icon:\n | PageIconResponse\n | {\n // Type of icon. In this case, a custom agent avatar.\n type: \"custom_agent_avatar\"\n // The static and animated URLs for the agent avatar.\n custom_agent_avatar: {\n // The URL of the static custom agent avatar.\n static_url: string\n // The URL of the animated custom agent avatar.\n animated_url: string\n }\n }\n model:\n | {\n // Always `auto`\n mode: \"auto\"\n }\n | {\n // Always `pinned`\n mode: \"pinned\"\n // The public model this agent maps to (e.g. \"claude-sonnet-5\"), or null for a\n // pre-release / early-access model.\n id: string | null\n }\n connections: Array<\n | {\n // Always `notion`\n type: \"notion\"\n name: string\n account: null\n permissions: Array<{\n target:\n | {\n // Always `page`\n type: \"page\"\n id: string\n }\n | {\n // Always `database_property`\n type: \"database_property\"\n data_source_id: string\n property_id: string\n }\n | {\n // Always `agent`\n type: \"agent\"\n id: string\n }\n | {\n // Always `workspace`\n type: \"workspace\"\n }\n | {\n // Always `owner_private_pages`\n type: \"owner_private_pages\"\n }\n | {\n // Always `web_search`\n type: \"web_search\"\n // Domains web search is restricted to, or null when unrestricted.\n allowed_domains: Array<string> | null\n }\n | {\n // Always `notion_help_docs_search`\n type: \"notion_help_docs_search\"\n }\n // Content roles (\"reader\" | \"comment_only\" | \"read_and_write\" | \"editor\") for scoped\n // targets, or search verbs (\"allow\" | \"disallow\") for the search targets.\n scopes: Array<string>\n }>\n }\n | {\n // Always `slack`\n type: \"slack\"\n name: string\n // The linked Slack workspace, null when none is linked, or \"hidden\" when the caller\n // lacks edit access to the agent.\n account:\n | {\n // Always `slack_workspace`\n type: \"slack_workspace\"\n team_id: string\n }\n | \"hidden\"\n | null\n permissions: Array<{\n target:\n | {\n // Always `slack_channel`\n type: \"slack_channel\"\n id: string\n }\n | {\n // Always `slack_all_public_channels`\n type: \"slack_all_public_channels\"\n }\n | {\n // Always `slack_all_channels`\n type: \"slack_all_channels\"\n }\n // Slack verbs granted on this target (\"read\" | \"write\" | \"reply_in_thread\" | \"react\").\n scopes: Array<string>\n }>\n }\n | {\n // Always `discord`\n type: \"discord\"\n name: string\n // The linked Discord server, null when none is linked, or \"hidden\" when the caller lacks\n // edit access to the agent.\n account:\n | {\n // Always `discord_server`\n type: \"discord_server\"\n id: string\n }\n | \"hidden\"\n | null\n permissions: Array<{\n target:\n | {\n // Always `discord_channel`\n type: \"discord_channel\"\n id: string\n }\n | {\n // Always `discord_all_channels`\n type: \"discord_all_channels\"\n }\n // Discord verbs granted on this target (\"read\" | \"write\" | \"reply_in_thread\" | \"react\").\n scopes: Array<string>\n }>\n }\n | {\n // Always `mcp_server`\n type: \"mcp_server\"\n name: string\n // The MCP server host, null when none is linked, or \"hidden\" when the caller lacks edit\n // access to the agent.\n account:\n | {\n // Always `mcp_server`\n type: \"mcp_server\"\n // The MCP server host (never the full URL, which can carry credentials or private path\n // components).\n server_host: string\n }\n | \"hidden\"\n | null\n // The tools the agent may call, null when all tools are enabled (including any the\n // server adds later), or \"hidden\" when the caller lacks edit access to the agent.\n enabled_tools:\n | Array<{ name: string; title: string | null }>\n | \"hidden\"\n | null\n // Whether read / write tool calls run without a confirmation step.\n run_tools_automatically: {\n // Whether read tool calls run without a confirmation step.\n read: boolean\n // Whether write tool calls run without a confirmation step.\n write: boolean\n }\n }\n | {\n // Always `custom_mcp_server`\n type: \"custom_mcp_server\"\n name: string\n // The MCP server host, null when none is linked, or \"hidden\" when the caller lacks edit\n // access to the agent.\n account:\n | {\n // Always `mcp_server`\n type: \"mcp_server\"\n // The MCP server host (never the full URL, which can carry credentials or private path\n // components).\n server_host: string\n }\n | \"hidden\"\n | null\n // The tools the agent may call, null when all tools are enabled (including any the\n // server adds later), or \"hidden\" when the caller lacks edit access to the agent.\n enabled_tools:\n | Array<{ name: string; title: string | null }>\n | \"hidden\"\n | null\n // Whether read / write tool calls run without a confirmation step.\n run_tools_automatically: {\n // Whether read tool calls run without a confirmation step.\n read: boolean\n // Whether write tool calls run without a confirmation step.\n write: boolean\n }\n }\n | {\n // The connector's machine name (e.g. \"github\", \"google_drive\").\n type:\n | \"asana\"\n | \"box\"\n | \"calendar\"\n | \"computer\"\n | \"confluence\"\n | \"cursor\"\n | \"feedback\"\n | \"files\"\n | \"fs\"\n | \"github\"\n | \"gmail\"\n | \"google_calendar\"\n | \"google_drive\"\n | \"google_drive_oauth\"\n | \"gtm\"\n | \"helpdocs\"\n | \"images\"\n | \"jira\"\n | \"linear\"\n | \"mail\"\n | \"marketplace\"\n | \"memory\"\n | \"microsoft_teams\"\n | \"microsoft_teams_oauth\"\n | \"outlook\"\n | \"salesforce\"\n | \"search\"\n | \"security\"\n | \"sharepoint\"\n | \"sharepoint_oauth\"\n | \"shopify\"\n | \"skills\"\n | \"system\"\n | \"test\"\n | \"web\"\n | \"webhooks\"\n | \"worker\"\n | \"workers\"\n name: string\n // The provider-side account identifier, null when none is linked, or \"hidden\" when the\n // caller lacks edit access to the agent.\n account: string | null\n permissions: Array<{\n target: { type: string; id: string }\n // The scopes granted on this target.\n scopes: Array<string>\n }>\n }\n >\n // Always `active`\n status: \"active\"\n pause_reason: null\n created_by: null\n agent_version: null\n created_time: null\n last_edited_time: null\n last_run_at: null\n credit_limit: null\n triggers: Array<{\n // Machine trigger type (e.g. \"notion.agent.mentioned\", \"recurrence\",\n // \"slack.reaction.added\").\n type: string\n // Whether this trigger is currently enabled.\n enabled: boolean\n // Structured recurrence cadence. Present only for recurrence triggers.\n schedule?: {\n // Base cadence unit (\"hour\" | \"day\" | \"week\" | \"month\" | \"year\").\n frequency: string\n // Multiplier on the frequency (e.g. every 2 weeks).\n interval: number\n // Days of the week the schedule runs (e.g. \"monday\"). Present for weekly cadences and\n // monthly weekday restrictions.\n weekdays?: Array<string>\n // Days of the month the schedule runs. Present for monthly monthday restrictions.\n monthdays?: Array<number>\n // Week-of-month ordinals for a monthly weekday restriction (e.g. [2, 3] for the 2nd and\n // 3rd occurrence); -1 means the last week.\n week_numbers?: Array<number>\n // Hour of day (0–23) the schedule runs.\n hour?: number\n // Minute of the hour (0–59) the schedule runs.\n minute?: number\n // IANA timezone (e.g. \"America/New_York\").\n timezone?: string\n // ISO 8601 timestamp the schedule starts from.\n start_date?: string\n // When the schedule stops, when it is bounded.\n end?:\n | {\n // Always `date`\n type: \"date\"\n // ISO 8601 timestamp when the schedule stops.\n end_at: string\n }\n | {\n // Always `count`\n type: \"count\"\n // Number of occurrences after which the schedule stops.\n occurrences: number\n }\n }\n // Remaining per-type trigger configuration (e.g. watched channel ids, reaction config),\n // keys in snake_case. Present only when the trigger carries such state.\n config?: Record<string, Record<string, never>>\n }>\n }\n >\n has_more: boolean\n next_cursor: string | null\n}\n\n/**\n * Query agents\n */\nexport const queryAgents = {\n method: \"post\",\n pathParams: [],\n queryParams: [],\n bodyParams: [\n \"query\",\n \"filter\",\n \"sorts\",\n \"start_cursor\",\n \"page_size\",\n \"verbose\",\n \"include_deleted\",\n ],\n\n path: (): string => `agents/query`,\n} as const\n\ntype GetAgentPathParameters = {\n // The agent ID (a UUID), or `notion_ai` for the personal agent. Endpoint-specific\n // restrictions still apply.\n agent_id: IdRequest | \"notion_ai\" | \"33333333-3333-3333-3333-333333333333\"\n}\n\ntype GetAgentQueryParameters = {\n // Whether to include the agent's inline instructions. Defaults to false.\n verbose?: boolean\n}\n\nexport type GetAgentParameters = GetAgentPathParameters &\n GetAgentQueryParameters\n\nexport type GetAgentResponse = {\n // Always `agent`\n object: \"agent\"\n id: IdResponse | \"notion_ai\"\n // What kind of agent this is: \"notion_ai\" is the personal agent; \"custom_agent\" is a\n // standalone agent you chat with; \"autofill_custom_agent\" fills a database property;\n // \"external\" runs through an external provider.\n agent_type:\n | \"notion_ai\"\n | \"custom_agent\"\n | \"autofill_custom_agent\"\n | \"external\"\n name: string\n description: string | null\n instructions_page_id: IdResponse | null\n icon:\n | PageIconResponse\n | {\n // Type of icon. In this case, a custom agent avatar.\n type: \"custom_agent_avatar\"\n // The static and animated URLs for the agent avatar.\n custom_agent_avatar: {\n // The URL of the static custom agent avatar.\n static_url: string\n // The URL of the animated custom agent avatar.\n animated_url: string\n }\n }\n | null\n // The model the agent runs on: auto (Notion selects) or a pinned model.\n model:\n | {\n // Always `auto`\n mode: \"auto\"\n }\n | {\n // Always `pinned`\n mode: \"pinned\"\n // The public model this agent maps to (e.g. \"claude-sonnet-5\"), or null for a\n // pre-release / early-access model.\n id: string | null\n }\n // Integrations the agent is connected to (Notion, Slack, Discord, MCP servers, and other\n // connectors), each with an account and per-target permissions.\n connections: Array<\n | {\n // Always `notion`\n type: \"notion\"\n name: string\n account: null\n permissions: Array<{\n target:\n | {\n // Always `page`\n type: \"page\"\n id: string\n }\n | {\n // Always `database_property`\n type: \"database_property\"\n data_source_id: string\n property_id: string\n }\n | {\n // Always `agent`\n type: \"agent\"\n id: string\n }\n | {\n // Always `workspace`\n type: \"workspace\"\n }\n | {\n // Always `owner_private_pages`\n type: \"owner_private_pages\"\n }\n | {\n // Always `web_search`\n type: \"web_search\"\n // Domains web search is restricted to, or null when unrestricted.\n allowed_domains: Array<string> | null\n }\n | {\n // Always `notion_help_docs_search`\n type: \"notion_help_docs_search\"\n }\n // Content roles (\"reader\" | \"comment_only\" | \"read_and_write\" | \"editor\") for scoped\n // targets, or search verbs (\"allow\" | \"disallow\") for the search targets.\n scopes: Array<string>\n }>\n }\n | {\n // Always `slack`\n type: \"slack\"\n name: string\n // The linked Slack workspace, null when none is linked, or \"hidden\" when the caller\n // lacks edit access to the agent.\n account:\n | {\n // Always `slack_workspace`\n type: \"slack_workspace\"\n team_id: string\n }\n | \"hidden\"\n | null\n permissions: Array<{\n target:\n | {\n // Always `slack_channel`\n type: \"slack_channel\"\n id: string\n }\n | {\n // Always `slack_all_public_channels`\n type: \"slack_all_public_channels\"\n }\n | {\n // Always `slack_all_channels`\n type: \"slack_all_channels\"\n }\n // Slack verbs granted on this target (\"read\" | \"write\" | \"reply_in_thread\" | \"react\").\n scopes: Array<string>\n }>\n }\n | {\n // Always `discord`\n type: \"discord\"\n name: string\n // The linked Discord server, null when none is linked, or \"hidden\" when the caller lacks\n // edit access to the agent.\n account:\n | {\n // Always `discord_server`\n type: \"discord_server\"\n id: string\n }\n | \"hidden\"\n | null\n permissions: Array<{\n target:\n | {\n // Always `discord_channel`\n type: \"discord_channel\"\n id: string\n }\n | {\n // Always `discord_all_channels`\n type: \"discord_all_channels\"\n }\n // Discord verbs granted on this target (\"read\" | \"write\" | \"reply_in_thread\" | \"react\").\n scopes: Array<string>\n }>\n }\n | {\n // Always `mcp_server`\n type: \"mcp_server\"\n name: string\n // The MCP server host, null when none is linked, or \"hidden\" when the caller lacks edit\n // access to the agent.\n account:\n | {\n // Always `mcp_server`\n type: \"mcp_server\"\n // The MCP server host (never the full URL, which can carry credentials or private path\n // components).\n server_host: string\n }\n | \"hidden\"\n | null\n // The tools the agent may call, null when all tools are enabled (including any the\n // server adds later), or \"hidden\" when the caller lacks edit access to the agent.\n enabled_tools:\n | Array<{ name: string; title: string | null }>\n | \"hidden\"\n | null\n // Whether read / write tool calls run without a confirmation step.\n run_tools_automatically: {\n // Whether read tool calls run without a confirmation step.\n read: boolean\n // Whether write tool calls run without a confirmation step.\n write: boolean\n }\n }\n | {\n // Always `custom_mcp_server`\n type: \"custom_mcp_server\"\n name: string\n // The MCP server host, null when none is linked, or \"hidden\" when the caller lacks edit\n // access to the agent.\n account:\n | {\n // Always `mcp_server`\n type: \"mcp_server\"\n // The MCP server host (never the full URL, which can carry credentials or private path\n // components).\n server_host: string\n }\n | \"hidden\"\n | null\n // The tools the agent may call, null when all tools are enabled (including any the\n // server adds later), or \"hidden\" when the caller lacks edit access to the agent.\n enabled_tools:\n | Array<{ name: string; title: string | null }>\n | \"hidden\"\n | null\n // Whether read / write tool calls run without a confirmation step.\n run_tools_automatically: {\n // Whether read tool calls run without a confirmation step.\n read: boolean\n // Whether write tool calls run without a confirmation step.\n write: boolean\n }\n }\n | {\n // The connector's machine name (e.g. \"github\", \"google_drive\").\n type:\n | \"asana\"\n | \"box\"\n | \"calendar\"\n | \"computer\"\n | \"confluence\"\n | \"cursor\"\n | \"feedback\"\n | \"files\"\n | \"fs\"\n | \"github\"\n | \"gmail\"\n | \"google_calendar\"\n | \"google_drive\"\n | \"google_drive_oauth\"\n | \"gtm\"\n | \"helpdocs\"\n | \"images\"\n | \"jira\"\n | \"linear\"\n | \"mail\"\n | \"marketplace\"\n | \"memory\"\n | \"microsoft_teams\"\n | \"microsoft_teams_oauth\"\n | \"outlook\"\n | \"salesforce\"\n | \"search\"\n | \"security\"\n | \"sharepoint\"\n | \"sharepoint_oauth\"\n | \"shopify\"\n | \"skills\"\n | \"system\"\n | \"test\"\n | \"web\"\n | \"webhooks\"\n | \"worker\"\n | \"workers\"\n name: string\n // The provider-side account identifier, null when none is linked, or \"hidden\" when the\n // caller lacks edit access to the agent.\n account: string | null\n permissions: Array<{\n target: { type: string; id: string }\n // The scopes granted on this target.\n scopes: Array<string>\n }>\n }\n >\n // \"active\" when the agent can run; \"disabled\" when it is paused (see pause_reason);\n // \"deleted\" when it has been removed.\n status: \"active\" | \"disabled\" | \"deleted\"\n // Why the agent is paused when status is \"disabled\" (e.g. \"credit_limit\",\n // \"disabled_from_workspace_settings\"); null when active.\n pause_reason:\n | \"run_limit\"\n | \"credit_limit\"\n | \"runaway_credit_usage\"\n | \"workspace_credit_limit\"\n | \"owner_allowance_limit\"\n | \"failure_limit\"\n | \"mark_session_failed_autopause\"\n | \"disabled_from_workspace_settings\"\n | \"disabled_from_workspace_settings_but_resumable\"\n | \"disabled_from_api\"\n | \"disabled_from_agent_settings\"\n | \"disabled_due_to_no_members_with_access\"\n | \"disabled_due_to_lack_of_editors\"\n | \"disabled_by_notion\"\n | \"internal_error\"\n | \"needs_user_review\"\n | \"tool_unavailable\"\n | null\n created_by: {\n // Always `user`\n object: \"user\"\n // Always `user`\n type: \"user\"\n // The ID of the user that created this agent.\n id: IdResponse\n } | null\n version: {\n // The ID of the published artifact.\n id: IdResponse\n // The version number.\n number: number\n // The ISO 8601 timestamp when this version was published.\n published_at: string\n } | null\n agent_version: {\n // The ID of the published artifact.\n id: IdResponse\n // The version number.\n number: number\n // The ISO 8601 timestamp when this version was published.\n published_at: string\n } | null\n // Whether the draft has edits not yet in the published version, or \"hidden\" when the\n // caller lacks edit access to the agent.\n has_unpublished_changes: boolean | \"hidden\"\n // ISO 8601 timestamp of the agent's most recent run, null if it has never run, or\n // \"hidden\" when the caller lacks edit access to the agent.\n last_run_time: string | \"hidden\" | null\n // ISO 8601 timestamp of the agent's most recent run, null if it has never run, or\n // \"hidden\" when the caller lacks edit access to the agent.\n last_run_at: string | \"hidden\" | null\n // The per-agent credit limit that applies to this agent, null when uncapped, or \"hidden\"\n // when the caller lacks full access to the agent. This is the effective limit computed\n // at runtime, folding in both the agent's own limit and any workspace-admin default.\n credit_limit: number | \"hidden\" | null\n // The agent's configured triggers, each with a machine type, an enabled flag, and (for\n // recurrence triggers) a structured schedule.\n triggers: Array<{\n // Machine trigger type (e.g. \"notion.agent.mentioned\", \"recurrence\",\n // \"slack.reaction.added\").\n type: string\n // Whether this trigger is currently enabled.\n enabled: boolean\n // Structured recurrence cadence. Present only for recurrence triggers.\n schedule?: {\n // Base cadence unit (\"hour\" | \"day\" | \"week\" | \"month\" | \"year\").\n frequency: string\n // Multiplier on the frequency (e.g. every 2 weeks).\n interval: number\n // Days of the week the schedule runs (e.g. \"monday\"). Present for weekly cadences and\n // monthly weekday restrictions.\n weekdays?: Array<string>\n // Days of the month the schedule runs. Present for monthly monthday restrictions.\n monthdays?: Array<number>\n // Week-of-month ordinals for a monthly weekday restriction (e.g. [2, 3] for the 2nd and\n // 3rd occurrence); -1 means the last week.\n week_numbers?: Array<number>\n // Hour of day (0–23) the schedule runs.\n hour?: number\n // Minute of the hour (0–59) the schedule runs.\n minute?: number\n // IANA timezone (e.g. \"America/New_York\").\n timezone?: string\n // ISO 8601 timestamp the schedule starts from.\n start_date?: string\n // When the schedule stops, when it is bounded.\n end?:\n | {\n // Always `date`\n type: \"date\"\n // ISO 8601 timestamp when the schedule stops.\n end_at: string\n }\n | {\n // Always `count`\n type: \"count\"\n // Number of occurrences after which the schedule stops.\n occurrences: number\n }\n }\n // Remaining per-type trigger configuration (e.g. watched channel ids, reaction config),\n // keys in snake_case. Present only when the trigger carries such state.\n config?: Record<string, Record<string, never>>\n }>\n // Whether this agent is in the caller's personal favorites, or null when the caller has\n // no personal favorites scope.\n is_favorited: boolean | null\n // Date and time when this agent was created.\n created_time?: string\n // Date and time when this agent was last edited.\n last_edited_time?: string\n // The agent's inline instructions when verbose=true, or null when its instructions are\n // stored on a page.\n instructions?: string | null\n}\n\n/**\n * Get agent\n */\nexport const getAgent = {\n method: \"get\",\n pathParams: [\"agent_id\"],\n queryParams: [\"verbose\"],\n bodyParams: [],\n\n path: (p: GetAgentPathParameters): string => `agents/${p.agent_id}`,\n} as const\n\ntype DeleteAgentPathParameters = {\n // The agent ID (a UUID), or `notion_ai` for the personal agent. The personal agent\n // cannot be deleted.\n agent_id: IdRequest | \"notion_ai\" | \"33333333-3333-3333-3333-333333333333\"\n}\n\nexport type DeleteAgentParameters = DeleteAgentPathParameters\n\nexport type DeleteAgentResponse = {\n agent_id: IdResponse\n // Always \"deleted\": the agent has been soft-deleted (recoverable).\n status: \"deleted\"\n // ISO 8601 timestamp of when the agent was deleted.\n deleted_at: string\n}\n\n/**\n * Delete agent\n */\nexport const deleteAgent = {\n method: \"delete\",\n pathParams: [\"agent_id\"],\n queryParams: [],\n bodyParams: [],\n\n path: (p: DeleteAgentPathParameters): string => `agents/${p.agent_id}`,\n} as const\n\ntype GetInsightsPathParameters = {\n // The agent ID (a UUID), or `notion_ai` for the personal agent. Endpoint-specific\n // restrictions still apply.\n agent_id: IdRequest | \"notion_ai\" | \"33333333-3333-3333-3333-333333333333\"\n}\n\ntype GetInsightsQueryParameters = {\n // Start of the insights window, as an epoch timestamp in seconds. Must be supplied\n // together with `end_time`; if either is omitted the window defaults to the current\n // billing period.\n start_time?: number\n // End of the insights window, as an epoch timestamp in seconds. Must be supplied\n // together with `start_time`; if either is omitted the window defaults to the current\n // billing period.\n end_time?: number\n}\n\nexport type GetInsightsParameters = GetInsightsPathParameters &\n GetInsightsQueryParameters\n\nexport type GetInsightsResponse = {\n // Always `agent_insights`\n object: \"agent_insights\"\n id: IdResponse | \"notion_ai\"\n name: string\n // One of: `notion_ai`, `custom_agent`, `autofill_custom_agent`\n agent_type: \"notion_ai\" | \"custom_agent\" | \"autofill_custom_agent\"\n // One of: `active`, `disabled`, `deleted`\n status: \"active\" | \"disabled\" | \"deleted\"\n pause_reason:\n | \"run_limit\"\n | \"credit_limit\"\n | \"runaway_credit_usage\"\n | \"workspace_credit_limit\"\n | \"owner_allowance_limit\"\n | \"failure_limit\"\n | \"mark_session_failed_autopause\"\n | \"disabled_from_workspace_settings\"\n | \"disabled_from_workspace_settings_but_resumable\"\n | \"disabled_from_api\"\n | \"disabled_from_agent_settings\"\n | \"disabled_due_to_no_members_with_access\"\n | \"disabled_due_to_lack_of_editors\"\n | \"disabled_by_notion\"\n | \"internal_error\"\n | \"needs_user_review\"\n | \"tool_unavailable\"\n | null\n created_by: {\n id: string\n // One of: `user`, `bot`\n type: \"user\" | \"bot\"\n } | null\n // Premium AI credits consumed by this agent within the window.\n total_credits_used: number\n // Enforced per-agent credit limit; null when none is configured, and \"hidden\" when the\n // caller lacks full access to the agent.\n credit_limit: number | \"hidden\" | null\n // Number of runs recorded for this agent within the window.\n runs_completed: number\n}\n\n/**\n * Get agent insights\n */\nexport const getInsights = {\n method: \"get\",\n pathParams: [\"agent_id\"],\n queryParams: [\"start_time\", \"end_time\"],\n bodyParams: [],\n\n path: (p: GetInsightsPathParameters): string =>\n `agents/${p.agent_id}/insights`,\n} as const\n\ntype UpdateAgentStatusPathParameters = {\n // The agent ID (a UUID), or `notion_ai` for the personal agent. Endpoint-specific\n // restrictions still apply.\n agent_id: IdRequest | \"notion_ai\" | \"33333333-3333-3333-3333-333333333333\"\n}\n\ntype UpdateAgentStatusBodyParameters = {\n // Set to \"active\" to re-enable an agent that was disabled through this API, or\n // \"disabled\" to turn off a running agent.\n status: \"active\" | \"disabled\"\n}\n\nexport type UpdateAgentStatusParameters = UpdateAgentStatusPathParameters &\n UpdateAgentStatusBodyParameters\n\nexport type UpdateAgentStatusResponse = {\n agent_id: IdResponse\n // \"active\" when the agent can run; \"disabled\" when it is paused (see pause_reason);\n // \"deleted\" when it has been removed.\n status: \"active\" | \"disabled\" | \"deleted\"\n // Why the agent is paused when status is \"disabled\" (e.g. \"disabled_from_api\",\n // \"credit_limit\"); null when active or deleted.\n pause_reason:\n | \"run_limit\"\n | \"credit_limit\"\n | \"runaway_credit_usage\"\n | \"workspace_credit_limit\"\n | \"owner_allowance_limit\"\n | \"failure_limit\"\n | \"mark_session_failed_autopause\"\n | \"disabled_from_workspace_settings\"\n | \"disabled_from_workspace_settings_but_resumable\"\n | \"disabled_from_api\"\n | \"disabled_from_agent_settings\"\n | \"disabled_due_to_no_members_with_access\"\n | \"disabled_due_to_lack_of_editors\"\n | \"disabled_by_notion\"\n | \"internal_error\"\n | \"needs_user_review\"\n | \"tool_unavailable\"\n | null\n // ISO 8601 timestamp of when the agent was last edited.\n last_edited_time: string\n}\n\n/**\n * Update agent status\n */\nexport const updateAgentStatus = {\n method: \"patch\",\n pathParams: [\"agent_id\"],\n queryParams: [],\n bodyParams: [\"status\"],\n\n path: (p: UpdateAgentStatusPathParameters): string =>\n `agents/${p.agent_id}/status`,\n} as const\n\ntype UpdateAgentCreditLimitPathParameters = {\n // The ID of the custom agent (a UUID). The personal agent (Notion AI) is not supported\n // by this endpoint.\n agent_id: IdRequest | \"notion_ai\" | \"33333333-3333-3333-3333-333333333333\"\n}\n\ntype UpdateAgentCreditLimitBodyParameters = {\n // The per-agent credit limit as a non-negative integer, or null to clear the limit.\n credit_limit: number | null\n}\n\nexport type UpdateAgentCreditLimitParameters =\n UpdateAgentCreditLimitPathParameters & UpdateAgentCreditLimitBodyParameters\n\nexport type UpdateAgentCreditLimitResponse = {\n agent_id: IdResponse\n // The agent's editor-set per-agent credit limit; null when no limit applies.\n credit_limit: number | null\n // ISO 8601 timestamp of when the agent was last edited.\n last_edited_time: string\n}\n\n/**\n * Update agent credit limit\n */\nexport const updateAgentCreditLimit = {\n method: \"patch\",\n pathParams: [\"agent_id\"],\n queryParams: [],\n bodyParams: [\"credit_limit\"],\n\n path: (p: UpdateAgentCreditLimitPathParameters): string =>\n `agents/${p.agent_id}/credit_limit`,\n} as const\n\ntype AgentBatchBodyParameters = {\n // The operations to apply, at least one and at most 100. Operations are applied in the\n // order given, and the batch is not atomic: each operation succeeds or fails on its own,\n // and per-operation outcomes are reported in the async task's result.\n operations: Array<\n | {\n // Enable or disable one agent, equivalent to `PATCH /v1/agents/:agent_id/status`.\n action: \"update_status\"\n // The agent ID (a UUID), or `notion_ai` for the personal agent. Endpoint-specific\n // restrictions still apply.\n agent_id:\n | IdRequest\n | \"notion_ai\"\n | \"33333333-3333-3333-3333-333333333333\"\n // The status to apply to this agent.\n fields: {\n // \"active\" to re-enable an agent disabled through this API, or \"disabled\" to turn it\n // off.\n status: \"active\" | \"disabled\"\n }\n }\n | {\n // Set or clear one agent's credit limit, equivalent to `PATCH\n // /v1/agents/:agent_id/credit_limit`. Requires full access to the agent.\n action: \"update_credit_limit\"\n // The agent ID (a UUID), or `notion_ai` for the personal agent. Endpoint-specific\n // restrictions still apply.\n agent_id:\n | IdRequest\n | \"notion_ai\"\n | \"33333333-3333-3333-3333-333333333333\"\n // The credit limit to apply to this agent.\n fields: {\n // The per-agent credit limit as a non-negative integer, or null to clear the limit.\n credit_limit: number | null\n }\n }\n | {\n // Soft-delete one agent, equivalent to `DELETE /v1/agents/:agent_id`.\n action: \"delete\"\n // The agent ID (a UUID), or `notion_ai` for the personal agent. Endpoint-specific\n // restrictions still apply.\n agent_id:\n | IdRequest\n | \"notion_ai\"\n | \"33333333-3333-3333-3333-333333333333\"\n }\n >\n}\n\nexport type AgentBatchParameters = AgentBatchBodyParameters\n\nexport type AgentBatchResponse = {\n object: \"async_task\"\n id: string\n status_url: string\n created_time: string\n operation: { surface: \"rest\" | \"mcp\"; name: string }\n status: \"queued\" | \"running\" | \"retrying\"\n poll_after_seconds: number\n}\n\n/**\n * Apply many agent operations\n */\nexport const agentBatch = {\n method: \"post\",\n pathParams: [],\n queryParams: [],\n bodyParams: [\"operations\"],\n\n path: (): string => `agents/batch`,\n} as const\n\ntype UpdateSessionBodyParameters =\n | {\n message: string\n agent_id?:\n | IdRequest\n | \"notion_ai\"\n | \"33333333-3333-3333-3333-333333333333\"\n session_id?: IdRequest\n attachments?: Array<{\n file_upload: { id: string }\n // Always `file_upload`\n type?: \"file_upload\"\n name?: string\n }>\n metadata?: Record<string, string>\n prompt_context?: string\n }\n | {\n session_id: IdRequest\n actions: Array<{\n action_id: IdRequest\n // One of: `approve`, `reject`\n option_id: \"approve\" | \"reject\"\n }>\n metadata?: Record<string, string>\n }\n | { session_id: IdRequest; continue_from: string }\n\nexport type UpdateSessionParameters = UpdateSessionBodyParameters\n\nexport type UpdateSessionResponse = {\n // Always `session`\n object: \"session\"\n id: string\n agent_id: string\n title: string\n // One of: `queued`, `in_progress`, `requires_action`, `completed`, `failed`, `canceled`,\n // `terminated`\n status:\n | \"queued\"\n | \"in_progress\"\n | \"requires_action\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"terminated\"\n created_at: string\n updated_at: string\n required_actions?: Array<{\n action_id: string\n title: string\n options: Array<{\n // One of: `approve`, `reject`\n id: \"approve\" | \"reject\"\n label: string\n }>\n }>\n error?: { code: string; message: string; retryable: boolean }\n}\n\n/**\n * Update a session\n */\nexport const updateSession = {\n method: \"post\",\n pathParams: [],\n queryParams: [],\n bodyParams: [\n \"message\",\n \"agent_id\",\n \"session_id\",\n \"attachments\",\n \"metadata\",\n \"prompt_context\",\n \"actions\",\n \"continue_from\",\n ],\n\n path: (): string => `sessions`,\n} as const\n\ntype RetrieveSessionPathParameters = {\n // The ID of the session to retrieve.\n session_id: IdRequest\n}\n\nexport type RetrieveSessionParameters = RetrieveSessionPathParameters\n\nexport type RetrieveSessionResponse = {\n // Always `session`\n object: \"session\"\n id: string\n agent_id: string\n title: string\n // One of: `queued`, `in_progress`, `requires_action`, `completed`, `failed`, `canceled`,\n // `terminated`\n status:\n | \"queued\"\n | \"in_progress\"\n | \"requires_action\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"terminated\"\n created_at: string\n updated_at: string\n created_by: {\n id: string\n // One of: `user`, `bot`\n type: \"user\" | \"bot\"\n }\n agent_version: { id: string; number: number; published_at: string } | null\n models:\n | {\n // Always `auto`\n type: \"auto\"\n }\n | {\n // Always `pinned`\n type: \"pinned\"\n ids: Array<string | null>\n }\n required_actions?: Array<{\n action_id: string\n title: string\n options: Array<{\n // One of: `approve`, `reject`\n id: \"approve\" | \"reject\"\n label: string\n }>\n }>\n error?: { code: string; message: string; retryable: boolean }\n trigger_type?: string\n type_labels?: Array<string> | null\n chat_user_emails?: Array<string> | null\n tool_types?: Array<string> | null\n tool_call_count?: number | null\n credits_used?: number | null\n runs_completed?: number | null\n message_count?: number | null\n}\n\n/**\n * Retrieve a session\n */\nexport const retrieveSession = {\n method: \"get\",\n pathParams: [\"session_id\"],\n queryParams: [],\n bodyParams: [],\n\n path: (p: RetrieveSessionPathParameters): string =>\n `sessions/${p.session_id}`,\n} as const\n\ntype QuerySessionsBodyParameters = {\n // A case-insensitive substring search over session titles.\n query?: string\n // A session property filter, or an and/or compound filter nested up to two levels deep.\n filter?:\n | SessionIdFilter\n | SessionAgentIdFilter\n | SessionStatusFilter\n | SessionTimestampFilter\n | {\n // Return sessions that match every child filter.\n and: Array<SessionNestedFilter>\n }\n | {\n // Return sessions that match any child filter.\n or: Array<SessionNestedFilter>\n }\n // Ordered sort precedence. Defaults to updated_at descending.\n sorts?: Array<{\n // One of: `created_at`, `updated_at`\n property: \"created_at\" | \"updated_at\"\n // One of: `ascending`, `descending`\n direction: \"ascending\" | \"descending\"\n }>\n // The continuation cursor returned by the previous page.\n start_cursor?: string | null\n // The number of sessions to return. Maximum: 100.\n page_size?: number\n}\n\nexport type QuerySessionsParameters = QuerySessionsBodyParameters\n\nexport type QuerySessionsResponse = {\n // Always `list`\n object: \"list\"\n // Always `session`\n type: \"session\"\n session: Record<string, never>\n // Sessions found in this bounded scan. Access filtering can leave this array empty while\n // has_more is true.\n results: Array<{\n // Always `session`\n object: \"session\"\n id: string\n agent_id: string\n title: string\n // One of: `queued`, `in_progress`, `requires_action`, `completed`, `failed`, `canceled`,\n // `terminated`\n status:\n | \"queued\"\n | \"in_progress\"\n | \"requires_action\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"terminated\"\n created_by: {\n id: string\n // One of: `user`, `bot`\n type: \"user\" | \"bot\"\n }\n agent_version: { id: string; number: number; published_at: string } | null\n models:\n | {\n // Always `auto`\n type: \"auto\"\n }\n | {\n // Always `pinned`\n type: \"pinned\"\n ids: Array<string | null>\n }\n created_at: string\n updated_at: string\n required_actions?: Array<{\n action_id: string\n title: string\n options: Array<{\n // One of: `approve`, `reject`\n id: \"approve\" | \"reject\"\n label: string\n }>\n }>\n error?: { code: string; message: string; retryable: boolean }\n trigger_type?: string\n type_labels?: Array<string> | null\n chat_user_emails?: Array<string> | null\n tool_types?: Array<string> | null\n tool_call_count?: number | null\n credits_used?: number | null\n runs_completed?: number | null\n message_count?: number | null\n }>\n // Whether more session candidates remain after this bounded scan.\n has_more: boolean\n // Pass this cursor as start_cursor when has_more is true, even when results is empty.\n next_cursor: string | null\n}\n\n/**\n * Query sessions\n */\nexport const querySessions = {\n method: \"post\",\n pathParams: [],\n queryParams: [],\n bodyParams: [\"query\", \"filter\", \"sorts\", \"start_cursor\", \"page_size\"],\n\n path: (): string => `sessions/query`,\n} as const\n\ntype QuerySessionEventsPathParameters = {\n // The ID of the session whose events should be queried.\n session_id: IdRequest\n}\n\ntype QuerySessionEventsBodyParameters = {\n // A session event property filter, or an and/or compound filter nested up to three\n // levels deep.\n filter?:\n | { property: \"id\"; string: { equals: string } }\n | {\n property: \"type\"\n event_type: {\n equals?:\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n in?: Array<\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n >\n }\n }\n | {\n property: \"sequence\"\n number: {\n greater_than?: number\n greater_than_or_equal_to?: number\n less_than?: number\n less_than_or_equal_to?: number\n }\n }\n | {\n property: \"created_at\"\n timestamp: {\n equals?: string\n before?: string\n after?: string\n on_or_before?: string\n on_or_after?: string\n }\n }\n | {\n and: Array<\n | { property: \"id\"; string: { equals: string } }\n | {\n property: \"type\"\n event_type: {\n equals?:\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n in?: Array<\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n >\n }\n }\n | {\n property: \"sequence\"\n number: {\n greater_than?: number\n greater_than_or_equal_to?: number\n less_than?: number\n less_than_or_equal_to?: number\n }\n }\n | {\n property: \"created_at\"\n timestamp: {\n equals?: string\n before?: string\n after?: string\n on_or_before?: string\n on_or_after?: string\n }\n }\n | {\n and: Array<\n | { property: \"id\"; string: { equals: string } }\n | {\n property: \"type\"\n event_type: {\n equals?:\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n in?: Array<\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n >\n }\n }\n | {\n property: \"sequence\"\n number: {\n greater_than?: number\n greater_than_or_equal_to?: number\n less_than?: number\n less_than_or_equal_to?: number\n }\n }\n | {\n property: \"created_at\"\n timestamp: {\n equals?: string\n before?: string\n after?: string\n on_or_before?: string\n on_or_after?: string\n }\n }\n | {\n and: Array<\n | { property: \"id\"; string: { equals: string } }\n | {\n property: \"type\"\n event_type: {\n equals?:\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n in?: Array<\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n >\n }\n }\n | {\n property: \"sequence\"\n number: {\n greater_than?: number\n greater_than_or_equal_to?: number\n less_than?: number\n less_than_or_equal_to?: number\n }\n }\n | {\n property: \"created_at\"\n timestamp: {\n equals?: string\n before?: string\n after?: string\n on_or_before?: string\n on_or_after?: string\n }\n }\n >\n }\n | {\n or: Array<\n | { property: \"id\"; string: { equals: string } }\n | {\n property: \"type\"\n event_type: {\n equals?:\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n in?: Array<\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n >\n }\n }\n | {\n property: \"sequence\"\n number: {\n greater_than?: number\n greater_than_or_equal_to?: number\n less_than?: number\n less_than_or_equal_to?: number\n }\n }\n | {\n property: \"created_at\"\n timestamp: {\n equals?: string\n before?: string\n after?: string\n on_or_before?: string\n on_or_after?: string\n }\n }\n >\n }\n >\n }\n | {\n or: Array<\n | { property: \"id\"; string: { equals: string } }\n | {\n property: \"type\"\n event_type: {\n equals?:\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n in?: Array<\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n >\n }\n }\n | {\n property: \"sequence\"\n number: {\n greater_than?: number\n greater_than_or_equal_to?: number\n less_than?: number\n less_than_or_equal_to?: number\n }\n }\n | {\n property: \"created_at\"\n timestamp: {\n equals?: string\n before?: string\n after?: string\n on_or_before?: string\n on_or_after?: string\n }\n }\n | {\n and: Array<\n | { property: \"id\"; string: { equals: string } }\n | {\n property: \"type\"\n event_type: {\n equals?:\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n in?: Array<\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n >\n }\n }\n | {\n property: \"sequence\"\n number: {\n greater_than?: number\n greater_than_or_equal_to?: number\n less_than?: number\n less_than_or_equal_to?: number\n }\n }\n | {\n property: \"created_at\"\n timestamp: {\n equals?: string\n before?: string\n after?: string\n on_or_before?: string\n on_or_after?: string\n }\n }\n >\n }\n | {\n or: Array<\n | { property: \"id\"; string: { equals: string } }\n | {\n property: \"type\"\n event_type: {\n equals?:\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n in?: Array<\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n >\n }\n }\n | {\n property: \"sequence\"\n number: {\n greater_than?: number\n greater_than_or_equal_to?: number\n less_than?: number\n less_than_or_equal_to?: number\n }\n }\n | {\n property: \"created_at\"\n timestamp: {\n equals?: string\n before?: string\n after?: string\n on_or_before?: string\n on_or_after?: string\n }\n }\n >\n }\n >\n }\n >\n }\n | {\n or: Array<\n | { property: \"id\"; string: { equals: string } }\n | {\n property: \"type\"\n event_type: {\n equals?:\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n in?: Array<\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n >\n }\n }\n | {\n property: \"sequence\"\n number: {\n greater_than?: number\n greater_than_or_equal_to?: number\n less_than?: number\n less_than_or_equal_to?: number\n }\n }\n | {\n property: \"created_at\"\n timestamp: {\n equals?: string\n before?: string\n after?: string\n on_or_before?: string\n on_or_after?: string\n }\n }\n | {\n and: Array<\n | { property: \"id\"; string: { equals: string } }\n | {\n property: \"type\"\n event_type: {\n equals?:\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n in?: Array<\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n >\n }\n }\n | {\n property: \"sequence\"\n number: {\n greater_than?: number\n greater_than_or_equal_to?: number\n less_than?: number\n less_than_or_equal_to?: number\n }\n }\n | {\n property: \"created_at\"\n timestamp: {\n equals?: string\n before?: string\n after?: string\n on_or_before?: string\n on_or_after?: string\n }\n }\n | {\n and: Array<\n | { property: \"id\"; string: { equals: string } }\n | {\n property: \"type\"\n event_type: {\n equals?:\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n in?: Array<\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n >\n }\n }\n | {\n property: \"sequence\"\n number: {\n greater_than?: number\n greater_than_or_equal_to?: number\n less_than?: number\n less_than_or_equal_to?: number\n }\n }\n | {\n property: \"created_at\"\n timestamp: {\n equals?: string\n before?: string\n after?: string\n on_or_before?: string\n on_or_after?: string\n }\n }\n >\n }\n | {\n or: Array<\n | { property: \"id\"; string: { equals: string } }\n | {\n property: \"type\"\n event_type: {\n equals?:\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n in?: Array<\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n >\n }\n }\n | {\n property: \"sequence\"\n number: {\n greater_than?: number\n greater_than_or_equal_to?: number\n less_than?: number\n less_than_or_equal_to?: number\n }\n }\n | {\n property: \"created_at\"\n timestamp: {\n equals?: string\n before?: string\n after?: string\n on_or_before?: string\n on_or_after?: string\n }\n }\n >\n }\n >\n }\n | {\n or: Array<\n | { property: \"id\"; string: { equals: string } }\n | {\n property: \"type\"\n event_type: {\n equals?:\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n in?: Array<\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n >\n }\n }\n | {\n property: \"sequence\"\n number: {\n greater_than?: number\n greater_than_or_equal_to?: number\n less_than?: number\n less_than_or_equal_to?: number\n }\n }\n | {\n property: \"created_at\"\n timestamp: {\n equals?: string\n before?: string\n after?: string\n on_or_before?: string\n on_or_after?: string\n }\n }\n | {\n and: Array<\n | { property: \"id\"; string: { equals: string } }\n | {\n property: \"type\"\n event_type: {\n equals?:\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n in?: Array<\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n >\n }\n }\n | {\n property: \"sequence\"\n number: {\n greater_than?: number\n greater_than_or_equal_to?: number\n less_than?: number\n less_than_or_equal_to?: number\n }\n }\n | {\n property: \"created_at\"\n timestamp: {\n equals?: string\n before?: string\n after?: string\n on_or_before?: string\n on_or_after?: string\n }\n }\n >\n }\n | {\n or: Array<\n | { property: \"id\"; string: { equals: string } }\n | {\n property: \"type\"\n event_type: {\n equals?:\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n in?: Array<\n | \"user.message\"\n | \"agent.message\"\n | \"agent.thinking\"\n | \"agent.tool_use\"\n | \"agent.tool_result\"\n | \"session.status\"\n >\n }\n }\n | {\n property: \"sequence\"\n number: {\n greater_than?: number\n greater_than_or_equal_to?: number\n less_than?: number\n less_than_or_equal_to?: number\n }\n }\n | {\n property: \"created_at\"\n timestamp: {\n equals?: string\n before?: string\n after?: string\n on_or_before?: string\n on_or_after?: string\n }\n }\n >\n }\n >\n }\n >\n }\n // Ordered sort precedence. Defaults to sequence ascending.\n sorts?: Array<{\n // One of: `sequence`, `created_at`\n property: \"sequence\" | \"created_at\"\n // One of: `ascending`, `descending`\n direction: \"ascending\" | \"descending\"\n }>\n // The continuation cursor returned by the previous page.\n start_cursor?: string | null\n // The number of events to return. Maximum: 100.\n page_size?: number\n}\n\nexport type QuerySessionEventsParameters = QuerySessionEventsPathParameters &\n QuerySessionEventsBodyParameters\n\nexport type QuerySessionEventsResponse = {\n // Always `list`\n object: \"list\"\n // Always `session_event`\n type: \"session_event\"\n session_event: Record<string, never>\n results: Array<\n | {\n // Always `session_event`\n object: \"session_event\"\n id: string\n session_id: string\n sequence: number\n created_at: string\n // Always `user.message`\n type: \"user.message\"\n content: Array<\n | {\n // Always `text`\n type: \"text\"\n text: string\n }\n | {\n // Always `file`\n type: \"file\"\n name: string\n content_type: string\n url: string\n expiry_time?: string\n }\n >\n created_by: {\n id: string\n // One of: `user`, `bot`\n type: \"user\" | \"bot\"\n } | null\n metadata: Record<string, string> | null\n }\n | {\n // Always `session_event`\n object: \"session_event\"\n id: string\n session_id: string\n sequence: number\n created_at: string\n // Always `agent.message`\n type: \"agent.message\"\n content: Array<\n | {\n // Always `text`\n type: \"text\"\n text: string\n }\n | {\n // Always `file`\n type: \"file\"\n name: string\n content_type: string\n url: string\n expiry_time?: string\n }\n >\n created_by: {\n id: string\n // One of: `user`, `bot`\n type: \"user\" | \"bot\"\n } | null\n metadata: { model: string } | null\n }\n | {\n // Always `session_event`\n object: \"session_event\"\n id: string\n session_id: string\n sequence: number\n created_at: string\n // Always `agent.thinking`\n type: \"agent.thinking\"\n content: Array<{\n // Always `text`\n type: \"text\"\n text: string\n }>\n }\n | {\n // Always `session_event`\n object: \"session_event\"\n id: string\n session_id: string\n sequence: number\n created_at: string\n // Always `agent.tool_use`\n type: \"agent.tool_use\"\n tool_name: string\n }\n | {\n // Always `session_event`\n object: \"session_event\"\n id: string\n session_id: string\n sequence: number\n created_at: string\n // Always `agent.tool_result`\n type: \"agent.tool_result\"\n tool_use_id: string\n tool_name: string\n is_error: boolean\n }\n | {\n // Always `session_event`\n object: \"session_event\"\n id: string\n session_id: string\n sequence: number\n created_at: string\n // Always `session.status`\n type: \"session.status\"\n // One of: `requires_action`, `completed`, `failed`, `canceled`, `terminated`\n status:\n | \"requires_action\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"terminated\"\n required_actions?: Array<{\n action_id: string\n title: string\n options: Array<{\n // One of: `approve`, `reject`\n id: \"approve\" | \"reject\"\n label: string\n }>\n }>\n error?: { code: string; message: string; retryable: boolean }\n }\n >\n has_more: boolean\n next_cursor: string | null\n}\n\n/**\n * Query session events\n */\nexport const querySessionEvents = {\n method: \"post\",\n pathParams: [\"session_id\"],\n queryParams: [],\n bodyParams: [\"filter\", \"sorts\", \"start_cursor\", \"page_size\"],\n\n path: (p: QuerySessionEventsPathParameters): string =>\n `sessions/${p.session_id}/events/query`,\n} as const\n\ntype CancelSessionPathParameters = {\n // The ID of the session to cancel.\n session_id: IdRequest\n}\n\ntype CancelSessionBodyParameters = {\n // A session event identifying the turn to cancel. If omitted, cancels the current\n // nonterminal turn.\n event_id?: string\n}\n\nexport type CancelSessionParameters = CancelSessionPathParameters &\n CancelSessionBodyParameters\n\nexport type CancelSessionResponse = {\n // Always `session`\n object: \"session\"\n id: string\n agent_id: string\n title: string\n // One of: `queued`, `in_progress`, `requires_action`, `completed`, `failed`, `canceled`,\n // `terminated`\n status:\n | \"queued\"\n | \"in_progress\"\n | \"requires_action\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"terminated\"\n created_at: string\n updated_at: string\n required_actions?: Array<{\n action_id: string\n title: string\n options: Array<{\n // One of: `approve`, `reject`\n id: \"approve\" | \"reject\"\n label: string\n }>\n }>\n error?: { code: string; message: string; retryable: boolean }\n}\n\n/**\n * Cancel a session\n */\nexport const cancelSession = {\n method: \"post\",\n pathParams: [\"session_id\"],\n queryParams: [],\n bodyParams: [\"event_id\"],\n\n path: (p: CancelSessionPathParameters): string =>\n `sessions/${p.session_id}/cancel`,\n} as const\n\ntype ChatWithAgentPathParameters = {\n // The ID of the agent to chat with. Use a UUID for custom agents or `notion_ai` for\n // Notion Agent (personal agent); the reserved UUID\n // `33333333-3333-3333-3333-333333333333` remains supported for backward compatibility.\n agent_id: IdRequest | \"notion_ai\" | \"33333333-3333-3333-3333-333333333333\"\n}\n\ntype ChatWithAgentQueryParameters = {\n // Whether to include agent thinking and structured message content parts. Defaults to\n // false.\n verbose?: boolean\n}\n\ntype ChatWithAgentBodyParameters = {\n // The message to send to the agent.\n message?: string\n // An array of file uploads to attach to this chat turn. Use the File Upload APIs to\n // create uploads and pass their IDs here.\n attachments?: Array<{\n // ID of a FileUpload object that has the status `uploaded`.\n file_upload: {\n // ID of a FileUpload object that has the status `uploaded`.\n id: string\n }\n // The type of the attachment. Only supports \"file_upload\".\n type?: \"file_upload\"\n // An optional display name override for the attachment.\n name?: string\n }>\n // Optional caller-provided string metadata persisted with the user message. user_id is\n // used for lifecycle correlation and does not change authorization.\n metadata?: Record<string, string>\n // Additional caller-provided context for the agent to consider while responding.\n prompt_context?: string\n /** @deprecated */\n\n // Deprecated. Use POST /v1/threads/:thread_id/messages to continue an existing thread.\n // If not provided, a new thread will be created.\n thread_id?: IdRequest\n}\n\nexport type ChatWithAgentParameters = ChatWithAgentPathParameters &\n ChatWithAgentQueryParameters &\n ChatWithAgentBodyParameters\n\nexport type ChatWithAgentResponse = {\n // Always `chat.invocation`\n object: \"chat.invocation\"\n agent_id: string\n thread_id: string\n invocation_id: string\n // Always `pending`\n status: \"pending\"\n}\n\n/**\n * Chat with agent\n */\nexport const chatWithAgent = {\n method: \"post\",\n pathParams: [\"agent_id\"],\n queryParams: [\"verbose\"],\n bodyParams: [\n \"message\",\n \"attachments\",\n \"metadata\",\n \"prompt_context\",\n \"thread_id\",\n ],\n\n path: (p: ChatWithAgentPathParameters): string => `agents/${p.agent_id}/chat`,\n} as const\n\ntype ContinueThreadPathParameters = {\n // The ID of the thread.\n thread_id: IdRequest\n}\n\ntype ContinueThreadBodyParameters =\n | {\n action_id: IdRequest\n // One of: `approve`, `reject`\n option_id: \"approve\" | \"reject\"\n }\n | {\n action_id: IdRequest\n // Always `use_connection`\n option_id: \"use_connection\"\n input: { connection_id: IdRequest }\n }\n\nexport type ContinueThreadParameters = ContinueThreadPathParameters &\n ContinueThreadBodyParameters\n\nexport type ContinueThreadResponse = {\n // Always `chat.invocation`\n object: \"chat.invocation\"\n agent_id: string\n thread_id: string\n invocation_id: string\n // Always `pending`\n status: \"pending\"\n}\n\n/**\n * Continue a thread\n */\nexport const continueThread = {\n method: \"post\",\n pathParams: [\"thread_id\"],\n queryParams: [],\n bodyParams: [\"action_id\", \"option_id\", \"input\"],\n\n path: (p: ContinueThreadPathParameters): string =>\n `threads/${p.thread_id}/continue`,\n} as const\n\ntype CreateExternalAgentStubVaultPathParameters = {\n // The ID of the agent backing this external agent session.\n agent_id: IdRequest | \"33333333-3333-3333-3333-333333333333\"\n}\n\ntype CreateExternalAgentStubVaultBodyParameters = {\n // Provider-defined vault name.\n name: string\n // Write-only credential input.\n credential: {\n // Write-only bearer credential.\n value: string\n // Credential expiry as an RFC 3339 instant.\n expires_at: string\n }\n // Credential target.\n target: {\n // MCP server target.\n type: \"mcp_server\"\n // The exact target server URL.\n server_url: string\n // Target authorization metadata.\n authorization: {\n // Bearer authorization.\n type: \"bearer\"\n }\n }\n}\n\nexport type CreateExternalAgentStubVaultParameters =\n CreateExternalAgentStubVaultPathParameters &\n CreateExternalAgentStubVaultBodyParameters\n\nexport type CreateExternalAgentStubVaultResponse = {\n id: string\n name: string\n credential: { expires_at: string }\n target: {\n // Always `mcp_server`\n type: \"mcp_server\"\n server_url: string\n authorization: {\n // Always `bearer`\n type: \"bearer\"\n }\n }\n // One of: `active`, `expired`\n status: \"active\" | \"expired\"\n version: number\n created_at: string\n updated_at: string\n}\n\n/**\n * Create external agent stub vault\n */\nexport const createExternalAgentStubVault = {\n method: \"post\",\n pathParams: [\"agent_id\"],\n queryParams: [],\n bodyParams: [\"name\", \"credential\", \"target\"],\n\n path: (p: CreateExternalAgentStubVaultPathParameters): string =>\n `external_agent_stub/${p.agent_id}/vaults`,\n} as const\n\ntype DeleteExternalAgentStubVaultPathParameters = {\n // The ID of the agent backing this external agent session.\n agent_id: IdRequest | \"33333333-3333-3333-3333-333333333333\"\n // The provider-owned vault ID.\n vault_id: string\n}\n\nexport type DeleteExternalAgentStubVaultParameters =\n DeleteExternalAgentStubVaultPathParameters\n\nexport type DeleteExternalAgentStubVaultResponse = EmptyObject\n\n/**\n * Delete external agent stub vault\n */\nexport const deleteExternalAgentStubVault = {\n method: \"delete\",\n pathParams: [\"agent_id\", \"vault_id\"],\n queryParams: [],\n bodyParams: [],\n\n path: (p: DeleteExternalAgentStubVaultPathParameters): string =>\n `external_agent_stub/${p.agent_id}/vaults/${p.vault_id}`,\n} as const\n\ntype UpdateExternalAgentStubVaultPathParameters = {\n // The ID of the agent backing this external agent session.\n agent_id: IdRequest | \"33333333-3333-3333-3333-333333333333\"\n // The provider-owned vault ID.\n vault_id: string\n}\n\ntype UpdateExternalAgentStubVaultBodyParameters = {\n // The last observed vault version.\n expected_version: number\n // Replacement write-only credential.\n credential: {\n // Write-only bearer credential.\n value: string\n // Credential expiry as an RFC 3339 instant.\n expires_at: string\n }\n}\n\nexport type UpdateExternalAgentStubVaultParameters =\n UpdateExternalAgentStubVaultPathParameters &\n UpdateExternalAgentStubVaultBodyParameters\n\nexport type UpdateExternalAgentStubVaultResponse = {\n id: string\n name: string\n credential: { expires_at: string }\n target: {\n // Always `mcp_server`\n type: \"mcp_server\"\n server_url: string\n authorization: {\n // Always `bearer`\n type: \"bearer\"\n }\n }\n // One of: `active`, `expired`\n status: \"active\" | \"expired\"\n version: number\n created_at: string\n updated_at: string\n}\n\n/**\n * Update external agent stub vault\n */\nexport const updateExternalAgentStubVault = {\n method: \"patch\",\n pathParams: [\"agent_id\", \"vault_id\"],\n queryParams: [],\n bodyParams: [\"expected_version\", \"credential\"],\n\n path: (p: UpdateExternalAgentStubVaultPathParameters): string =>\n `external_agent_stub/${p.agent_id}/vaults/${p.vault_id}`,\n} as const\n\ntype ListAgentsQueryParameters = {\n // Filter agents by name (case-insensitive substring match).\n name?: string\n // Filter agents by one or more agent types.\n agent_type?: Array<\n \"notion_ai\" | \"custom_agent\" | \"autofill_custom_agent\" | \"external\"\n >\n // Filter agents by one or more agent IDs. Use `notion_ai` for Notion Agent (personal\n // agent).\n agent_ids?: Array<\n IdRequest | \"notion_ai\" | \"33333333-3333-3333-3333-333333333333\"\n >\n // Filter agents by one or more creator IDs. Use \"me\" for the user associated with the\n // API token.\n created_by?: Array<IdRequest | \"me\">\n // If supplied, this endpoint will return a page of results starting after the cursor\n // provided. If not supplied, this endpoint will return the first page of results.\n start_cursor?: string | null\n // The number of items from the full list desired in the response. Maximum: 100\n page_size?: number\n // Whether to include inline instructions for each agent. Defaults to false.\n verbose?: boolean\n}\n\nexport type ListAgentsParameters = ListAgentsQueryParameters\n\nexport type ListAgentsResponse = {\n // Always `list`\n object: \"list\"\n // Always `agent`\n type: \"agent\"\n results: Array<{\n // Always `agent`\n object: \"agent\"\n id: IdResponse | \"notion_ai\"\n // Agent kind: the Notion AI personal agent, a custom agent, a database autofill custom\n // agent, or an external agent.\n agent_type:\n | \"notion_ai\"\n | \"custom_agent\"\n | \"autofill_custom_agent\"\n | \"external\"\n name: string\n description: string | null\n instructions_page_id: IdResponse | null\n icon:\n | PageIconResponse\n | {\n // Type of icon. In this case, a custom agent avatar.\n type: \"custom_agent_avatar\"\n // The static and animated URLs for the agent avatar.\n custom_agent_avatar: {\n // The URL of the static custom agent avatar.\n static_url: string\n // The URL of the animated custom agent avatar.\n animated_url: string\n }\n }\n | null\n version: {\n // The ID of the published artifact.\n id: IdResponse\n // The version number.\n number: number\n // The ISO 8601 timestamp when this version was published.\n published_at: string\n } | null\n agent_version: {\n // The ID of the published artifact.\n id: IdResponse\n // The version number.\n number: number\n // The ISO 8601 timestamp when this version was published.\n published_at: string\n } | null\n // The model the agent runs on: auto (Notion selects) or a pinned model.\n model:\n | {\n // Always `auto`\n mode: \"auto\"\n }\n | {\n // Always `pinned`\n mode: \"pinned\"\n // The public model this agent maps to (e.g. \"claude-sonnet-5\"), or null for a\n // pre-release / early-access model.\n id: string | null\n }\n // Non-Notion integrations the agent is connected to, using the same account and\n // permission shape as get agent.\n connections: Array<\n | {\n // Always `notion`\n type: \"notion\"\n name: string\n account: null\n permissions: Array<{\n target:\n | {\n // Always `page`\n type: \"page\"\n id: string\n }\n | {\n // Always `database_property`\n type: \"database_property\"\n data_source_id: string\n property_id: string\n }\n | {\n // Always `agent`\n type: \"agent\"\n id: string\n }\n | {\n // Always `workspace`\n type: \"workspace\"\n }\n | {\n // Always `owner_private_pages`\n type: \"owner_private_pages\"\n }\n | {\n // Always `web_search`\n type: \"web_search\"\n // Domains web search is restricted to, or null when unrestricted.\n allowed_domains: Array<string> | null\n }\n | {\n // Always `notion_help_docs_search`\n type: \"notion_help_docs_search\"\n }\n // Content roles (\"reader\" | \"comment_only\" | \"read_and_write\" | \"editor\") for scoped\n // targets, or search verbs (\"allow\" | \"disallow\") for the search targets.\n scopes: Array<string>\n }>\n }\n | {\n // Always `slack`\n type: \"slack\"\n name: string\n // The linked Slack workspace, null when none is linked, or \"hidden\" when the caller\n // lacks edit access to the agent.\n account:\n | {\n // Always `slack_workspace`\n type: \"slack_workspace\"\n team_id: string\n }\n | \"hidden\"\n | null\n permissions: Array<{\n target:\n | {\n // Always `slack_channel`\n type: \"slack_channel\"\n id: string\n }\n | {\n // Always `slack_all_public_channels`\n type: \"slack_all_public_channels\"\n }\n | {\n // Always `slack_all_channels`\n type: \"slack_all_channels\"\n }\n // Slack verbs granted on this target (\"read\" | \"write\" | \"reply_in_thread\" | \"react\").\n scopes: Array<string>\n }>\n }\n | {\n // Always `discord`\n type: \"discord\"\n name: string\n // The linked Discord server, null when none is linked, or \"hidden\" when the caller lacks\n // edit access to the agent.\n account:\n | {\n // Always `discord_server`\n type: \"discord_server\"\n id: string\n }\n | \"hidden\"\n | null\n permissions: Array<{\n target:\n | {\n // Always `discord_channel`\n type: \"discord_channel\"\n id: string\n }\n | {\n // Always `discord_all_channels`\n type: \"discord_all_channels\"\n }\n // Discord verbs granted on this target (\"read\" | \"write\" | \"reply_in_thread\" | \"react\").\n scopes: Array<string>\n }>\n }\n | {\n // Always `mcp_server`\n type: \"mcp_server\"\n name: string\n // The MCP server host, null when none is linked, or \"hidden\" when the caller lacks edit\n // access to the agent.\n account:\n | {\n // Always `mcp_server`\n type: \"mcp_server\"\n // The MCP server host (never the full URL, which can carry credentials or private path\n // components).\n server_host: string\n }\n | \"hidden\"\n | null\n // The tools the agent may call, null when all tools are enabled (including any the\n // server adds later), or \"hidden\" when the caller lacks edit access to the agent.\n enabled_tools:\n | Array<{ name: string; title: string | null }>\n | \"hidden\"\n | null\n // Whether read / write tool calls run without a confirmation step.\n run_tools_automatically: {\n // Whether read tool calls run without a confirmation step.\n read: boolean\n // Whether write tool calls run without a confirmation step.\n write: boolean\n }\n }\n | {\n // Always `custom_mcp_server`\n type: \"custom_mcp_server\"\n name: string\n // The MCP server host, null when none is linked, or \"hidden\" when the caller lacks edit\n // access to the agent.\n account:\n | {\n // Always `mcp_server`\n type: \"mcp_server\"\n // The MCP server host (never the full URL, which can carry credentials or private path\n // components).\n server_host: string\n }\n | \"hidden\"\n | null\n // The tools the agent may call, null when all tools are enabled (including any the\n // server adds later), or \"hidden\" when the caller lacks edit access to the agent.\n enabled_tools:\n | Array<{ name: string; title: string | null }>\n | \"hidden\"\n | null\n // Whether read / write tool calls run without a confirmation step.\n run_tools_automatically: {\n // Whether read tool calls run without a confirmation step.\n read: boolean\n // Whether write tool calls run without a confirmation step.\n write: boolean\n }\n }\n | {\n // The connector's machine name (e.g. \"github\", \"google_drive\").\n type:\n | \"asana\"\n | \"box\"\n | \"calendar\"\n | \"computer\"\n | \"confluence\"\n | \"cursor\"\n | \"feedback\"\n | \"files\"\n | \"fs\"\n | \"github\"\n | \"gmail\"\n | \"google_calendar\"\n | \"google_drive\"\n | \"google_drive_oauth\"\n | \"gtm\"\n | \"helpdocs\"\n | \"images\"\n | \"jira\"\n | \"linear\"\n | \"mail\"\n | \"marketplace\"\n | \"memory\"\n | \"microsoft_teams\"\n | \"microsoft_teams_oauth\"\n | \"outlook\"\n | \"salesforce\"\n | \"search\"\n | \"security\"\n | \"sharepoint\"\n | \"sharepoint_oauth\"\n | \"shopify\"\n | \"skills\"\n | \"system\"\n | \"test\"\n | \"web\"\n | \"webhooks\"\n | \"worker\"\n | \"workers\"\n name: string\n // The provider-side account identifier, null when none is linked, or \"hidden\" when the\n // caller lacks edit access to the agent.\n account: string | null\n permissions: Array<{\n target: { type: string; id: string }\n // The scopes granted on this target.\n scopes: Array<string>\n }>\n }\n >\n // Agent status. Disabled agents remain listed; deleted agents are currently excluded\n // from list responses.\n status: \"active\" | \"disabled\" | \"deleted\"\n created_by: {\n // Always `user`\n object: \"user\"\n // Always `user`\n type: \"user\"\n // The ID of the user that created this agent.\n id: IdResponse\n } | null\n // Date and time when this agent was created, or null for the personal agent.\n created_time: string | null\n // Date and time when this agent was last edited, or null for the personal agent.\n last_edited_time: string | null\n // Date and time when this agent was last invoked, null when no invocation is available,\n // or \"hidden\" when the caller lacks edit access to the agent.\n last_run_time: string | \"hidden\" | null\n // Date and time when this agent was last invoked, null when no invocation is available,\n // or \"hidden\" when the caller lacks edit access to the agent.\n last_run_at: string | \"hidden\" | null\n // The agent's inline instructions when verbose=true, or null when its instructions are\n // stored on a page.\n instructions?: string | null\n }>\n has_more: boolean\n next_cursor: string | null\n}\n\n/**\n * List agents\n */\nexport const listAgents = {\n method: \"get\",\n pathParams: [],\n queryParams: [\n \"name\",\n \"agent_type\",\n \"agent_ids\",\n \"created_by\",\n \"start_cursor\",\n \"page_size\",\n \"verbose\",\n ],\n bodyParams: [],\n\n path: (): string => `agents`,\n} as const\n\ntype ListExternalAgentStubSessionEventsPathParameters = {\n // The ID of the agent backing this external agent session.\n agent_id: IdRequest | \"33333333-3333-3333-3333-333333333333\"\n // The provider-owned session ID returned when the session was created.\n session_id: IdRequest\n}\n\ntype ListExternalAgentStubSessionEventsQueryParameters = {\n // Opaque cursor returned by a previous call. Only events strictly after this cursor are\n // returned.\n cursor?: string\n}\n\nexport type ListExternalAgentStubSessionEventsParameters =\n ListExternalAgentStubSessionEventsPathParameters &\n ListExternalAgentStubSessionEventsQueryParameters\n\nexport type ListExternalAgentStubSessionEventsResponse = {\n events: Array<\n | {\n // Always `assistant.thinking`\n type: \"assistant.thinking\"\n text: string\n }\n | {\n // Always `assistant.message`\n type: \"assistant.message\"\n text: string\n }\n | {\n // Always `tool.started`\n type: \"tool.started\"\n tool_call_id: string\n tool_name?: string\n input?: Record<string, never>\n }\n | {\n // Always `tool.output`\n type: \"tool.output\"\n tool_call_id: string\n output?: Record<string, never>\n is_error?: boolean\n }\n | {\n // Always `error`\n type: \"error\"\n error: {\n code: string\n message: string\n retryable: boolean\n additional_data?: Record<string, string | Array<string>>\n }\n }\n >\n is_running: boolean\n next_cursor?: string\n}\n\n/**\n * List external agent stub session events\n */\nexport const listExternalAgentStubSessionEvents = {\n method: \"get\",\n pathParams: [\"agent_id\", \"session_id\"],\n queryParams: [\"cursor\"],\n bodyParams: [],\n\n path: (p: ListExternalAgentStubSessionEventsPathParameters): string =>\n `external_agent_stub/${p.agent_id}/sessions/${p.session_id}/events`,\n} as const\n\ntype ListThreadMessagesPathParameters = {\n // The ID of the thread.\n thread_id: IdRequest\n}\n\ntype ListThreadMessagesQueryParameters = {\n // Whether to include agent thinking and structured message content parts. Defaults to\n // false.\n verbose?: boolean\n // Filter messages by role (user or agent).\n role?: \"user\" | \"agent\"\n // If supplied, this endpoint will return a page of results starting after the cursor\n // provided. If not supplied, this endpoint will return the first page of results.\n start_cursor?: string | null\n // The number of items from the full list desired in the response. Maximum: 100\n page_size?: number\n}\n\nexport type ListThreadMessagesParameters = ListThreadMessagesPathParameters &\n ListThreadMessagesQueryParameters\n\nexport type ListThreadMessagesResponse = {\n // Always `list`\n object: \"list\"\n // Always `thread_message`\n type: \"thread_message\"\n results: Array<{\n // Always `thread_message`\n object: \"thread_message\"\n id: IdResponse\n // One of: `user`, `agent`\n role: \"user\" | \"agent\"\n content: string\n // Date and time when this message was created.\n created_time: string\n parent: {\n // The parent type.\n type: \"thread\"\n // The ID of the parent thread.\n id: IdResponse\n }\n attachments?: Array<{\n name: string\n content_type: string\n url: string\n // The time when the attachment URL will expire.\n expiry_time?: string\n }>\n content_parts?: Array<\n | {\n // Always `text`\n type: \"text\"\n text: string\n }\n | {\n // Always `thinking`\n type: \"thinking\"\n text: string\n }\n | {\n // Always `tool_call`\n type: \"tool_call\"\n tool_call_id: string | null\n tool_name: string\n results?: Array<{\n id: IdResponse\n agent_step_id: IdResponse | null\n tool_call_id: string | null\n tool_name: string\n tool_type: string\n state: string\n started_at: number\n finished_at: number | null\n duration_ms: number | null\n }>\n }\n | {\n // Always `follow_ups`\n type: \"follow_ups\"\n follow_ups: Array<{ label: string; message: string }>\n }\n | {\n // Always `custom_agent_template_picker`\n type: \"custom_agent_template_picker\"\n }\n >\n pending_user_actions?: Array<{\n id: IdResponse\n // Always `tool_confirmation`\n type: \"tool_confirmation\"\n title: string\n requirements: Array<\n | {\n // Always `general`\n type: \"general\"\n }\n | {\n // Always `manage_workers`\n type: \"manage_workers\"\n }\n | {\n // Always `url_safety`\n type: \"url_safety\"\n urls: Array<string>\n required_by_workspace_policy?: boolean\n }\n | {\n // Always `permission_escalation`\n type: \"permission_escalation\"\n destination_title?: string\n source_titles?: Array<string>\n }\n | {\n // Always `delete_content`\n type: \"delete_content\"\n page_count: number\n database_count: number\n meeting_notes_block_count?: number\n }\n | {\n // Always `connect_integration`\n type: \"connect_integration\"\n integration_type: string\n integration_name: string\n handoff_url: string\n }\n | {\n // Always `admin_mode`\n type: \"admin_mode\"\n explanation?: string\n }\n >\n options: Array<\n | {\n // Always `approve`\n id: \"approve\"\n label: string\n }\n | {\n // Always `reject`\n id: \"reject\"\n label: string\n }\n | {\n // Always `use_connection`\n id: \"use_connection\"\n label: string\n input: {\n // Always `connection_id`\n type: \"connection_id\"\n // Always `true`\n required: true\n }\n }\n >\n }>\n }>\n has_more: boolean\n next_cursor: string | null\n}\n\n/**\n * List thread messages\n */\nexport const listThreadMessages = {\n method: \"get\",\n pathParams: [\"thread_id\"],\n queryParams: [\"verbose\", \"role\", \"start_cursor\", \"page_size\"],\n bodyParams: [],\n\n path: (p: ListThreadMessagesPathParameters): string =>\n `threads/${p.thread_id}/messages`,\n} as const\n\ntype SendThreadMessagePathParameters = {\n // The ID of the thread.\n thread_id: IdRequest\n}\n\ntype SendThreadMessageBodyParameters = {\n // The message to send to the agent.\n message?: string\n // An array of file uploads to attach to this chat turn. Use the File Upload APIs to\n // create uploads and pass their IDs here.\n attachments?: Array<{\n // ID of a FileUpload object that has the status `uploaded`.\n file_upload: {\n // ID of a FileUpload object that has the status `uploaded`.\n id: string\n }\n // The type of the attachment. Only supports \"file_upload\".\n type?: \"file_upload\"\n // An optional display name override for the attachment.\n name?: string\n }>\n // Optional caller-provided string metadata persisted with the user message. user_id is\n // used for lifecycle correlation and does not change authorization.\n metadata?: Record<string, string>\n // Additional caller-provided context for the agent to consider while responding.\n prompt_context?: string\n}\n\nexport type SendThreadMessageParameters = SendThreadMessagePathParameters &\n SendThreadMessageBodyParameters\n\nexport type SendThreadMessageResponse = {\n // Always `chat.invocation`\n object: \"chat.invocation\"\n agent_id: string\n thread_id: string\n invocation_id: string\n // Always `pending`\n status: \"pending\"\n}\n\n/**\n * Send a thread message\n */\nexport const sendThreadMessage = {\n method: \"post\",\n pathParams: [\"thread_id\"],\n queryParams: [],\n bodyParams: [\"message\", \"attachments\", \"metadata\", \"prompt_context\"],\n\n path: (p: SendThreadMessagePathParameters): string =>\n `threads/${p.thread_id}/messages`,\n} as const\n\ntype ListThreadsPathParameters = {\n // The ID of the agent. Use a UUID for custom agents or `notion_ai` for Notion Agent\n // (personal agent); the reserved UUID `33333333-3333-3333-3333-333333333333` remains\n // supported for backward compatibility.\n agent_id: IdRequest | \"notion_ai\" | \"33333333-3333-3333-3333-333333333333\"\n}\n\ntype ListThreadsQueryParameters = {\n // Filter threads by ID (exact match).\n id?: IdRequest\n // Filter threads by title (case-insensitive substring match).\n title?: string\n // Filter threads by status.\n status?: \"pending\" | \"requires_action\" | \"completed\" | \"failed\" | \"canceled\"\n // Filter threads by agent activity state. Defaults to `all`.\n activity?: \"all\" | \"pending\" | \"in_progress\" | \"failed\" | \"success\"\n // Filter threads by one or more creator IDs. Use \"me\" for the API bot and user\n // associated with the API token.\n created_by?: Array<IdRequest | \"me\">\n // Filter threads by one or more IDs of actors who last used them. Use \"me\" for the API\n // bot and user associated with the API token.\n last_used_by?: Array<IdRequest | \"me\">\n // Timestamp used to sort threads. Defaults to `created_time`.\n sort_by?: \"created_time\" | \"last_used_time\"\n // Sort direction. Defaults to `descending`.\n sort_direction?: \"ascending\" | \"descending\"\n // If supplied, this endpoint will return a page of results starting after the cursor\n // provided. If not supplied, this endpoint will return the first page of results.\n start_cursor?: string | null\n // The number of items from the full list desired in the response. Maximum: 100\n page_size?: number\n}\n\nexport type ListThreadsParameters = ListThreadsPathParameters &\n ListThreadsQueryParameters\n\nexport type ListThreadsResponse = {\n // Always `list`\n object: \"list\"\n // Always `thread`\n type: \"thread\"\n results: Array<{\n // Always `thread`\n object: \"thread\"\n id: IdResponse\n title: string\n // One of: `pending`, `requires_action`, `completed`, `canceled`, `failed`\n status: \"pending\" | \"requires_action\" | \"completed\" | \"canceled\" | \"failed\"\n // Date and time when this thread was created.\n created_time: string\n // Date and time when this thread was last updated.\n last_edited_time: string\n created_by: {\n // The ID of the actor that created this thread: a bot for an integration-created thread,\n // a user for one created in the Notion app.\n id: IdResponse\n // The creator type. Threads a caller can see because it has access to the agent, such as\n // a trigger's runs or a teammate's chats, may be created by either a bot or a user.\n type: \"bot\" | \"user\"\n }\n agent_version: {\n // The ID of the published artifact.\n id: IdResponse\n // The version number.\n number: number\n // The ISO 8601 timestamp when this version was published.\n published_at: string\n } | null\n models:\n | {\n // Always `auto`\n type: \"auto\"\n }\n | {\n // Always `pinned`\n type: \"pinned\"\n // The public model this thread is pinned to (e.g. \"claude-sonnet-5\"), with null for a\n // pre-release / early-access model. Empty when the thread has no model recorded yet.\n // Reflects the thread's configuration at creation, so a model changed mid-conversation\n // is not reflected here.\n ids: Array<string | null>\n }\n error?: string\n // How this thread started: the type of the trigger that ran it, or \"chat\".\n trigger_type?: string\n // Labels describing how the thread ran (triggered, chat, setup). Null when the caller\n // lacks edit access to the agent.\n type_labels?: Array<string> | null\n // Emails of the users who participated in this thread. Null when the caller lacks edit\n // access to the agent.\n chat_user_emails?: Array<string> | null\n // Types of tool this thread called. Null when the caller lacks edit access to the agent.\n tool_types?: Array<string> | null\n // Number of tool calls in this thread. Null when the caller lacks edit access to the\n // agent.\n tool_call_count?: number | null\n // Premium AI credits this thread consumed. Null when the caller lacks edit access to the\n // agent.\n credits_used?: number | null\n // Runs completed in this thread. Null when the caller lacks edit access to the agent, or\n // when the thread predates run tracking.\n runs_completed?: number | null\n pending_user_actions?: Array<{\n id: IdResponse\n // Always `tool_confirmation`\n type: \"tool_confirmation\"\n title: string\n requirements: Array<\n | {\n // Always `general`\n type: \"general\"\n }\n | {\n // Always `manage_workers`\n type: \"manage_workers\"\n }\n | {\n // Always `url_safety`\n type: \"url_safety\"\n urls: Array<string>\n required_by_workspace_policy?: boolean\n }\n | {\n // Always `permission_escalation`\n type: \"permission_escalation\"\n destination_title?: string\n source_titles?: Array<string>\n }\n | {\n // Always `delete_content`\n type: \"delete_content\"\n page_count: number\n database_count: number\n meeting_notes_block_count?: number\n }\n | {\n // Always `connect_integration`\n type: \"connect_integration\"\n integration_type: string\n integration_name: string\n handoff_url: string\n }\n | {\n // Always `admin_mode`\n type: \"admin_mode\"\n explanation?: string\n }\n >\n options: Array<\n | {\n // Always `approve`\n id: \"approve\"\n label: string\n }\n | {\n // Always `reject`\n id: \"reject\"\n label: string\n }\n | {\n // Always `use_connection`\n id: \"use_connection\"\n label: string\n input: {\n // Always `connection_id`\n type: \"connection_id\"\n // Always `true`\n required: true\n }\n }\n >\n }>\n }>\n has_more: boolean\n next_cursor: string | null\n}\n\n/**\n * List threads\n */\nexport const listThreads = {\n method: \"get\",\n pathParams: [\"agent_id\"],\n queryParams: [\n \"id\",\n \"title\",\n \"status\",\n \"activity\",\n \"created_by\",\n \"last_used_by\",\n \"sort_by\",\n \"sort_direction\",\n \"start_cursor\",\n \"page_size\",\n ],\n bodyParams: [],\n\n path: (p: ListThreadsPathParameters): string =>\n `agents/${p.agent_id}/threads`,\n} as const\n\ntype QueryThreadMessagesPathParameters = {\n // The ID of the thread.\n thread_id: IdRequest\n}\n\ntype QueryThreadMessagesBodyParameters = {\n // Whether to include agent thinking and structured message content parts. Defaults to\n // false.\n verbose?: boolean\n // Opaque continuation cursor from the previous page.\n start_cursor?: string | null\n // Number of messages to return. Maximum: 100.\n page_size?: number\n}\n\nexport type QueryThreadMessagesParameters = QueryThreadMessagesPathParameters &\n QueryThreadMessagesBodyParameters\n\nexport type QueryThreadMessagesResponse = {\n // Always `list`\n object: \"list\"\n // Always `thread_message`\n type: \"thread_message\"\n results: Array<{\n // Always `thread_message`\n object: \"thread_message\"\n id: IdResponse\n // One of: `user`, `agent`\n role: \"user\" | \"agent\"\n content: string\n // Date and time when this message was created.\n created_time: string\n parent: {\n // The parent type.\n type: \"thread\"\n // The ID of the parent thread.\n id: IdResponse\n }\n attachments?: Array<{\n name: string\n content_type: string\n url: string\n // The time when the attachment URL will expire.\n expiry_time?: string\n }>\n content_parts?: Array<\n | {\n // Always `text`\n type: \"text\"\n text: string\n }\n | {\n // Always `thinking`\n type: \"thinking\"\n text: string\n }\n | {\n // Always `tool_call`\n type: \"tool_call\"\n tool_call_id: string | null\n tool_name: string\n results?: Array<{\n id: IdResponse\n agent_step_id: IdResponse | null\n tool_call_id: string | null\n tool_name: string\n tool_type: string\n state: string\n started_at: number\n finished_at: number | null\n duration_ms: number | null\n }>\n }\n | {\n // Always `follow_ups`\n type: \"follow_ups\"\n follow_ups: Array<{ label: string; message: string }>\n }\n | {\n // Always `custom_agent_template_picker`\n type: \"custom_agent_template_picker\"\n }\n >\n pending_user_actions?: Array<{\n id: IdResponse\n // Always `tool_confirmation`\n type: \"tool_confirmation\"\n title: string\n requirements: Array<\n | {\n // Always `general`\n type: \"general\"\n }\n | {\n // Always `manage_workers`\n type: \"manage_workers\"\n }\n | {\n // Always `url_safety`\n type: \"url_safety\"\n urls: Array<string>\n required_by_workspace_policy?: boolean\n }\n | {\n // Always `permission_escalation`\n type: \"permission_escalation\"\n destination_title?: string\n source_titles?: Array<string>\n }\n | {\n // Always `delete_content`\n type: \"delete_content\"\n page_count: number\n database_count: number\n meeting_notes_block_count?: number\n }\n | {\n // Always `connect_integration`\n type: \"connect_integration\"\n integration_type: string\n integration_name: string\n handoff_url: string\n }\n | {\n // Always `admin_mode`\n type: \"admin_mode\"\n explanation?: string\n }\n >\n options: Array<\n | {\n // Always `approve`\n id: \"approve\"\n label: string\n }\n | {\n // Always `reject`\n id: \"reject\"\n label: string\n }\n | {\n // Always `use_connection`\n id: \"use_connection\"\n label: string\n input: {\n // Always `connection_id`\n type: \"connection_id\"\n // Always `true`\n required: true\n }\n }\n >\n }>\n }>\n has_more: boolean\n next_cursor: string | null\n}\n\n/**\n * Query thread messages\n */\nexport const queryThreadMessages = {\n method: \"post\",\n pathParams: [\"thread_id\"],\n queryParams: [],\n bodyParams: [\"verbose\", \"start_cursor\", \"page_size\"],\n\n path: (p: QueryThreadMessagesPathParameters): string =>\n `threads/${p.thread_id}/messages/query`,\n} as const\n\ntype QueryThreadsPathParameters = {\n // The ID of the agent. Use a UUID for custom agents or `notion_ai` for Notion Agent\n // (personal agent); the reserved UUID `33333333-3333-3333-3333-333333333333` remains\n // supported for backward compatibility.\n agent_id: IdRequest | \"notion_ai\" | \"33333333-3333-3333-3333-333333333333\"\n}\n\ntype QueryThreadsBodyParameters = {\n // Search thread titles.\n query?: string\n // Thread filters.\n filter?: {\n // Filter threads by ID (exact match).\n id?: IdRequest\n // Filter by one or more activity statuses. `all` cannot be combined with another status.\n status?: Array<\"all\" | \"pending\" | \"in_progress\" | \"failed\" | \"success\">\n // Filter by creator IDs or \"me\".\n created_by?: Array<IdRequest | \"me\">\n // Filter by last-used actor IDs or \"me\".\n last_used_by?: Array<IdRequest | \"me\">\n // Filter to threads containing a public-facing message in the requested time window.\n message_time?: {\n // Inclusive start of the message time window. Defaults to the Unix epoch.\n start?: string\n // Exclusive end of the message time window. Defaults to the current time.\n end?: string\n }\n }\n // Ordered sort precedence. Defaults to last_used_time descending.\n sorts?: Array<{\n // Timestamp used to sort threads.\n timestamp: \"created_time\" | \"last_used_time\"\n // Sort direction.\n direction: \"ascending\" | \"descending\"\n }>\n // Opaque continuation cursor from the previous page.\n start_cursor?: string | null\n // Number of threads to return. Maximum: 100.\n page_size?: number\n}\n\nexport type QueryThreadsParameters = QueryThreadsPathParameters &\n QueryThreadsBodyParameters\n\nexport type QueryThreadsResponse = {\n // Always `list`\n object: \"list\"\n // Always `thread`\n type: \"thread\"\n results: Array<{\n // Always `thread`\n object: \"thread\"\n id: IdResponse\n title: string\n // One of: `pending`, `requires_action`, `completed`, `canceled`, `failed`\n status: \"pending\" | \"requires_action\" | \"completed\" | \"canceled\" | \"failed\"\n // Date and time when this thread was created.\n created_time: string\n // Date and time when this thread was last updated.\n last_edited_time: string\n created_by: {\n // The ID of the actor that created this thread: a bot for an integration-created thread,\n // a user for one created in the Notion app.\n id: IdResponse\n // The creator type. Threads a caller can see because it has access to the agent, such as\n // a trigger's runs or a teammate's chats, may be created by either a bot or a user.\n type: \"bot\" | \"user\"\n }\n agent_version: {\n // The ID of the published artifact.\n id: IdResponse\n // The version number.\n number: number\n // The ISO 8601 timestamp when this version was published.\n published_at: string\n } | null\n models:\n | {\n // Always `auto`\n type: \"auto\"\n }\n | {\n // Always `pinned`\n type: \"pinned\"\n // The public model this thread is pinned to (e.g. \"claude-sonnet-5\"), with null for a\n // pre-release / early-access model. Empty when the thread has no model recorded yet.\n // Reflects the thread's configuration at creation, so a model changed mid-conversation\n // is not reflected here.\n ids: Array<string | null>\n }\n error?: string\n // How this thread started: the type of the trigger that ran it, or \"chat\".\n trigger_type?: string\n // Labels describing how the thread ran (triggered, chat, setup). Null when the caller\n // lacks edit access to the agent.\n type_labels?: Array<string> | null\n // Emails of the users who participated in this thread. Null when the caller lacks edit\n // access to the agent.\n chat_user_emails?: Array<string> | null\n // Types of tool this thread called. Null when the caller lacks edit access to the agent.\n tool_types?: Array<string> | null\n // Number of tool calls in this thread. Null when the caller lacks edit access to the\n // agent.\n tool_call_count?: number | null\n // Premium AI credits this thread consumed. Null when the caller lacks edit access to the\n // agent.\n credits_used?: number | null\n // Runs completed in this thread. Null when the caller lacks edit access to the agent, or\n // when the thread predates run tracking.\n runs_completed?: number | null\n pending_user_actions?: Array<{\n id: IdResponse\n // Always `tool_confirmation`\n type: \"tool_confirmation\"\n title: string\n requirements: Array<\n | {\n // Always `general`\n type: \"general\"\n }\n | {\n // Always `manage_workers`\n type: \"manage_workers\"\n }\n | {\n // Always `url_safety`\n type: \"url_safety\"\n urls: Array<string>\n required_by_workspace_policy?: boolean\n }\n | {\n // Always `permission_escalation`\n type: \"permission_escalation\"\n destination_title?: string\n source_titles?: Array<string>\n }\n | {\n // Always `delete_content`\n type: \"delete_content\"\n page_count: number\n database_count: number\n meeting_notes_block_count?: number\n }\n | {\n // Always `connect_integration`\n type: \"connect_integration\"\n integration_type: string\n integration_name: string\n handoff_url: string\n }\n | {\n // Always `admin_mode`\n type: \"admin_mode\"\n explanation?: string\n }\n >\n options: Array<\n | {\n // Always `approve`\n id: \"approve\"\n label: string\n }\n | {\n // Always `reject`\n id: \"reject\"\n label: string\n }\n | {\n // Always `use_connection`\n id: \"use_connection\"\n label: string\n input: {\n // Always `connection_id`\n type: \"connection_id\"\n // Always `true`\n required: true\n }\n }\n >\n }>\n }>\n has_more: boolean\n next_cursor: string | null\n}\n\n/**\n * Query threads\n */\nexport const queryThreads = {\n method: \"post\",\n pathParams: [\"agent_id\"],\n queryParams: [],\n bodyParams: [\"query\", \"filter\", \"sorts\", \"start_cursor\", \"page_size\"],\n\n path: (p: QueryThreadsPathParameters): string =>\n `agents/${p.agent_id}/threads/query`,\n} as const\n\ntype SendExternalAgentStubSessionMessagePathParameters = {\n // The ID of the agent backing this external agent session.\n agent_id: IdRequest | \"33333333-3333-3333-3333-333333333333\"\n // The provider-owned session ID returned when the session was created.\n session_id: IdRequest\n}\n\ntype SendExternalAgentStubSessionMessageBodyParameters = {\n // Text message to send to the agent.\n message: string\n // Idempotency key for this message submission. Accepted but not yet used for\n // deduplication by the stub.\n client_message_id?: string\n}\n\nexport type SendExternalAgentStubSessionMessageParameters =\n SendExternalAgentStubSessionMessagePathParameters &\n SendExternalAgentStubSessionMessageBodyParameters\n\nexport type SendExternalAgentStubSessionMessageResponse = {\n accepted: boolean\n run_id?: string\n}\n\n/**\n * Send external agent stub session message\n */\nexport const sendExternalAgentStubSessionMessage = {\n method: \"post\",\n pathParams: [\"agent_id\", \"session_id\"],\n queryParams: [],\n bodyParams: [\"message\", \"client_message_id\"],\n\n path: (p: SendExternalAgentStubSessionMessagePathParameters): string =>\n `external_agent_stub/${p.agent_id}/sessions/${p.session_id}/messages`,\n} as const\n\ntype StartExternalAgentStubSessionPathParameters = {\n // The ID of the agent backing this external agent session.\n agent_id: IdRequest | \"33333333-3333-3333-3333-333333333333\"\n}\n\ntype StartExternalAgentStubSessionBodyParameters = {\n // External Agent API wire version.\n spec_version?: \"v1\"\n // Idempotency key for one session-creation intent.\n client_reference_id?: string\n // Vault-backed session configuration.\n configs?: {\n // The ordered MCP server configuration.\n mcp_servers: Array<{\n // MCP server name.\n name: string\n // MCP server URL.\n server_url: string\n // Credential vault reference or deliberate no-auth.\n credential:\n | {\n // Vault-backed credential reference.\n type: \"vault\"\n // Provider-owned vault ID.\n vault_id: string\n }\n | {\n // No authorization credential.\n type: \"none\"\n }\n }>\n }\n // Preferred model hint. The stub echoes it back and may ignore it.\n model?: string\n // Working directory hint. Not applicable to this provider; echoed back.\n cwd?: string\n // BCP 47 locale identifier such as `en-US`.\n locale?: string\n // Session-scoped instructions for the external agent.\n system_prompt?: string\n}\n\nexport type StartExternalAgentStubSessionParameters =\n StartExternalAgentStubSessionPathParameters &\n StartExternalAgentStubSessionBodyParameters\n\nexport type StartExternalAgentStubSessionResponse = {\n session_id: string\n model?: string\n cwd?: string\n last_active_at?: string\n}\n\n/**\n * Start external agent stub session\n */\nexport const startExternalAgentStubSession = {\n method: \"post\",\n pathParams: [\"agent_id\"],\n queryParams: [],\n bodyParams: [\n \"spec_version\",\n \"client_reference_id\",\n \"configs\",\n \"model\",\n \"cwd\",\n \"locale\",\n \"system_prompt\",\n ],\n\n path: (p: StartExternalAgentStubSessionPathParameters): string =>\n `external_agent_stub/${p.agent_id}/sessions`,\n} as const\n"]}