---
title: "Finish a file upload"
description: "Publishes the file once every part is uploaded."
canonical_url: https://docs.markdrop.in/api/files/finish-a-file-upload
last_updated: 2026-10-30
site: "Markdrop Docs"
index: https://docs.markdrop.in/llms.txt
---

# Finish a file upload

`POST https://api.markdrop.in/api/v1/files/uploads/{upload_id}/complete`

Publishes the file once every part is uploaded. The server checks the SHA-256 first. `200` returns the link. `202` (`{"state": "verifying"}`) means the check is still running: [check the upload](https://docs.markdrop.in/api/files/check-an-upload) until `state` is `done`. Calling it again on a finished upload returns the same result.

- **Authentication:** API token required: `Authorization: Bearer mdk_…`.
- **Rate limit:** 60 per minute per IP address.
- **CLI:** `markdrop upload deck.pdf`
- **MCP tool:** `complete_upload` ([tools](https://docs.markdrop.in/ai/tools))

## Path parameters

- `upload_id` (string, required): The `upload_id` that [Start a file upload](https://docs.markdrop.in/api/files/start-a-file-upload) returned.

## Request body

`application/json`.

- `parts` (array of object): Each part's number and the `ETag` storage returned when you uploaded it. Up to 10,000 items.
  - `part_number` (integer, required): From 1 to 10,000.
  - `etag` (string, required): 1–200 characters.

## Responses

- `200`: Published. Returns the link.
- `202`: Still checking the file. Poll the upload's status.
- `401`: No token, or the token is revoked or mistyped.
- `422`: The request didn't validate. `detail` lists each problem, with where it is (`loc`) and why (`msg`).
- `429`: Too many requests from your IP address. Wait the seconds in `Retry-After`.

## Examples

**curl**

```bash
curl -X POST https://api.markdrop.in/api/v1/files/uploads/UPLOAD_ID/complete \
  -H "Authorization: Bearer $MARKDROP_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"parts":[{"part_number":1,"etag":"ETAG_FROM_THE_PUT"}]}'
```

**JavaScript**

```javascript
const res = await fetch("https://api.markdrop.in/api/v1/files/uploads/UPLOAD_ID/complete", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MARKDROP_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "parts": [
      {
        "part_number": 1,
        "etag": "ETAG_FROM_THE_PUT"
      }
    ]
  }),
});
const data = await res.json();
```

**Python**

```python
import os

import requests

r = requests.post(
    "https://api.markdrop.in/api/v1/files/uploads/UPLOAD_ID/complete",
    headers={"Authorization": f"Bearer {os.environ['MARKDROP_TOKEN']}"},
    json={"parts": [{"part_number": 1, "etag": "ETAG_FROM_THE_PUT"}]},
)
r.raise_for_status()
print(r.json())
```

**CLI**

```bash
markdrop upload deck.pdf
```
