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

# Update session grants

> Share this session with subjects and remove access for others in one atomic request. Subjects get read access to the session, its turns and its events. A `tenant` subject, whose `subject_id` must be your tenant ID, shares with everyone in the tenant. Granting an existing subject or revoking one without access is a no-op. Returns every subject the session is shared with.



## OpenAPI

````yaml /openapi.json post /api/v1/sessions/{session_id}/grants
openapi: 3.1.0
info:
  description: >-
    HTTP API for the TrueForge agent server (`/api/v1`). Interactive docs are
    served at `/api/v1/docs` (OpenAPI JSON at `/api/v1/openapi.json`).


    **Authentication:** Standalone auth accepts requests without credentials —
    middleware stamps a local default user. When OIDC or TrueFoundry auth is
    configured, protected routes require a valid cookie or `Authorization:
    Bearer` token. There is no built-in API-key scheme; pass custom headers only
    if your reverse proxy or IdP layer requires them.


    Covers DB-backed sessions, the agent registry, settings catalogs, and
    model/MCP/skill/sandbox providers.
  title: TrueForge API
  version: 0.0.0
servers: []
security:
  - BearerAuth: []
tags:
  - name: Internal
  - name: Auth
  - name: Users
  - name: Capabilities
  - name: Models
  - name: MCP Servers
  - name: Skills
  - name: Sandboxes
  - name: Web Search Providers
  - name: Memory Providers
  - name: Configuration
  - name: Agents
  - name: Schedules
  - name: Agent Sessions
paths:
  /api/v1/sessions/{session_id}/grants:
    post:
      tags:
        - Agent Sessions
      summary: Update session grants
      description: >-
        Share this session with subjects and remove access for others in one
        atomic request. Subjects get read access to the session, its turns and
        its events. A `tenant` subject, whose `subject_id` must be your tenant
        ID, shares with everyone in the tenant. Granting an existing subject or
        revoking one without access is a no-op. Returns every subject the
        session is shared with.
      parameters:
        - description: Session identifier.
          in: path
          name: session_id
          required: true
          schema:
            description: Session identifier.
            maxLength: 64
            minLength: 1
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSessionGrantsRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListSessionGrantsResponse'
          description: Subjects the session is shared with after the change.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RequestErrorResponse'
          description: Invalid request body.
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RequestErrorResponse'
          description: User does not have permission.
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RequestErrorResponse'
          description: Session not found.
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RequestErrorResponse'
          description: >-
            A subject to grant is unknown or is the session creator, or a
            subject is both granted and revoked.
components:
  schemas:
    UpdateSessionGrantsRequest:
      additionalProperties: false
      properties:
        grant:
          default: []
          description: Subjects to share the session with (up to 50).
          items:
            $ref: '#/components/schemas/SessionGrantSubject'
          maxItems: 50
          type: array
        revoke:
          default: []
          description: Subjects to remove access for (up to 50).
          items:
            $ref: '#/components/schemas/SessionGrantSubject'
          maxItems: 50
          type: array
      type: object
    ListSessionGrantsResponse:
      properties:
        data:
          items:
            $ref: '#/components/schemas/SessionGrant'
          type: array
      required:
        - data
      type: object
    RequestErrorResponse:
      properties:
        error:
          properties:
            code:
              description: Optional machine-readable error code; null when not applicable.
              type:
                - string
                - 'null'
            message:
              description: Human-readable explanation of the failure.
              type: string
            param:
              description: >-
                Optional request field that caused the error; null when not
                field-specific.
              type:
                - string
                - 'null'
            type:
              description: Optional error category (e.g. validation vs conflict).
              type: string
          required:
            - message
          type: object
      required:
        - error
      type: object
    SessionGrantSubject:
      additionalProperties: false
      description: Who the session is shared with.
      properties:
        subject_id:
          description: ID of the subject.
          maxLength: 255
          minLength: 1
          type: string
        subject_type:
          $ref: '#/components/schemas/SessionGrantSubjectType'
      required:
        - subject_type
        - subject_id
      type: object
    SessionGrant:
      additionalProperties: false
      properties:
        created_at:
          description: When the session was shared with the subject (ISO-8601 UTC).
          type: string
        granted_by_subject:
          $ref: '#/components/schemas/Subject'
        subject:
          $ref: '#/components/schemas/SessionGrantSubject'
      required:
        - subject
        - granted_by_subject
        - created_at
      type: object
    SessionGrantSubjectType:
      description: >-
        Kind of subject. A `tenant` subject shares the session with everyone in
        the tenant.
      enum:
        - user
        - tenant
      type: string
    Subject:
      additionalProperties: false
      description: Identity of a subject.
      properties:
        subject_display_name:
          description: Display name.
          minLength: 1
          type: string
        subject_id:
          description: Subject id.
          minLength: 1
          type: string
        subject_type:
          description: Subject type.
          minLength: 1
          type: string
      required:
        - subject_id
        - subject_type
        - subject_display_name
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: JWT
      description: >-
        Caller credential (`Authorization: Bearer <token>`). Required on
        protected routes when auth is enabled. Browser sessions may use the
        HttpOnly `id_token` or `accessToken` cookie instead.
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.