Table of Contents

Upload Documents Flow

These endpoints are used to upload a document.

Uploading a document is a three-step process:

  1. Get a presigned URL — Call the Presigned endpoint with document metadata. The response returns an upload_id and a temporary upload_url.

  2. Upload the file — Send the raw file as the body of a PUT request directly to the upload_url returned in step 1. This uploads the file to secure storage.

  3. Complete the upload — Call the Complete endpoint with the upload_id from step 1. This finalizes the document in the system and makes it available.

Flow Diagram

Client                           API                          Storage
  │                               │                              │
  ├── POST /upload/presigned ───► │                              │
  │◄── { upload_id, upload_url } ─┤                              │
  │                               │                              │
  ├── PUT {upload_url} ───────────────────────────────────────►  │
  │◄── 200 OK ────────────────────────────────────────────────── │
  │                               │                              │
  ├── POST /upload/{upload_id} ──►│                              │
  │◄── { document_id } ───────────┤                              │

Important: The upload_url is temporary and expires. Complete all three steps in sequence without significant delay.