> ## Documentation Index
> Fetch the complete documentation index at: https://developers.notion.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create or update a session

> Start a session, send a message, submit an action, or stream a session turn.

Omit `session_id` to start a session, or provide one to add a message or submit a required action to an existing session.

### Stream a session turn

Send the same request with `Accept: text/event-stream` to receive server-sent events instead of a JSON session response. Streaming supports replaying an event with `continue_from`; that field is only valid with the SSE response.

```bash theme={null}
curl --request POST "https://api.notion.com/v1/sessions" \
  --header "Authorization: Bearer $NOTION_TOKEN" \
  --header "Notion-Version: 2026-03-11" \
  --header "Accept: text/event-stream" \
  --header "Content-Type: application/json" \
  --data '{"agent_id":"<agent-id>","message":"Summarize this week’s work."}'
```


## OpenAPI

````yaml post /v1/sessions
openapi: 3.1.0
info:
  title: Notion API
  version: 1.0.0
  termsOfService: >-
    https://notion.notion.site/Terms-and-Privacy-28ffdd083dc3473e9c2da6ec011b58ac
servers:
  - url: https://api.notion.com
security:
  - bearerAuth: []
tags:
  - name: Databases
    description: Database endpoints
  - name: Data sources
    description: Data source endpoints
  - name: Pages
    description: Page endpoints
  - name: Async tasks
    description: Async task endpoints
  - name: Blocks
    description: Block endpoints
  - name: Comments
    description: Comment endpoints
  - name: File uploads
    description: File upload endpoints
  - name: OAuth
    description: OAuth endpoints (basic authentication)
  - name: Users
    description: User endpoints
  - name: Search
    description: Search endpoints
  - name: Views
    description: View endpoints
  - name: Agents
    description: Agent endpoints
  - name: Sessions
    description: Session endpoints
  - name: Custom emojis
    description: Custom emoji endpoints
  - name: Meeting notes
    description: Meeting notes endpoints
