POST
Presign upload URLs

Overview

Issues short-lived presigned PUT URLs for direct browser/app uploads to DigitalOcean Spaces. The client never streams bytes through the API — files go directly to object storage using the returned URL and headers, then are confirmed via POST /uploads/confirm. The request specifies a single fileType (TENANCY_DOC, HOME_PHOTO, or AVATAR) and a list of files, each with its mimeType and sizeBytes. The server validates per-file limits (see below), builds an object key of the form tenancy-docs/{userId}/{ulid}.{ext} (private bucket), listings/{userId}/{ulid}.{ext} (public bucket), or avatars/{userId}/{ulid}.{ext} (public bucket), and signs a PUT URL valid for 10 minutes. Per-file validation:
  • TENANCY_DOC: mimeType ∈ ; sizeBytes ≤ 10,000,000.
  • HOME_PHOTO: mimeType ∈ ; 50,000 ≤ sizeBytes ≤ 10,000,000.
  • AVATAR (profile photo): mimeType ∈ ; sizeBytes ≤ 10,000,000 (no minimum). After confirming, pass the returned uploadId as avatarUploadId to PATCH /users/me.
  • CHAT_MEDIA (chat attachment): mimeType ∈ images , video , docs ; sizeBytes ≤ 50,000,000 (no minimum). Public bucket, key chat-media/{userId}/{ulid}.{ext}. Post the returned CDN url back on a chat message’s media.url — see send-message.
The client MUST send the upload with the exact headers returned in headers (Content-Type and any Content-Length-Range / signature headers) — DigitalOcean rejects the PUT otherwise. See Upload flow for the full pipeline.

Authentication

Bearer <accessToken> required. Scope: user.

Path parameters

None.

Query parameters

None.

Request body

File object

Example payload

Response — 200 OK

PresignedFile object

Example response

Error responses

Example error — 400

Side effects

  • No database writes yet — the uploads row is created on confirm.
  • No bytes are streamed through the API; the response is purely cryptographic (SigV4 signature) plus the generated object key.

See also

curl