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

# Create Document

> Upload a document into a [knowledge base](/line/knowledge-base) folder



## OpenAPI

````yaml /latest.yml POST /agents/documents
openapi: 3.0.1
info:
  title: Cartesia API
  version: 0.0.1
servers:
  - url: https://api.cartesia.ai
    description: Production
security: []
paths:
  /agents/documents:
    post:
      tags:
        - Documents
      summary: Create Document
      description: Upload a document into a [knowledge base](/line/knowledge-base) folder
      operationId: documents_create
      parameters:
        - $ref: '#/components/parameters/CartesiaVersionHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateDocumentBody'
      responses:
        '201':
          description: Document created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentResponse'
        '404':
          description: 'Folder not found (`error_code: kb_folder_not_found`).'
        '413':
          description: Document content exceeds the 1 MB limit.
      security:
        - APIKeyAuth: []
      x-codeSamples:
        - lang: curl
          source: |
            curl -X POST "https://api.cartesia.ai/agents/documents" \
              -H "X-API-Key: your-api-key" \
              -H "Cartesia-Version: 2025-04-16" \
              -H "Content-Type: application/json" \
              -d '{
                "folder_id": "folder_abc",
                "name": "Return Policy",
                "content": "Customers may return any unopened item within 30 days...",
                "metadata": {"category": "policy", "audience": "customer"}
              }'
components:
  parameters:
    CartesiaVersionHeader:
      name: Cartesia-Version
      in: header
      description: API version header.
      required: true
      schema:
        type: string
        format: date
        example: '2026-03-01'
        enum:
          - '2026-03-01'
  schemas:
    CreateDocumentBody:
      title: CreateDocumentBody
      type: object
      properties:
        folder_id:
          type: string
          description: The folder to upload the document into.
        content:
          type: string
          minLength: 1
          description: The document text. Maximum 1 MB.
        name:
          type: string
          nullable: true
          description: An optional display name for the document.
        metadata:
          type: object
          additionalProperties:
            type: string
          description: >-
            User-defined string-keyed metadata. Used to filter retrieval at
            query time.
      required:
        - folder_id
        - content
    DocumentResponse:
      title: DocumentResponse
      type: object
      properties:
        id:
          type: string
          description: The ID of the document.
        name:
          type: string
          nullable: true
          description: The document's display name, or `null` if unnamed.
        content:
          type: string
          description: The full document text.
        created_at:
          type: string
          format: date-time
          description: When the document was uploaded.
        metadata:
          type: object
          additionalProperties:
            type: string
          description: User-defined string-keyed metadata.
      required:
        - id
        - name
        - content
        - created_at
        - metadata
  securitySchemes:
    APIKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        Cartesia API key (`sk_car_...`). Get one at
        [play.cartesia.ai/keys](https://play.cartesia.ai/keys).

````