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

# Upload Files

> Generate a pre-signed URL for file upload to S3

<Info>
  Call this endpoint to get a signed URL which you can use to upload files to the system. You will receive a key along with the signed URL.

  After you have uploaded the file, you need to create a record of it using the [Create File](/api-reference/files/create) endpoint.

  Use the key you received in the response to create the file record.
</Info>


## OpenAPI

````yaml POST /files/upload
openapi: 3.1.0
info:
  title: duohub Retriever API
  description: >-
    Retrieve assisted or non-assisted memory from a duohub knowledge graph. For
    best performance, use the official `duohub` Python package.
  version: 1.0.0
servers:
  - url: https://api.duohub.ai
security:
  - APIKeyHeader: []
paths:
  /files/upload:
    post:
      tags:
        - Files
      summary: Upload File
      description: Generate a pre-signed URL for file upload to S3
      operationId: uploadFile
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - fileName
              properties:
                fileName:
                  type: string
                  description: Name of the file to upload
            example:
              fileName: document.pdf
      responses:
        '200':
          description: Pre-signed URL generated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - success
                  data:
                    type: object
                    properties:
                      uploadUrl:
                        type: string
                        description: Pre-signed S3 URL for file upload
                      key:
                        type: string
                        description: S3 key where the file will be stored
                required:
                  - status
                  - data
                example:
                  status: success
                  data:
                    uploadUrl: >-
                      https://bucket-name.s3.region.amazonaws.com/user123/abc123.pdf?X-Amz-Algorithm=...
                    key: user123/abc123.pdf
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error message
                  status:
                    type: string
                    enum:
                      - bad_request
                required:
                  - error
                  - status
                examples:
                  no_headers:
                    value:
                      error: No headers provided
                      status: bad_request
                  invalid_json:
                    value:
                      error: Invalid JSON in request body
                      status: bad_request
components:
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
      description: 'Your duohub API key. Type: str'

````