---
title: "Close a large file’s upload"
method: POST
path: "/api/v1/documents/{id}/content/complete"
tags: ["Files"]
---

# Close a large file’s upload

`POST /api/v1/documents/{id}/content/complete`

## Request

- Base URL: `http://localhost:5180`
- URL: `http://localhost:5180/api/v1/documents/{id}/content/complete`
- Auth: API key in cookie `better-auth.session_token`

Stitches the parts into the object, once every part has landed and the folded chain of their hashes ends where the declared sha256 said it would. A chain that ends anywhere else aborts the upload and marks it failed: the bytes that arrived are not the clip that was declared.

## Path parameters

- `id` string, required

## Request body

- object
  - `parts` object[], required: Every part, with the etag PUT answered for it. Order does not matter here; the numbers do.
    - `partNumber` integer, required
    - `etag` string, required

## Response `200`

The clip is stored and can be downloaded.

- object
  - `ok` unknown, required
  - `data` object, required
    - `documentId` string, required: Stable record id, e.g. `lse_012`.
    - `state` 'stored', required
    - `bytes` integer, required: What R2 measured across every part.
    - `uploadedAt` string, required: ISO 8601 timestamp.
  - `meta` object, required
    - `requestId` string, required: Echoed in the x-request-id header. Quote it in a bug report.

## Other responses

- `400`: Parts are missing, or the chain does not end at the declared sha256.
- `401`: No session. Sign in first.
- `404`: No document with that id belongs to you.
- `409`: No multipart upload is open for this document.
- `429`: Over the file budget.

---

[API](https://skmtc.dev/dardaris/apis/dardaris-api.md) · [All operations](https://skmtc.dev/dardaris/apis/dardaris-api/llms.txt) · [OpenAPI document](https://skmtc.dev/dardaris/apis/dardaris-api/revisions/4aff33835c73?raw)
