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

# Create and index a document

> Ingest text, a URL, or a PDF/TXT file up to 20 MB. Text is split, embedded, and stored as chunks. A URL is fetched and summarized before indexing. A PDF is stored and its extracted text is indexed. The organization knowledge base is limited to 10 MB of chunk content. When using the internal server API key, send `organization_id`.



## OpenAPI

````yaml post /v1/documents
openapi: 3.0.3
info:
  title: Vatel AI REST API
  description: >-
    Programmatic access for agents, documents, telephony, and session tokens.
    Send `Authorization: Bearer <organization API key>` on all requests unless
    noted. Most error responses return JSON with an `error` string message.
  version: 0.2.6
servers:
  - url: https://api.vatel.ai
    description: Production
security:
  - bearerAuth: []
tags:
  - name: organization
    description: Organization tied to your API key
  - name: llms
    description: LLM model identifiers
  - name: voices
    description: TTS voice catalog
  - name: agents
    description: Agents, outbound dial, agent versions, and graph versions
  - name: twilio
    description: Imported Twilio phone numbers
  - name: sip-trunks
    description: SIP trunk configuration
  - name: session
    description: Session tokens and voice WebSocket connections.
  - name: documents
    description: Organization knowledge documents and indexed chunks
  - name: calls
    description: Call history, recordings, and live eavesdrop for your organization
  - name: usage-logs
    description: Per-request usage rows for calls and chats
  - name: eavesdrop
    description: Listen to live calls and send supervisor commands over WebSocket.
paths:
  /v1/documents:
    post:
      tags:
        - documents
      summary: Create and index a document
      description: >-
        Ingest text, a URL, or a PDF/TXT file up to 20 MB. Text is split,
        embedded, and stored as chunks. A URL is fetched and summarized before
        indexing. A PDF is stored and its extracted text is indexed. The
        organization knowledge base is limited to 10 MB of chunk content. When
        using the internal server API key, send `organization_id`.
      operationId: createDocument
      parameters:
        - name: organization_id
          in: query
          required: false
          description: >-
            Organization UUID. Required when the request is authenticated with
            the internal server API key; ignored for organization API keys.
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DocumentCreateRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/DocumentFileUpload'
      responses:
        '201':
          description: Indexed document
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Document'
        '400':
          description: Invalid body, unsupported file, empty text, or knowledge base limit
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '502':
          description: Embedding or summary failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    DocumentCreateRequest:
      oneOf:
        - type: object
          required:
            - type
            - text
          properties:
            type:
              type: string
              enum:
                - text
            text:
              type: string
        - type: object
          required:
            - type
            - url
          properties:
            type:
              type: string
              enum:
                - url
            url:
              type: string
              format: uri
    DocumentFileUpload:
      type: object
      required:
        - file
      properties:
        file:
          type: string
          format: binary
          description: PDF or TXT file up to 20 MB.
    Document:
      type: object
      required:
        - id
        - organization_id
        - type
        - created_at
      properties:
        id:
          type: string
          format: uuid
        organization_id:
          type: string
          format: uuid
        type:
          $ref: '#/components/schemas/DocumentType'
        file_type:
          $ref: '#/components/schemas/DocumentFileType'
        file_name:
          type: string
        path:
          type: string
          description: Storage path of an uploaded PDF.
        value:
          type: string
          description: Indexed text. For a URL this is the summary.
        created_at:
          type: string
          format: date-time
    ErrorResponse:
      type: object
      description: Standard error body for most non-2xx JSON responses on this API.
      required:
        - error
      properties:
        error:
          type: string
          description: Human-readable message; may include validation detail.
    DocumentType:
      type: string
      enum:
        - url
        - text
        - file
    DocumentFileType:
      type: string
      enum:
        - pdf
        - txt
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: 'Send your organization API key as `Authorization: Bearer <key>`.'

````

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