---
title: "Request an upload target for a post image"
method: POST
path: "/api/v1/community/attachments/upload-urls"
tags: ["Community"]
---

# Request an upload target for a post image

`POST /api/v1/community/attachments/upload-urls`

## Request

- Base URL: `https://api-docs.busabase.com`
- URL: `https://api-docs.busabase.com/api/v1/community/attachments/upload-urls`
- Auth: HTTP bearer

## Request body

- object
  - `fileName` string, required
  - `mimeType` string, required: An image type; the error names the accepted list.
  - `contentHash` string: `sha256:<hex>` of the bytes. Supplying it buys store-once dedup — identical bytes resolve to the object that already exists, `duplicate` comes back true, and there is nothing to upload.

## Response `200`

A presigned target plus the URL the image will resolve to. When `duplicate` is true the bytes are already stored and only `publicUrl` matters.

- object
  - `uploadUrl` string, required: PUT the bytes here. Empty when `duplicate` is true, because there are none to send.
  - `storageKey` string, required: Hand back to the confirmation call unchanged.
  - `publicUrl` string, required: Where the image resolves. This is what goes in the markdown.
  - `expiresIn` number, required: Seconds the upload URL stays valid; 0 when `duplicate` is true.
  - `duplicate` boolean, required: These exact bytes were already stored. Skip both the PUT and the confirmation.

## Other responses

- `400`: 400
- `401`: 401
- `403`: 403
- `404`: 404

---

[API](https://skmtc.dev/busabase/apis/busabase-api.md) · [All operations](https://skmtc.dev/busabase/apis/busabase-api/llms.txt) · [OpenAPI document](https://skmtc.dev/busabase/apis/busabase-api/revisions/bc6a7d5ff4c1?raw)
