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

# Upload a document

> Upload a file to the knowledge base. Documents are processed asynchronously; `status` transitions from `processing` to `indexed` when ready for search.



## OpenAPI

````yaml /api-reference/openapi.json post /kbs/{kbId}/docs/upload
openapi: 3.1.0
info:
  title: Autoposting API
  description: >-
    Schedule, publish, and AI-enhance social content across X, LinkedIn,
    Instagram, Threads, and YouTube. All responses use the `{ "success":
    boolean, "data": ... }` envelope. Authenticate with an API key
    (`Authorization: Bearer sk-social-...` or `x-api-key: sk-social-...`).
  version: 1.0.0
servers:
  - url: https://app.autoposting.ai/api-proxy
    description: Production
security:
  - bearerAuth: []
  - apiKeyHeader: []
tags:
  - name: Agents
    description: >-
      Create and manage AI agents that autonomously generate and schedule
      content, trigger runs, inspect outputs, and track statistics.
  - name: API Keys
    description: >-
      Create, list, update, and revoke API keys for programmatic access to the
      Autoposting.ai API.
  - name: Auth
    description: >-
      Signup, login, logout, social login, profile management, email change, and
      session management.
  - name: Billing
    description: >-
      Manage subscriptions, credits, plan changes, billing history, and the
      customer portal.
  - name: Brands
    description: >-
      Create, list, update, delete, and reorder brands. Each brand maps to a set
      of social media accounts.
  - name: Carousels
    description: >-
      Create, manage, and AI-generate carousel posts for LinkedIn and other
      platforms.
  - name: Clips
    description: >-
      Upload, manage, render, and publish video clips, including multipart
      upload, AI candidate generation, and credit billing.
  - name: Knowledge Base
    description: >-
      Knowledge bases, document ingestion, semantic search, and AI content idea
      generation.
  - name: Notifications
    description: List, read, and manage in-app notifications and notification preferences.
  - name: Organizations
    description: >-
      Create, list, update, and delete organizations (workspaces), including a
      safeguarded deletion flow with a grace period.
  - name: Platform OAuth
    description: >-
      Connect social media accounts via OAuth and manage platform tokens for X,
      LinkedIn, Instagram, Threads, and YouTube.
  - name: Posts
    description: Create, manage, schedule, publish, and AI-enhance posts across platforms.
  - name: Teams
    description: >-
      Manage team members, invitations, invite links, permission groups,
      brand-level overrides, ownership transfers, and allowed email domains.
  - name: Usage
    description: >-
      Usage summaries, token breakdowns, feature access, onboarding progress,
      and account management endpoints.
  - name: Webhooks
    description: >-
      Configure outbound webhook endpoints to receive real-time event
      notifications from Autoposting.ai.
paths:
  /kbs/{kbId}/docs/upload:
    parameters:
      - name: kbId
        in: path
        required: true
        schema:
          type: string
        description: Knowledge base ID.
    post:
      tags:
        - Knowledge Base
      summary: Upload a document
      description: >-
        Upload a file to the knowledge base. Documents are processed
        asynchronously; `status` transitions from `processing` to `indexed` when
        ready for search.
      operationId: uploadDocument
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
                  description: 'Document file. Supported formats: PDF, DOCX, TXT, MD.'
              required:
                - file
      responses:
        '200':
          description: Document accepted for processing.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    const: true
                  data:
                    $ref: '#/components/schemas/KbDocument'
                required:
                  - success
                  - data
              example:
                success: true
                data:
                  id: doc_01HXYZ
                  name: doc.pdf
                  status: processing
                  createdAt: '2024-01-01T00:00:00Z'
        '401':
          description: Authentication required — missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KnowledgeBaseError'
              example:
                success: false
                error: Unauthorized
components:
  schemas:
    KbDocument:
      type: object
      properties:
        id:
          type: string
          examples:
            - doc_01HXYZ
        name:
          type: string
          examples:
            - Pricing Guide 2024.pdf
        status:
          type: string
          examples:
            - indexed
          description: >-
            Processing status. Transitions from `processing` to `indexed` when
            ready for search.
        chunkCount:
          type: integer
          examples:
            - 24
        createdAt:
          type: string
          format: date-time
          examples:
            - '2024-01-01T00:00:00Z'
      required:
        - id
        - name
        - status
        - createdAt
    KnowledgeBaseError:
      type: object
      properties:
        success:
          type: boolean
          const: false
        error:
          type: string
          examples:
            - Unauthorized
        message:
          type: string
      required:
        - success
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'API key as `Authorization: Bearer sk-social-...`'
    apiKeyHeader:
      type: apiKey
      in: header
      name: x-api-key
      description: 'API key as `x-api-key: sk-social-...`'

````