---
title: "Complete file uploads"
method: POST
path: "/api/v1/files/uploads/complete"
tags: ["Files"]
---

# Complete file uploads

`POST /api/v1/files/uploads/complete`

## Request

- Base URL: `https://app.khotan.com`
- URL: `https://app.khotan.com/api/v1/files/uploads/complete`
- Auth: one of:
  - HTTP bearer
  - API key in header `x-api-key`

Verifies each prepared upload (object presence and size) and promotes verified files to ready. Returns a per-file ready or failed result instead of failing the whole batch; failed entries carry an error message (e.g. an expired upload window). Completing an already-completed batch is idempotent.

## Request body

- object
  - `files` object[], required
    - `fileId` string, required

## Response `200`

Per-file completion results.

- object
  - `results` union[], required
    - union
      - object
        - `fileId` string, required
        - `status` 'ready', required
        - `file` object, required
          - `id` string, required
          - `name` string, required
          - `contentUrl` string, required: Stable authenticated API URL for opening the file content. It redirects to a short-lived inline storage URL when the file is ready.
          - `folderId` string, nullable, required: The containing folder's id, or null for the root.
          - `path` string, required: The file's full display path, including the file name. Paths change on rename/move; store ids.
          - `kind` 'archive' | 'audio' | 'document' | 'image' | 'other' | 'pdf' | 'spreadsheet' | 'video', required
          - `extension` string, nullable, required
          - `contentType` string, required
          - `sizeBytes` integer, required
          - `status` 'pending' | 'ready', required
          - `createdAt` string, required
          - `updatedAt` string, required
      - object
        - `fileId` string, required
        - `status` 'failed', required
        - `error` string, required

## Other responses

- `400`: The request was malformed or failed validation.
- `401`: Authentication is missing or invalid.
- `403`: The caller is not permitted to perform this action.
- `429`: Too many requests; retry after the indicated delay.

---

[API](https://skmtc.dev/khotan/apis/khotan-api.md) - [All operations](https://skmtc.dev/khotan/apis/khotan-api/llms.txt) - [OpenAPI document](https://skmtc.dev/khotan/apis/khotan-api/revisions/90b512a53e42?raw)
