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

# Upload Document

> Upload a knowledge document as `multipart/form-data`. Accepted files: `.txt` or `.md`, UTF-8, max 2 MB. `labels` may be a JSON array string or comma/semicolon-delimited values. Label keys must not start with `_`.



## OpenAPI

````yaml /openapi.yaml post /workspaces/{workspaceId}/documents
openapi: 3.1.0
info:
  title: Actx0 API
  version: 1.0.0
  description: >-
    REST API for Actx0 workspaces, access keys, agents, sessions, messages,
    memories, prompts, and knowledge documents.


    Authenticate with `X-Access-Key` (workspace), `X-API-Key` (user), or a
    dashboard session.
servers:
  - url: https://app.actx0.com/api/v1
    description: Actx0 cloud
security: []
tags:
  - name: Me
    description: Inspect the authenticated access key or API key
  - name: API Keys
    description: User API keys for X-API-Key auth
  - name: Workspaces
    description: Team workspaces
  - name: Access Keys
    description: Scoped workspace keys for agents and SDKs
  - name: Agents
    description: Agents inside a workspace
  - name: Sessions
    description: Agent conversation sessions
  - name: Messages
    description: Session messages and semantic search
  - name: Memories
    description: Session memories, search, batch, and regenerate
  - name: Prompts
    description: Versioned prompts
  - name: Knowledge
    description: Document upload and semantic search
paths:
  /workspaces/{workspaceId}/documents:
    post:
      tags:
        - Knowledge
      summary: Upload Document
      description: >-
        Upload a knowledge document as `multipart/form-data`. Accepted files:
        `.txt` or `.md`, UTF-8, max 2 MB. `labels` may be a JSON array string or
        comma/semicolon-delimited values. Label keys must not start with `_`.
      operationId: uploadDocument
      parameters:
        - $ref: '#/components/parameters/WorkspaceId'
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
                - title
              properties:
                file:
                  type: string
                  format: binary
                  description: .txt or .md file, max 2 MB
                title:
                  type: string
                  maxLength: 255
                  example: Product FAQ
                labels:
                  type: string
                  description: >-
                    JSON array string like `["faq","support"]` or
                    comma-separated values
                  example: '["faq","support"]'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Document'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - AccessKeyAuth: []
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: curl
          label: curl / acli
          source: >
            curl -X POST
            'https://app.actx0.com/api/v1/workspaces/<workspaceId>/documents' \
              -H "X-Access-Key: YOUR_ACCESS_KEY" \
              -H "Accept: application/json" \
              -F "title=Onboarding notes" \
              -F "file=@notes.txt"

            # ---


            # acli

            export ACTX0_ACCESS_KEY="YOUR_ACCESS_KEY"

            export ACTX0_WORKSPACE_ID="YOUR_WORKSPACE_ID"


            acli knowledge upload notes.txt \
              --title "Onboarding notes" \
              --label tag=docs \
              --label team=platform
        - lang: python
          label: pctx0
          source: |
            from pctx0 import Pctx0Client

            client = Pctx0Client(
                access_key="YOUR_ACCESS_KEY",
                workspace_id="YOUR_WORKSPACE_ID",
            )

            doc = client.knowledge.upload(
                file="notes.txt",
                title="Onboarding notes",
                labels={"tag": "docs", "team": "platform"},
            )
        - lang: javascript
          label: nctx0
          source: |
            import { Nctx0Client } from "@actx0/nctx0";

            const client = new Nctx0Client({
              accessKey: "YOUR_ACCESS_KEY",
              workspaceId: "YOUR_WORKSPACE_ID",
            });

            const doc = await client.knowledge.upload({
              file: "notes.txt",
              title: "Onboarding notes",
              labels: { tag: "docs", team: "platform" },
            });
        - lang: go
          label: gtcx0
          source: "package main\n\nimport (\n\t\"context\"\n\n\t\"github.com/Actx0/Gctx0\"\n)\n\nfunc main() {\n\tclient := gctx0.NewClient(\n\t\tgctx0.WithAccessKey(\"YOUR_ACCESS_KEY\"),\n\t\tgctx0.WithWorkspaceId(\"YOUR_WORKSPACE_ID\"),\n\t)\n\tdefer client.Close()\n\tctx := context.Background()\n\tdoc, err := client.Knowledge.Upload(\n\t\tctx,\n\t\t\"notes.txt\",\n\t\t\"Onboarding notes\",\n\t\tmap[string]string{\"tag\": \"docs\", \"team\": \"platform\"},\n\t)\n\t_ = doc\n\t_ = err\n}\n"
components:
  parameters:
    WorkspaceId:
      name: workspaceId
      in: path
      required: true
      schema:
        type: string
        format: uuid
      example: 11111111-1111-1111-1111-111111111111
  schemas:
    Document:
      type: object
      required:
        - id
        - workspaceId
        - title
        - filename
        - contentType
        - checksum
        - size
        - charCount
        - status
        - createdAt
        - updatedAt
      properties:
        id:
          type: string
          format: uuid
          example: 88888888-8888-8888-8888-888888888888
        workspaceId:
          type: string
          format: uuid
          example: 11111111-1111-1111-1111-111111111111
        title:
          type: string
          example: Product FAQ
        filename:
          type: string
          example: faq.md
        contentType:
          type: string
          example: text/markdown
        checksum:
          type: string
          example: e3b0c44298fc1c149afbf4c8996fb924
        size:
          type: object
          required:
            - value
            - unit
          properties:
            value:
              type: integer
              example: 2048
            unit:
              type: string
              example: bytes
        charCount:
          type: integer
          example: 1800
        labels:
          type: array
          items:
            type: string
          example:
            - faq
            - support
        chunkingStrategy:
          type: string
          example: recursive
        chunkSize:
          type: integer
          example: 800
        chunkOverlap:
          type: integer
          example: 100
        status:
          type: string
          enum:
            - processing
            - indexed
            - failed
          example: processing
        createdAt:
          type: string
          format: date-time
          example: '2026-07-01T12:00:00Z'
        updatedAt:
          type: string
          format: date-time
          example: '2026-07-01T12:00:00Z'
    Error:
      type: object
      required:
        - errorMessage
      properties:
        errorMessage:
          type: string
          example: Name is required
  securitySchemes:
    AccessKeyAuth:
      type: apiKey
      in: header
      name: X-Access-Key
      description: Workspace access key for agent/runtime integrations.
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: User API key for management and automation.

````