> ## Documentation Index
> Fetch the complete documentation index at: https://docs.genviral.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Complete Multipart Upload

> Assemble uploaded parts, verify the media, and create the CDN-backed Media Library record.

Completing a multipart upload assembles the parts and runs the same verification as
`POST /files/{fileId}/finalize`: the stored bytes must decode as the declared media type, and
videos must contain a playable video stream. Only then is the CDN `file.url` created.

## Body Parameters

<ParamField body="parts" type="array" required>
  Every part from [Start Multipart Upload](/api-reference/start-multipart-upload), each once:
  `{ "partNumber": 1, "etag": "\"…\"" }`. `etag` is the `ETag` response header from that part's
  PUT, quoted or not. Order does not matter.
</ParamField>

Send a stable `Idempotency-Key`. Retrying with the same key returns the same finalized file.

## Response

`200` with `file` (`id`, `url`, `contentType`, `filename`, `size`, `createdAt`). Videos also
include `attestation` with the verified `durationMs`, `width`, `height`, and `sha256`.

<ResponseExample>
  ```json Response theme={null}
  {
    "ok": true,
    "code": 200,
    "message": "Upload finalized",
    "data": {
      "file": {
        "id": "11111111-1111-4111-8111-111111111111",
        "url": "https://cdn.vireel.io/verified-media/.../11111111-1111-4111-8111-111111111111.mp4",
        "contentType": "video/mp4",
        "filename": "phone-footage.mp4",
        "size": 367001600,
        "createdAt": "2026-10-02T12:00:00.000Z"
      },
      "attestation": {
        "sha256": "…",
        "sizeBytes": 367001600,
        "durationMs": 61250,
        "width": 2160,
        "height": 3840,
        "hasVideoStream": true,
        "hasAudioStream": true
      }
    }
  }
  ```
</ResponseExample>

## Error Responses

* `400 upload_failed` - a part is missing, listed twice, or its `etag` does not match the
  uploaded part; the upload expired or was aborted; or the bytes failed verification
* `400 invalid_request` - `Idempotency-Key` is missing or invalid
* `422 invalid_payload` - `parts` is empty or malformed


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.