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

# Inject Context

> Appends a single free-text context entry to a running session — for example a summary of an earlier voice call. The entry is added to the session's context bucket.



## OpenAPI

````yaml POST /v1/chat/session/{id}/inject_context
openapi: 3.1.0
info:
  title: OSVI AI API
  description: REST API for the OSVI AI voice and chat platform
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.osvi.ai
security:
  - ApiToken: []
paths:
  /v1/chat/session/{id}/inject_context:
    post:
      summary: Inject context into a session
      description: >-
        Appends a single free-text context entry to a running session — for
        example a summary of an earlier voice call. The entry is added to the
        session's context bucket.
      parameters:
        - name: id
          in: path
          required: true
          description: The session UUID.
          schema:
            type: string
            example: 4718a326-417b-4dda-90d0-21fd65a11cb8
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - context
              properties:
                context:
                  type: string
                  description: A single, non-empty context string to append to the session.
                  example: >-
                    Earlier voice call: customer wants a refund and prefers
                    WhatsApp follow-up.
      responses:
        '200':
          description: Context appended.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      session_id:
                        type: string
                        example: 4718a326-417b-4dda-90d0-21fd65a11cb8
                      context:
                        type: array
                        items:
                          type: string
                        description: The session's context bucket after appending.
                        example:
                          - Initial context for this chat
                          - >-
                            Earlier voice call: customer wants a refund and
                            prefers WhatsApp follow-up.
        '400':
          description: >-
            `context` is missing, not a string, or blank (`context must be a
            string` / `context_required`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatV1Error'
        '401':
          description: Invalid or missing API token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatV1Error'
        '404':
          description: No session matches the given `id` (`session_not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatV1Error'
        '502':
          description: The chat engine could not be reached or returned an error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatV1EngineError'
components:
  schemas:
    ChatV1Error:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
          description: Machine-readable error code or message.
          example: agent_not_found
    ChatV1EngineError:
      type: object
      description: >-
        Returned when the upstream chat engine rejects or fails a proxied
        request.
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
          example: Python engine returned 422 for POST /v1/chat/session/{id}/support
        upstream_body:
          type: object
          nullable: true
          description: Parsed error body returned by the chat engine, when available.
          example:
            state: rejected
            reason: tell_not_allowed_during_takeover
  securitySchemes:
    ApiToken:
      type: apiKey
      in: header
      name: API-Token
      description: >-
        16-character API token associated with your OSVI account. Find it in
        your dashboard under Settings → API.

````