> For the complete documentation index, see [llms.txt](https://diffio.ai/llms.txt). This page is also available as HTML at https://diffio.ai/docs/api-reference/complete-project-upload/.

# Complete a project's upload

Optional call after `upload.requests.complete` that probes and prepares the uploaded recording immediately, starting any queued generation right away.

POST `https://api.diffio.ai/v2/projects/{project_id}/upload/complete`

- Key scope: `projects:write`
- Auth header: `Authorization: Bearer <apiKey>`
- Body: None

**The HTTP upload sequence, call by call**

1. POST `/projects` id and upload
2. POST `upload.requests.start.url` uploadId
3. PUT `upload.requests.part.url (one per part)` etag per part
4. POST `upload.requests.complete.url` sizeBytes, etag
5. POST `/projects/{project_id}/upload/complete` optional; status preparing or ready

Every edge call: `Authorization: Bearer {upload_token}` Parts ≤ 32 MiB (`part_size_bytes`, numbered from 1)

## Request

Pass `project_id` in the path after all parts and `upload.requests.complete` have succeeded; takes no body.

### Path parameters

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `project_id` | string | Yes | Unique identifier of the project. |

### Headers

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `Diffio-End-User` | string | No | Optional end-user identifier (up to 128 characters). Scopes the request to that end user's projects; omit to act across the whole account. |

## Example request

**Python**

```python
import os
from diffio import DiffioClient

key = os.environ["DIFFIO_API_KEY"]
client = DiffioClient(api_key=key)

project = client.projects.complete_upload(
    "62f62565-049f-5e7e-bbd2-9de0cf7ddbfe",
)
```

**Node.js**

```javascript
import { DiffioClient } from "diffio"

const client = new DiffioClient({
  apiKey: process.env.DIFFIO_API_KEY,
})

const project =
  await client.projects.completeUpload(
    "62f62565-049f-5e7e-bbd2-9de0cf7ddbfe",
  )
```

**cURL**

```bash
curl -X POST "https://api.diffio.ai/v2/projects/62f62565-049f-5e7e-bbd2-9de0cf7ddbfe/upload/complete" \
  -H "Authorization: Bearer $DIFFIO_API_KEY"
```

## Response

Returns the updated `project` (`preparing`, `ready`, or `failed`), including `latest_generation`.

Success: `200`

### Response fields

| Field | Type | Present | Description |
| --- | --- | --- | --- |
| `id` | string | Always | Unique project identifier (UUID). |
| `object` | string | Always | Resource type, always `"project"`. |
| `status` | string | Always | Upload and preparation state: `awaiting_upload` until bytes arrive, `preparing` while media is probed, `ready` when ready to restore, or `failed`. |
| `file_name` | string \| null | Always | Recording filename as sent at creation, or `null`. |
| `content_type` | string \| null | Always | MIME type sent at creation (`application/octet-stream` when none was sent), or `null`. |
| `size_bytes` | integer \| null | Always | File size in bytes: the uploaded byte count once the upload arrives, before that the `size_bytes` sent at creation; `null` when unknown. |
| `duration_seconds` | number \| null | Always | Recording duration in seconds once `status` is `ready`, or `null` while awaiting upload or preparing. |
| `has_video` | boolean | Always | True when the recording has video: inferred from `content_type` or the file name until the upload is probed, then from the file itself. |
| `end_user` | string \| null | Always | End-user identifier from the `Diffio-End-User` header at creation, or `null` for account-level projects. |
| `metadata` | object | Always | Key-value string map saved with the project (`{}` when none was supplied). |
| `generation_count` | integer | Always | Total number of generations created for this project. |
| `video_preview_status` | string \| null | Always | State of a video project's picture-only HLS stream (`video_hls`): `preparing`, `ready`, or `failed`; `null` for audio projects. |
| `share_id` | string \| null | Always | Public 17-character share identifier while a share is published, or `null` when unshared. |
| `latest_generation` | object \| null | Always | Newest `Generation` object on this project, or `null` when no generation exists yet. |
| `created_at` | string \| null | Always | ISO 8601 UTC timestamp when the project was created, or `null`. |
| `updated_at` | string \| null | Always | ISO 8601 UTC timestamp when the project last changed, or `null`. |
| `error` | object \| null | Always | Failure details when `status` is `failed`, or `null` otherwise. |
| `error.code` | string | Always | Stable `snake_case` project failure code (`media_processing_failed` or `project_failed`). |
| `error.message` | string | Always | Human-readable explanation of why the upload could not be prepared. |

## Example response (200)

**Successful response**

```json
{
  "id": "62f62565-049f-5e7e-bbd2-9de0cf7ddbfe",
  "object": "project",
  "status": "ready",
  "file_name": "interview.mp3",
  "content_type": "audio/mpeg",
  "size_bytes": 510957,
  "duration_seconds": 31.9,
  "has_video": false,
  "end_user": "customer-mwe8tm1g",
  "metadata": {
    "order_id": "1042"
  },
  "generation_count": 0,
  "video_preview_status": null,
  "latest_generation": null,
  "share_id": null,
  "created_at": "2026-11-13T00:33:21.812909Z",
  "updated_at": "2026-11-13T00:33:26.311000Z",
  "error": null
}
```

## Return codes

- `200` Upload verified and the updated `project` is returned.
- `400` Malformed JSON body, or `Diffio-End-User` exceeds 128 characters. [`invalid_json`](https://diffio.ai/docs/api-reference/errors/#invalid_json) [`invalid_header`](https://diffio.ai/docs/api-reference/errors/#invalid_header)
- `403` Key is inactive or lacks `projects:write`. [`permission_denied`](https://diffio.ai/docs/api-reference/errors/#permission_denied)
- `404` No project with that `project_id` exists for this account and end user. [`project_not_found`](https://diffio.ai/docs/api-reference/errors/#project_not_found)
- `409` Upload bytes have not finished landing in storage yet. [`upload_missing`](https://diffio.ai/docs/api-reference/errors/#upload_missing)
- `413` Stored upload exceeds the 2 GB (`2,147,483,648` bytes) limit. [`upload_too_large`](https://diffio.ai/docs/api-reference/errors/#upload_too_large)
- `503` Storage service temporarily unavailable while verifying the upload (code unavailable).
- **`401` `405` Same on every endpoint**

  - `401` Missing API key (code missing_api_key), or invalid API key (code invalid_api_key).
  - `405` HTTP method not supported on this path; check the Allow header (code method_not_allowed).

### Example error response

Errors are JSON: an `error` object with `code`, `message` and `request_id`. An unrecognized key returns `401`:

**Error response**

```json
{
  "error": {
    "code": "invalid_api_key",
    "message": "Invalid API key.",
    "request_id": "dead773b60e148fd9e22d680a22fa701"
  }
}
```

## Notes

- Calling this endpoint is optional: the media upload edge notifies Diffio automatically about 30 seconds after `upload.requests.complete` finishes.
- Safe to repeat; calling it again on an already `ready` project returns the current `project` unchanged.
- If probing reveals an unreadable or unsupported media container, the call returns `200` with `status: "failed"` and `error.code: "media_processing_failed"`.

## Related pages

- Previous: [Get new upload instructions](https://diffio.ai/docs/api-reference/reopen-project-upload/): Mint fresh 24-hour multipart upload instructions for a project awaiting its file.
- Next: [Create a generation](https://diffio.ai/docs/api-reference/create-generation/): Start a speech restoration generation on a project with a chosen model.

- [Full API guide](https://diffio.ai/docs/developers/full-api-guide/): Every topic, limit and concept in one index.
- [Diffio API overview](https://diffio.ai/api-overview/): The cloud batch workflow and SDKs on one page.
