# Complete an upload

`POST https://api.cademi.com.br/api/v3/uploads/{upload_id}/completions`

Operation ID: `uploads.completions.create` · API v3

Completes a multipart upload after all parts have been sent to the storage service. Provide every part number together with the `ETag` returned by the storage service for that part.

The storage service verifies the integrity of the assembled content. On success, the session moves to `completed` and the response includes the resulting `file`.

If the content does not match the declared size, checksum, or content type, the API returns `upload_integrity_mismatch` with the exact cause in `details[].reason`. The session is then permanently marked as `failed`, and a new upload session is required.

Required permissions: `files.write`.

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `upload_id` | path | string | yes |  |

## Request body

Content type: `application/json`, required.

| Field | Type | Required | Description |
|---|---|---|---|
| `parts` | array of object | yes |  |

## Responses

### 201

Returns the completed upload session, including the resulting file.

Body: `data`: Upload.

Fields of Upload:

| Field | Type | Required | Description |
|---|---|---|---|
| `expires_at` | string (date-time) | yes |  |
| `failure_reason` | string or null | yes |  |
| `file` | File or null | yes |  |
| `filename` | string | yes |  |
| `id` | string | yes | Public ID, with the upl_ prefix. |
| `object` | string, one of `upload` | yes |  |
| `part_size` | integer or null | yes |  |
| `parts_total` | integer or null | yes |  |
| `purpose` | string | yes |  |
| `size_bytes` | integer | yes |  |
| `status` | string, one of `open`, `completed`, `cancelled`, `expired`, `failed` | yes |  |

### 401

The credential is missing, malformed, expired, or revoked.

Body: Error.

### 403

The current credentials do not have the permission required by this operation.

Body: Error.

### 404

The upload session was not found or is not accessible with the current credentials.

Body: Error.

### 409

The upload session is no longer open because it was already completed, cancelled, failed, or expired. Returns the state_conflict error code.

Body: Error.

### 422

The request contains invalid data, or the uploaded content failed the integrity check (uploadintegritymismatch, with the cause in details[].reason).

Body: Error.

### 503

The storage service is temporarily unavailable. Retry the request with backoff.

Body: Error.

Full schema: https://cademi.dev/openapi/v3.json