paths:
  /v1/sessions:
    post:
      tags:
        - Sessions
      summary: Update a session
      operationId: update-session
      parameters:
        - $ref: '#/components/parameters/notionVersion'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - type: object
                  properties:
                    message:
                      type: string
                      maxLength: 10000
                    agent_id:
                      oneOf:
                        - $ref: '#/components/schemas/idRequest'
                        - type: string
                          enum:
                            - notion_ai
                            - 33333333-3333-3333-3333-333333333333
                          description: >-
                            One of: `notion_ai`,
                            `33333333-3333-3333-3333-333333333333`
                    session_id:
                      $ref: '#/components/schemas/idRequest'
                    attachments:
                      type: array
                      items:
                        type: object
                        properties:
                          file_upload:
                            type: object
                            properties:
                              id:
                                type: string
                                maxLength: 200
                            additionalProperties: false
                            required:
                              - id
                          type:
                            type: string
                            const: file_upload
                            description: Always `file_upload`
                          name:
                            type: string
                            maxLength: 1000
                        additionalProperties: false
                        required:
                          - file_upload
                      maxItems: 100
                    metadata:
                      type: object
                      additionalProperties:
                        type: string
                        maxLength: 2000
                      maxProperties: 20
                    prompt_context:
                      type: string
                      maxLength: 10000
                  additionalProperties: false
                  required:
                    - message
                - type: object
                  properties:
                    session_id:
                      $ref: '#/components/schemas/idRequest'
                    actions:
                      type: array
                      items:
                        type: object
                        properties:
                          action_id:
                            $ref: '#/components/schemas/idRequest'
                          option_id:
                            type: string
                            enum:
                              - approve
                              - reject
                            description: 'One of: `approve`, `reject`'
                        additionalProperties: false
                        required:
                          - action_id
                          - option_id
                      maxItems: 100
                      minItems: 1
                      uniqueItems: true
                    metadata:
                      type: object
                      additionalProperties:
                        type: string
                        maxLength: 2000
                      maxProperties: 20
                  additionalProperties: false
                  required:
                    - session_id
                    - actions
                - type: object
                  properties:
                    session_id:
                      $ref: '#/components/schemas/idRequest'
                    continue_from:
                      type: string
                      maxLength: 200
                  additionalProperties: false
                  required:
                    - session_id
                    - continue_from
              title: Update session request
              description: >-
                Exactly one mode: append a message, answer pending actions, or
                replay from an event.
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  object:
                    type: string
                    const: session
                    description: Always `session`
                  id:
                    type: string
                  agent_id:
                    type: string
                  title:
                    type: string
                  status:
                    type: string
                    enum:
                      - queued
                      - in_progress
                      - requires_action
                      - completed
                      - failed
                      - canceled
                      - terminated
                    description: >-
                      One of: `queued`, `in_progress`, `requires_action`,
                      `completed`, `failed`, `canceled`, `terminated`
                  created_at:
                    type: string
                    format: date-time
                  updated_at:
                    type: string
                    format: date-time
                  required_actions:
                    type: array
                    items:
                      type: object
                      properties:
                        action_id:
                          type: string
                        title:
                          type: string
                        options:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                                enum:
                                  - approve
                                  - reject
                                description: 'One of: `approve`, `reject`'
                              label:
                                type: string
                            additionalProperties: false
                            required:
                              - id
                              - label
                          maxItems: 100
                      additionalProperties: false
                      required:
                        - action_id
                        - title
                        - options
                    maxItems: 100
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      retryable:
                        type: boolean
                    additionalProperties: false
                    required:
                      - code
                      - message
                      - retryable
                additionalProperties: false
                required:
                  - object
                  - id
                  - agent_id
                  - title
                  - status
                  - created_at
                  - updated_at
        '400':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error_api_400'
        '401':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error_api_401'
        '403':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error_api_403'
        '404':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error_api_404'
        '406':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error_api_406'
        '409':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error_api_409'
        '429':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error_api_429'
        '500':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error_api_500'
        '503':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error_api_503'
        '504':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error_api_504'
        '529':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error_api_529'
      x-codeSamples:
        - lang: javascript
          label: TypeScript SDK
          source: |-
            import { Client } from "@notionhq/client"

            const notion = new Client({ auth: process.env.NOTION_API_KEY })

            // Start a session by omitting session_id
            const session = await notion.sessions.update({
              agent_id: "1f0c7c06-781b-4987-9986-5c8dd3028013",
              message: "What can you help me with?"
            })

            // Continue it by passing the session_id back
            const followUp = await notion.sessions.update({
              session_id: session.id,
              message: "Summarize that as bullet points."
            })
