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

# Update an AI Chat Session

> Change visibility or Document list of AI Session



## OpenAPI

````yaml POST /api/ai/session/{ai_session_id}/update
openapi: 3.0.3
info:
  title: Petal API Document
  description: Reference document for Petal app
  license:
    name: MIT
  version: 1.2.5
servers:
  - url: https://cite.petal.org
security:
  - bearerAuth: []
tags:
  - name: signup
  - name: extraction
  - name: referral
  - name: site
  - name: citegen
  - name: invite
  - name: user
  - name: tag
  - name: ai
  - name: notification
  - name: organization
  - name: annotation
  - name: search
  - name: attachment
  - name: collection
  - name: discourse
  - name: main
  - name: ai-create
  - name: document
  - name: payment
  - name: comment
  - name: lambda
  - name: sauce
  - name: admin
  - name: error
  - name: opengraph
  - name: default
  - name: media
  - name: file
  - name: oauth
paths:
  /api/ai/session/{ai_session_id}/update:
    post:
      tags:
        - ai
      summary: Update the visibility or metadata of an AI chat session
      description: Change visibility or Document list of AI Session
      operationId: post_/api/ai/session/{ai_session_id}/update
      parameters:
        - description: The unique ID of the AI Session
          in: path
          name: ai_session_id
          required: true
          schema:
            format: int32
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AISessionUpdateBody'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AISession'
          description: OK
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
          description: Unprocessable Entity
components:
  schemas:
    AISessionUpdateBody:
      additionalProperties: false
      properties:
        document_ids:
          items:
            type: integer
          title: Document IDs
          description: List of Document IDs in this Session
          type: array
        meta:
          title: Meta
          description: Metadata, for internal use
          type: object
        visibility:
          title: Visibility
          description: >-
            Whether this session can only be seen by its creator, or by the
            whole Workspace
          type: string
          enum:
            - shared
            - private
          default: shared
      title: AISessionUpdateBody
      type: object
    AISession:
      additionalProperties: false
      properties:
        created_at:
          title: Created At
          description: Creation time, by UTC
          type: string
        document_ids:
          items:
            type: integer
          title: Document IDs
          description: List of Document IDs in this Session
          type: array
        id:
          title: ID
          description: Unique ID of this Session
          type: integer
        is_multidoc:
          title: Is Multidoc
          description: Whether this is a multi-doc chat session
          type: boolean
        meta:
          title: Meta
          description: Session metadata, for internal use
          type: object
        organization_id:
          title: Organization ID
          description: Unique ID of Organization
          type: integer
        user_id:
          title: User ID
          description: Unique ID of user
          type: integer
        visibility:
          title: Visibility
          description: >-
            Whether this session can only be seen by its creator, or by the
            whole Workspace
          type: string
          enum:
            - shared
            - private
          default: shared
      required:
        - id
        - organization_id
        - user_id
        - is_multidoc
        - visibility
        - created_at
        - meta
      title: AISession
      type: object
    ValidationError:
      description: Model of a validation error response.
      items:
        $ref: '#/components/schemas/ValidationError.ValidationErrorElement'
      title: ValidationError
      type: array
    ValidationError.ValidationErrorElement:
      description: Model of a validation error response element.
      properties:
        ctx:
          title: Error context
          type: object
        loc:
          items:
            type: string
          title: Missing field name
          type: array
        msg:
          title: Error message
          type: string
        type:
          title: Error type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationErrorElement
      type: object
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````