---
title: "Complete a file's upload"
method: POST
path: "/uploads/sessions/{upload_session_id}/complete"
tags: ["Uploads"]
---

# Complete a file's upload

`POST /uploads/sessions/{upload_session_id}/complete`

## Request

- Base URL: `https://api.invoicedataextraction.com/v1`
- URL: `https://api.invoicedataextraction.com/v1/uploads/sessions/{upload_session_id}/complete`
- Auth: HTTP bearer

Finalises one file from the ETags of its uploaded parts. Call it once per file. A file
that is already complete returns success again, so a retry after a dropped connection
is safe.

Rate limit: 600 requests per minute per API key, shared by the upload endpoints.

## Path parameters

- `upload_session_id` string, required: An identifier you choose: 1 to 200 characters from letters, digits, dots, underscores, colons and hyphens. Used for `upload_session_id`, `file_id` and `submission_id`.

## Request body

- CompleteFileUploadRequest
  - `file_id` string, required: An identifier you choose: 1 to 200 characters from letters, digits, dots, underscores, colons and hyphens. Used for `upload_session_id`, `file_id` and `submission_id`.
  - `parts` object[], required
    - `part_number` integer, required
    - `e_tag` string, required: The `ETag` header of the part's `PUT` response, quotes included.

## Response `200`

The file is complete and can be named in an extraction.

- CompleteFileUploadResponse
  - `success` true, required
  - `upload_session_id` string, required: An identifier you choose: 1 to 200 characters from letters, digits, dots, underscores, colons and hyphens. Used for `upload_session_id`, `file_id` and `submission_id`.
  - `file_id` string, required: An identifier you choose: 1 to 200 characters from letters, digits, dots, underscores, colons and hyphens. Used for `upload_session_id`, `file_id` and `submission_id`.
  - `file_name` string, required
  - `status` 'completed': Present when this call completed the file; absent when the file was already complete.

## Other responses

- `400`: `INVALID_INPUT`, or `INVALID_COMPLETION_PARTS` (the parts do not cover 1 to the part count with their ETags; `details.reason` says which check failed).
- `401`: `UNAUTHENTICATED`, `API_KEY_EXPIRED` or `API_KEY_REVOKED`.
- `404`: `FILE_NOT_FOUND`: this `file_id` was not registered when the session was created.
- `409`: `FILE_ABORTED` (the file was aborted; upload it in a new session) or `UPLOAD_ID_NOT_FOUND` (the session is no longer available).
- `422`: `OBJECT_SIZE_MISMATCH`: the uploaded bytes differ from the declared `file_size_bytes`; `details` carries `declared_size_bytes` and `actual_size_bytes`.
- `429`: `RATE_LIMITED`: wait `details.retry_after_seconds` (also the `Retry-After` header), then retry.
- `500`: `INTERNAL_ERROR`: retry after a short delay.
- `502`: `UPLOAD_COMPLETE_FAILED`: completing the file failed on our side; retryable.

---

[API](https://skmtc.dev/invoicedataextraction/apis/invoice-data-extraction-api.md) · [All operations](https://skmtc.dev/invoicedataextraction/apis/invoice-data-extraction-api/llms.txt) · [OpenAPI document](https://skmtc.dev/invoicedataextraction/apis/invoice-data-extraction-api/revisions/16d920350483?raw)