components:
  parameters:
    notionVersion:
      name: Notion-Version
      in: header
      required: true
      schema:
        enum:
          - '2026-03-11'
      description: >-
        The [API version](/reference/versioning) to use for this request. The
        latest version is `2026-03-11`.
  schemas:
    idRequest:
      type: string
    error_api_400:
      allOf:
        - $ref: '#/components/schemas/publicApiCommonErrorResponse'
        - type: object
          properties:
            code:
              enum:
                - invalid_json
                - invalid_request_url
                - invalid_request
                - missing_version
                - invalid_beta
                - validation_error
                - invalid_credit_limit
            status:
              const: 400
          required:
            - code
            - status
          additionalProperties: false
    error_api_401:
      allOf:
        - $ref: '#/components/schemas/publicApiCommonErrorResponse'
        - type: object
          properties:
            code:
              enum:
                - unauthorized
            status:
              const: 401
          required:
            - code
            - status
          additionalProperties: false
    error_api_403:
      oneOf:
        - allOf:
            - $ref: '#/components/schemas/publicApiCommonErrorResponse'
            - type: object
              properties:
                code:
                  enum:
                    - restricted_resource
                    - status_change_not_allowed
                status:
                  const: 403
              required:
                - code
                - status
              additionalProperties: false
        - allOf:
            - $ref: '#/components/schemas/publicApiCommonErrorResponse'
            - type: object
              properties:
                code:
                  const: workspace_credits_exhausted
                status:
                  const: 403
                additional_data:
                  type: object
                  properties:
                    tool_error_code:
                      const: workspace_credits_exhausted
                    tool_error_class:
                      const: entitlement_required
                    tool_error_retryable:
                      const: 'false'
                    recovery_kind:
                      enum:
                        - contact_workspace_owner
                        - open_workspace_credit_settings
                      description: The recovery action selected by Notion for the caller.
                    recovery_url:
                      type: string
                      format: uri
                      description: >-
                        Present when recovery_kind directs the caller to a
                        settings page.
                  required:
                    - tool_error_code
                    - tool_error_class
                    - tool_error_retryable
                    - recovery_kind
                  additionalProperties:
                    oneOf:
                      - type: string
                      - type: array
                        items:
                          type: string
              required:
                - code
                - status
                - additional_data
        - allOf:
            - $ref: '#/components/schemas/publicApiCommonErrorResponse'
            - type: object
              properties:
                code:
                  const: agent_credit_limit_reached
                status:
                  const: 403
                additional_data:
                  type: object
                  properties:
                    tool_error_code:
                      const: agent_credit_limit_reached
                    tool_error_class:
                      const: entitlement_required
                    tool_error_retryable:
                      const: 'false'
                    recovery_kind:
                      enum:
                        - contact_workspace_owner
                        - none
                        - open_agent_settings
                        - request_agent_limit_increase
                        - request_pending
                      description: The recovery action selected by Notion for the caller.
                    recovery_url:
                      type: string
                      format: uri
                      description: >-
                        Present when recovery_kind directs the caller to a
                        settings page.
                  required:
                    - tool_error_code
                    - tool_error_class
                    - tool_error_retryable
                    - recovery_kind
                  additionalProperties:
                    oneOf:
                      - type: string
                      - type: array
                        items:
                          type: string
              required:
                - code
                - status
                - additional_data
    error_api_404:
      allOf:
        - $ref: '#/components/schemas/publicApiCommonErrorResponse'
        - type: object
          properties:
            code:
              enum:
                - object_not_found
                - directory_not_found
            status:
              const: 404
          required:
            - code
            - status
          additionalProperties: false
    error_api_406:
      allOf:
        - $ref: '#/components/schemas/publicApiCommonErrorResponse'
        - type: object
          properties:
            code:
              enum:
                - row_limit_exceeded
            status:
              const: 406
          required:
            - code
            - status
          additionalProperties: false
    error_api_409:
      allOf:
        - $ref: '#/components/schemas/publicApiCommonErrorResponse'
        - type: object
          properties:
            code:
              enum:
                - conflict_error
                - idempotency_key_reused
                - agent_deleted
            status:
              const: 409
          required:
            - code
            - status
          additionalProperties: false
    error_api_429:
      allOf:
        - $ref: '#/components/schemas/publicApiCommonErrorResponse'
        - type: object
          properties:
            code:
              enum:
                - rate_limited
            status:
              const: 429
          required:
            - code
            - status
          additionalProperties: false
    error_api_500:
      allOf:
        - $ref: '#/components/schemas/publicApiCommonErrorResponse'
        - type: object
          properties:
            code:
              enum:
                - internal_server_error
            status:
              const: 500
          required:
            - code
            - status
          additionalProperties: false
    error_api_503:
      allOf:
        - $ref: '#/components/schemas/publicApiCommonErrorResponse'
        - type: object
          properties:
            code:
              enum:
                - service_unavailable
            status:
              const: 503
          required:
            - code
            - status
          additionalProperties: false
    error_api_504:
      allOf:
        - $ref: '#/components/schemas/publicApiCommonErrorResponse'
        - type: object
          properties:
            code:
              enum:
                - gateway_timeout
            status:
              const: 504
          required:
            - code
            - status
          additionalProperties: false
    error_api_529:
      allOf:
        - $ref: '#/components/schemas/publicApiCommonErrorResponse'
        - type: object
          properties:
            code:
              enum:
                - service_overload
            status:
              const: 529
          required:
            - code
            - status
          additionalProperties: false
    publicApiCommonErrorResponse:
      type: object
      properties:
        object:
          const: error
        message:
          type: string
        additional_data:
          type: object
          additionalProperties:
            oneOf:
              - type: string
              - type: array
                items:
                  type: string
      required:
        - object
        - message
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````