Notion: Apply many agent operations
Notion agents.agentBatch: arguments, response, policy and SDK examples.
← Agents operations · Get started
Operation notion.agent_batch
Provider route: POST /v1/agents/batch. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/notion with npm, or alter-sdk-notion with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { NotionIntegration } from "@alter-ai/notion";
async function execute(input: Parameters<NotionIntegration["agents"]["agentBatch"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new NotionIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.agents.agentBatch(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_notion import NotionIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = NotionIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.agents.agent_batch(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
body | object | Required within parent | Additional keys: not allowed |
body.operations | array | Required within parent | The operations to apply, at least one and at most 100. Operations are applied in the order given, and the batch is not atomic: each operation succeeds or fails on its own, and per-operation outcomes are reported in the async task’s result. Maximum items: 100 Minimum items: 1 |
body.operations[] | JSON | Each item | One action to apply to one agent. Each operation is authorized and applied on its own. |
body.operations[] (oneOf 1) | object | Alternative | Additional keys: not allowed |
body.operations[] (oneOf 1).action | string | Required within parent | Enable or disable one agent, equivalent to `PATCH /v1/agents/:agent_id/status`. Must equal: update_status |
body.operations[] (oneOf 1).agent_id | JSON | Required within parent | The agent ID (a UUID), or `notion_ai` for the personal agent. Endpoint-specific restrictions still apply. |
body.operations[] (oneOf 1).agent_id (anyOf 1) | string | Alternative | |
body.operations[] (oneOf 1).agent_id (anyOf 2) | string | Alternative | Always `notion_ai` Must equal: notion_ai |
body.operations[] (oneOf 1).fields | object | Required within parent | The status to apply to this agent. Additional keys: not allowed |
body.operations[] (oneOf 1).fields.status | string | Required within parent | ”active” to re-enable an agent disabled through this API, or “disabled” to turn it off. One of: active, disabled |
body.operations[] (oneOf 2) | object | Alternative | Additional keys: not allowed |
body.operations[] (oneOf 2).action | string | Required within parent | Set or clear one agent’s credit limit, equivalent to `PATCH /v1/agents/:agent_id/credit_limit`. Requires a personal access token whose user has full access to the agent. Must equal: update_credit_limit |
body.operations[] (oneOf 2).agent_id | JSON | Required within parent | The agent ID (a UUID), or `notion_ai` for the personal agent. Endpoint-specific restrictions still apply. |
body.operations[] (oneOf 2).agent_id (anyOf 1) | string | Alternative | |
body.operations[] (oneOf 2).agent_id (anyOf 2) | string | Alternative | Always `notion_ai` Must equal: notion_ai |
body.operations[] (oneOf 2).fields | object | Required within parent | The credit limit to apply to this agent. Additional keys: not allowed |
body.operations[] (oneOf 2).fields.credit_limit | JSON | Required within parent | The per-agent credit limit as a non-negative integer, or null to clear the limit. |
body.operations[] (oneOf 2).fields.credit_limit (oneOf 1) | integer | Alternative | |
body.operations[] (oneOf 2).fields.credit_limit (oneOf 2) | null | Alternative | |
body.operations[] (oneOf 3) | object | Alternative | Additional keys: not allowed |
body.operations[] (oneOf 3).action | string | Required within parent | Soft-delete one agent, equivalent to `DELETE /v1/agents/:agent_id`. Must equal: delete |
body.operations[] (oneOf 3).agent_id | JSON | Required within parent | The agent ID (a UUID), or `notion_ai` for the personal agent. Endpoint-specific restrictions still apply. |
body.operations[] (oneOf 3).agent_id (anyOf 1) | string | Alternative | |
body.operations[] (oneOf 3).agent_id (anyOf 2) | string | Alternative | Always `notion_ai` Must equal: notion_ai |
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: allowed |
created_time | string | Required within parent | Format: date-time |
id | string | Required within parent | Minimum length: 1 |
object | string | Required within parent | Must equal: async_task |
operation | object | Required within parent | Additional keys: allowed |
operation.name | string | Required within parent | Minimum length: 1 |
operation.surface | string | Required within parent | Known values: rest, mcp |
poll_after_seconds | JSON | Required within parent | |
poll_after_seconds (anyOf 1) | integer | Alternative | Minimum: 0 |
poll_after_seconds (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
status | string | Required within parent | Known values: queued, running, retrying |
status_url | string | Required within parent | Minimum length: 1 |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: notion.agent_batch. Catalog operation: agent_batch. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.
Pinned headers: {"Notion-Version": "2026-03-11"}