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

# Add context data to the context processor

> This endpoint accepts context data and sends it to a context processor for further handling. It returns a success or error response depending on the result from the context processor.



## OpenAPI

````yaml POST /api/v1/context/add
openapi: 3.1.0
info:
  title: Alchemyst AI API v1 documentation
  version: 1.0.0
  description: v1 API documentation for Alchemyst AI
servers:
  - url: https://platform-backend.getalchemystai.com
    description: production
security:
  - bearerAuth: []
tags: []
paths:
  /api/v1/context/add:
    post:
      tags:
        - context
      summary: Add context data to the context processor
      description: >-
        This endpoint accepts context data and sends it to a context processor
        for further handling. It returns a success or error response depending
        on the result from the context processor.
      operationId: addContextSync
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - documents
                - context_type
                - source
                - scope
              properties:
                documents:
                  type: array
                  items:
                    type: object
                    properties:
                      content:
                        type: string
                        description: The content of the document
                    additionalProperties:
                      type: string
                  description: Array of documents with content and additional metadata
                source:
                  type: string
                  description: The source of the context data
                context_type:
                  type: string
                  enum:
                    - resource
                    - conversation
                    - instruction
                  description: Type of context being added
                scope:
                  type: string
                  enum:
                    - internal
                    - external
                  default: internal
                  description: Scope of the context
                metadata:
                  type: object
                  description: Additional metadata for the context
                  properties:
                    fileName:
                      type: string
                      description: Name of the file
                    fileType:
                      type: string
                      description: Type/MIME of the file
                    groupName:
                      type: array
                      items:
                        type: string
                      description: Array of Group Name to which the file belongs to
                    lastModified:
                      type: string
                      description: Last modified timestamp
                    fileSize:
                      type: number
                      description: Size of the file in bytes
            example:
              documents:
                - content: Customer asked about pricing for the Scale plan.
              source: support-inbox
              context_type: resource
              scope: internal
              metadata:
                fileName: support_thread_TCK-1234.txt
                fileType: text/plain
                groupName:
                  - support
                  - pricing
                lastModified: '2025-01-10T12:34:56.000Z'
                fileSize: 2048
      responses:
        '201':
          description: Context added successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContextAddSuccess'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '402':
          description: Payment Required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not Found - Invalid context data format
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    ContextAddSuccess:
      type: object
      required:
        - success
        - context_id
      properties:
        success:
          type: boolean
          example: true
        context_id:
          type: string
          example: ctx_01HXYZABC
        processed_documents:
          type: number
          example: 2
    ErrorResponse:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          example: false
        message:
          type: string
          example: Invalid job id
        status:
          type: number
          example: 400
        error:
          type: object
          example: Error details
          required:
            - code
            - message
          properties:
            code:
              type: string
              example: UNAUTHORIZED
            message:
              type: string
              example: User not authenticated
            details:
              type: object
              additionalProperties: true
        statusText:
          type: string
          description: Error message (detailed in debug mode)
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````