Skip to content

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.

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 os
from alter_sdk import App
from 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()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
bodyobjectRequired within parentAdditional keys: not allowed
body.operationsarrayRequired within parentThe 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[]JSONEach itemOne action to apply to one agent. Each operation is authorized and applied on its own.
body.operations[] (oneOf 1)objectAlternativeAdditional keys: not allowed
body.operations[] (oneOf 1).actionstringRequired within parentEnable or disable one agent, equivalent to `PATCH /v1/agents/:agent_id/status`.
Must equal: update_status
body.operations[] (oneOf 1).agent_idJSONRequired within parentThe agent ID (a UUID), or `notion_ai` for the personal agent. Endpoint-specific restrictions still apply.
body.operations[] (oneOf 1).agent_id (anyOf 1)stringAlternative
body.operations[] (oneOf 1).agent_id (anyOf 2)stringAlternativeAlways `notion_ai`
Must equal: notion_ai
body.operations[] (oneOf 1).fieldsobjectRequired within parentThe status to apply to this agent.
Additional keys: not allowed
body.operations[] (oneOf 1).fields.statusstringRequired 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)objectAlternativeAdditional keys: not allowed
body.operations[] (oneOf 2).actionstringRequired within parentSet 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_idJSONRequired within parentThe agent ID (a UUID), or `notion_ai` for the personal agent. Endpoint-specific restrictions still apply.
body.operations[] (oneOf 2).agent_id (anyOf 1)stringAlternative
body.operations[] (oneOf 2).agent_id (anyOf 2)stringAlternativeAlways `notion_ai`
Must equal: notion_ai
body.operations[] (oneOf 2).fieldsobjectRequired within parentThe credit limit to apply to this agent.
Additional keys: not allowed
body.operations[] (oneOf 2).fields.credit_limitJSONRequired within parentThe per-agent credit limit as a non-negative integer, or null to clear the limit.
body.operations[] (oneOf 2).fields.credit_limit (oneOf 1)integerAlternative
body.operations[] (oneOf 2).fields.credit_limit (oneOf 2)nullAlternative
body.operations[] (oneOf 3)objectAlternativeAdditional keys: not allowed
body.operations[] (oneOf 3).actionstringRequired within parentSoft-delete one agent, equivalent to `DELETE /v1/agents/:agent_id`.
Must equal: delete
body.operations[] (oneOf 3).agent_idJSONRequired within parentThe agent ID (a UUID), or `notion_ai` for the personal agent. Endpoint-specific restrictions still apply.
body.operations[] (oneOf 3).agent_id (anyOf 1)stringAlternative
body.operations[] (oneOf 3).agent_id (anyOf 2)stringAlternativeAlways `notion_ai`
Must equal: notion_ai

Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$objectRootAdditional keys: allowed
created_timestringRequired within parentFormat: date-time
idstringRequired within parentMinimum length: 1
objectstringRequired within parentMust equal: async_task
operationobjectRequired within parentAdditional keys: allowed
operation.namestringRequired within parentMinimum length: 1
operation.surfacestringRequired within parentKnown values: rest, mcp
poll_after_secondsJSONRequired within parent
poll_after_seconds (anyOf 1)integerAlternativeMinimum: 0
poll_after_seconds (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
statusstringRequired within parentKnown values: queued, running, retrying
status_urlstringRequired within parentMinimum length: 1

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"}

Official provider source

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand which product and documentation features are useful.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

You can change these choices at any time from Cookie settings.