Skip to content

Notion: Retrieve a session

Notion sessions.retrieveSession: arguments, response, policy and SDK examples.

← Sessions operations · Get started

Operation notion.retrieve_session

Provider route: GET /v1/sessions/{session_id}. 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["sessions"]["retrieveSession"]>[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.sessions.retrieveSession(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.sessions.retrieve_session(arguments)
result = await call.wait()
return result.body_json()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
pathobjectRequired within parentAdditional keys: not allowed
path.session_idstringRequired within parentThe ID of the session to retrieve.

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
agent_idstringRequired within parent
agent_versionJSONRequired within parent
agent_version (anyOf 1)objectAlternativeAdditional keys: allowed
agent_version (anyOf 1).idstringRequired within parent
agent_version (anyOf 1).numberJSONRequired within parent
agent_version (anyOf 1).number (anyOf 1)integerAlternativeMinimum: 1
agent_version (anyOf 1).number (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
agent_version (anyOf 1).published_atstringRequired within parentFormat: date-time
agent_version (anyOf 2)nullAlternative
chat_user_emailsJSONOptional
chat_user_emails (anyOf 1)arrayAlternative
chat_user_emails (anyOf 1)[]stringEach item
chat_user_emails (anyOf 2)nullAlternative
created_atstringRequired within parentFormat: date-time
created_byobjectRequired within parentAdditional keys: allowed
created_by.idstringRequired within parent
created_by.typestringRequired within parentOne of: `user`, `bot`
Known values: user, bot
credits_usedJSONOptionalPremium AI credits this session consumed. Reported with at most two decimal places, rounded down.
credits_used (anyOf 1)JSONAlternative
credits_used (anyOf 1) (anyOf 1)numberAlternative
credits_used (anyOf 1) (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
credits_used (anyOf 2)nullAlternative
errorobjectOptionalAdditional keys: allowed
error.codestringRequired within parent
error.messagestringRequired within parent
error.retryablebooleanRequired within parent
idstringRequired within parent
message_countJSONOptional
message_count (anyOf 1)JSONAlternative
message_count (anyOf 1) (anyOf 1)integerAlternativeMinimum: 0
message_count (anyOf 1) (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
message_count (anyOf 2)nullAlternative
modelsJSONRequired within parent
models (anyOf 1)objectAlternativeAdditional keys: allowed
models (anyOf 1).typestringRequired within parentAlways `auto`
Must equal: auto
models (anyOf 2)objectAlternativeAdditional keys: allowed
models (anyOf 2).idsarrayRequired within parent
models (anyOf 2).ids[]JSONEach item
models (anyOf 2).ids[] (anyOf 1)stringAlternative
models (anyOf 2).ids[] (anyOf 2)nullAlternative
models (anyOf 2).typestringRequired within parentAlways `pinned`
Must equal: pinned
objectstringRequired within parentAlways `session`
Must equal: session
required_actionsarrayOptional
required_actions[]objectEach itemAdditional keys: allowed
required_actions[].action_idstringRequired within parent
required_actions[].optionsarrayRequired within parentMaximum items: 100
required_actions[].options[]objectEach itemAdditional keys: allowed
required_actions[].options[].idstringRequired within parentOne of: `approve`, `reject`
Known values: approve, reject
required_actions[].options[].labelstringRequired within parent
required_actions[].titlestringRequired within parent
runs_completedJSONOptional
runs_completed (anyOf 1)JSONAlternative
runs_completed (anyOf 1) (anyOf 1)integerAlternativeMinimum: 0
runs_completed (anyOf 1) (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
runs_completed (anyOf 2)nullAlternative
statusstringRequired within parentOne of: `queued`, `in_progress`, `requires_action`, `completed`, `failed`, `canceled`, `terminated`
Known values: queued, in_progress, requires_action, completed, failed, canceled, terminated
titlestringRequired within parent
tool_call_countJSONOptional
tool_call_count (anyOf 1)JSONAlternative
tool_call_count (anyOf 1) (anyOf 1)integerAlternativeMinimum: 0
tool_call_count (anyOf 1) (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
tool_call_count (anyOf 2)nullAlternative
tool_typesJSONOptional
tool_types (anyOf 1)arrayAlternative
tool_types (anyOf 1)[]stringEach item
tool_types (anyOf 2)nullAlternative
trigger_typestringOptional
type_labelsJSONOptional
type_labels (anyOf 1)arrayAlternative
type_labels (anyOf 1)[]stringEach item
type_labels (anyOf 2)nullAlternative
updated_atstringRequired within parentFormat: date-time

SDK function policy ID: notion.retrieve_session. Catalog operation: retrieve_session. 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.