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

# Upload Document

> Upload one file to the knowledge base as multipart/form-data. Requires `documents:write`.

Accepted: PDF up to 20 MB, Word (.docx) and PowerPoint (.pptx) up to 20 MB, Excel (.xlsx/.xlsm) up to 10 MB, images up to 8 MB, CSV and Markdown up to 2 MB. PDFs, Word, PowerPoint, Markdown, and images are indexed in the background; poll `GET /api/v1/documents/{documentId}` until `status` is `completed`. CSV and Excel are stored for agents to read but are not indexed.



## OpenAPI

````yaml /openapi.json post /api/v1/documents
openapi: 3.1.0
info:
  title: OmniCommerce API
  version: 1.0.0
  license:
    name: Proprietary
    url: https://omnicommerce.sg/terms
  description: >-
    OmniCommerce API surface for agents and developer integrations. Includes
    public endpoints (merchant discovery, product search, compare, catalog, ACO
    retrieval) and authenticated endpoints (product management via API key
    Bearer tokens).
servers:
  - url: https://omnicommerce.sg
    description: Production
  - url: http://localhost:3000
    description: Local development
security: []
tags:
  - name: agentic-checkout
    description: Merchant-fulfilled agentic checkout
    x-group: Agentic Checkout
  - name: agents
    description: agents
    x-group: Agents
  - name: analytics
    description: Sales performance across marketplaces
    x-group: Analytics
  - name: aops
    description: Agent operating procedures
    x-group: AOPs
  - name: campaigns
    description: Campaign briefs, offer windows, and marketplace runs
    x-group: Campaigns
  - name: developer-platform
    description: Authenticated developer platform APIs
    x-group: Developer Platform
  - name: documents
    description: Knowledge base document uploads
    x-group: Knowledge Base
  - name: looks
    description: AI-styled product looks
    x-group: Looks
  - name: oauth
    description: OAuth token endpoints
    x-group: OAuth
  - name: orders
    description: Workspace and agentic orders
    x-group: Orders
  - name: organizations
    description: Organization management
    x-group: Organizations
  - name: price-books
    description: Marketplace list-price markup rules
    x-group: Price Books
  - name: products
    description: Product CRUD, bulk import, enrichment, publish, and delist
    x-group: Products
  - name: promotions
    description: Central promotions and marketplace sync
    x-group: Promotions
  - name: public-agent
    description: Public agent discovery and catalog APIs
    x-group: Public Agent
  - name: returns
    description: returns
    x-group: Returns
  - name: reviews
    description: Marketplace product reviews and seller replies
    x-group: Reviews
  - name: settlements
    description: settlements
    x-group: Settlements
  - name: ucp
    description: Universal Commerce Protocol
    x-group: UCP
paths:
  /api/v1/documents:
    post:
      tags:
        - documents
      summary: Upload Document
      description: >-
        Upload one file to the knowledge base as multipart/form-data. Requires
        `documents:write`.


        Accepted: PDF up to 20 MB, Word (.docx) and PowerPoint (.pptx) up to 20
        MB, Excel (.xlsx/.xlsm) up to 10 MB, images up to 8 MB, CSV and Markdown
        up to 2 MB. PDFs, Word, PowerPoint, Markdown, and images are indexed in
        the background; poll `GET /api/v1/documents/{documentId}` until `status`
        is `completed`. CSV and Excel are stored for agents to read but are not
        indexed.
      operationId: post_v1_documents
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
              properties:
                file:
                  type: string
                  format: binary
                  description: The file to upload.
                organizationId:
                  type: string
                  description: >-
                    Required for session auth. API keys already belong to one
                    organization.
                documentType:
                  default: other
                  description: What the document is. `bank_statement` is never shown to AI.
                  type: string
                  enum:
                    - datasheet
                    - invoice
                    - packing_list
                    - compliance_certificate
                    - test_report
                    - sds
                    - manual
                    - warranty
                    - authorization_letter
                    - shipping_doc
                    - regulation
                    - policy
                    - bank_statement
                    - other
                productId:
                  description: >-
                    Attach the document to one product instead of the whole
                    organization.
                  type: string
                  format: uuid
                  pattern: >-
                    ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                fileName:
                  description: File name to store. Defaults to the uploaded file's name.
                  type: string
                  minLength: 1
                  maxLength: 1024
      responses:
        '202':
          description: The document was stored; indexing is queued.
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                  apiVersion:
                    type: string
                    const: developer_v1
                  operationId:
                    type: string
                  status:
                    type: string
                    enum:
                      - accepted
                      - completed
                      - failed
                  jobId:
                    type: string
                  productId:
                    type: string
                  warnings:
                    type: array
                    items:
                      type: string
                  recommendations:
                    type: array
                    items:
                      type: string
                  links:
                    type: object
                    propertyNames:
                      type: string
                    additionalProperties:
                      type: string
                  data:
                    type: object
                    properties:
                      document:
                        type: object
                        properties:
                          id:
                            type: string
                          title:
                            type: string
                          fileName:
                            type: string
                          mimeType:
                            type: string
                          sizeBytes:
                            type: integer
                            minimum: -9007199254740991
                            maximum: 9007199254740991
                          documentType:
                            type: string
                            enum:
                              - datasheet
                              - invoice
                              - packing_list
                              - compliance_certificate
                              - test_report
                              - sds
                              - manual
                              - warranty
                              - authorization_letter
                              - shipping_doc
                              - regulation
                              - policy
                              - bank_statement
                              - other
                          productId:
                            anyOf:
                              - type: string
                              - type: 'null'
                          status:
                            type: string
                            enum:
                              - pending
                              - processing
                              - completed
                              - completed_with_warnings
                              - failed
                            description: >-
                              `pending` and `processing` while indexing;
                              `completed` when agents can search it.
                          indexedChunkCount:
                            anyOf:
                              - type: integer
                                minimum: -9007199254740991
                                maximum: 9007199254740991
                              - type: 'null'
                            description: >-
                              Searchable chunks. CSV and Excel are stored for
                              reading but not indexed, so this is 0.
                          pageCount:
                            anyOf:
                              - type: integer
                                minimum: -9007199254740991
                                maximum: 9007199254740991
                              - type: 'null'
                          errorMessage:
                            anyOf:
                              - type: string
                              - type: 'null'
                          createdAt:
                            type: string
                          updatedAt:
                            type: string
                        required:
                          - id
                          - title
                          - fileName
                          - mimeType
                          - sizeBytes
                          - documentType
                          - productId
                          - status
                          - indexedChunkCount
                          - pageCount
                          - errorMessage
                          - createdAt
                          - updatedAt
                      queued:
                        type: boolean
                        description: Indexing was queued.
                      warning:
                        type: string
                    required:
                      - document
                      - queued
                required:
                  - ok
                  - apiVersion
                  - operationId
                  - status
                  - warnings
                  - recommendations
                  - links
                  - data
        '400':
          description: Invalid request
        '401':
          description: Unauthorized
        '403':
          description: Missing the `documents:write` scope
        '404':
          description: Product not found
        '413':
          description: The request body is not multipart or is too large
        '429':
          description: Rate limit exceeded
        '500':
          description: Internal Server Error
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        Bearer API key for server-to-server access. Session auth is also
        supported in first-party UI flows.

````

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