---
title: "Completes a direct external upload"
method: POST
path: "/uploads/complete-external-upload.json"
tags: ["Uploads"]
---

# Completes a direct external upload

`POST /uploads/complete-external-upload.json`

Completes an external upload initialized with /get-presigned-put. The
file will be moved from its temporary location in external storage to
a final destination in the S3 bucket. An Upload record will also be
created in the database in most cases.

If a sha1-checksum was provided in the initial request it will also
be compared with the uploaded file in storage to make sure the same
file was uploaded. The file size will be compared for the same reason.

You must have the correct permissions and CORS settings configured in your
external provider. We support AWS S3 as the default. See:

https://meta.discourse.org/t/-/210469#s3-multipart-direct-uploads-4.

An external file store must be set up and `enable_direct_s3_uploads` must
be set to true for this endpoint to function.

## Request body

- object
  - `unique_identifier` string, required — The unique identifier returned in the original /generate-presigned-put request.
  - `for_private_message` string — Optionally set this to true if the upload is for a private message.
  - `for_site_setting` string — Optionally set this to true if the upload is for a site setting.
  - `pasted` string — Optionally set this to true if the upload was pasted into the upload area. This will convert PNG files to JPEG.

## Response `200`

external upload initialized

- object
  - `id` integer, required
  - `url` string, required
  - `original_filename` string, required
  - `filesize` integer, required
  - `width` integer, required
  - `height` integer, required
  - `thumbnail_width` integer, required
  - `thumbnail_height` integer, required
  - `extension` string, required
  - `short_url` string, required
  - `short_path` string, required
  - `retain_hours` string, nullable, required
  - `human_filesize` string, required
  - `dominant_color` string, nullable
  - `thumbnail` object, nullable
    - `id` integer
    - `upload_id` integer
    - `url` string
    - `extension` string
    - `width` integer
    - `height` integer
    - `filesize` integer
  - `optimized_video` object, nullable
    - `id` integer
    - `upload_id` integer
    - `url` string
    - `extension` string
    - `filesize` integer
    - `sha1` string
    - `original_filename` string

---

[API](https://skmtc.dev/discourse/apis/discourse-api-documentation.md) · [All operations](https://skmtc.dev/discourse/apis/discourse-api-documentation/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/discourse/discourse-api-documentation/revisions/2fd8fd2d6fd0/schema)
