---
title: "Finalize a direct file upload"
method: POST
path: "/api/files/upload-complete"
tags: ["Files"]
---

# Finalize a direct file upload

`POST /api/files/upload-complete`

## Request

- Base URL: `https://core-api.getaptly.com`
- URL: `https://core-api.getaptly.com/api/files/upload-complete`
- Auth: one of:
  - API key in header `x-token`
  - API key in header `Authorization`
  - HTTP bearer
- TypeScript: <https://skmtc.dev/getaptly/apis/aptly-api/docs/api/files/upload-complete/post.ts> (a function with typed inputs; its response is checked against the schema)

Final (third) step of the direct file-upload flow. Confirms the file
was uploaded to S3 and records it. Call this with the `fileId` from
`/api/files/upload-url` after the `multipart/form-data` POST to the
presigned `url` succeeded. Returns the file's download URL.

## Request body

- object
  - `fileId` string, required: The `fileId` returned by `/api/files/upload-url`.

## Response `200`

Upload finalized.

- object
  - `fileId` string: ID of the stored file.
  - `url` string: Download URL for the stored file.

## Other responses

- `400`: Missing fileId or the upload was already completed.
- `401`: Invalid or missing credential.
- `404`: No pending upload found.

---

[API](https://skmtc.dev/getaptly/apis/aptly-api.md) - [All operations](https://skmtc.dev/getaptly/apis/aptly-api/llms.txt) - [OpenAPI document](https://skmtc.dev/getaptly/apis/aptly-api/revisions/75c367e0b8e5?raw)
