Uploads

Issue a presigned PUT URL for direct-to-R2 media uploads

Mobile clients upload media directly to R2 instead of proxying through the origin. Server picks the storage key under uploads/{user_id}/{uuid}.{ext} — clients cannot supply a key.

post/uploads/presign

Request

  • Base URL: https://www.sociahive.com/api/v1
  • URL: https://www.sociahive.com/api/v1/uploads/presign
  • Auth: one of:
    • API key in header X-API-Key
    • OAuth 2 (authorization code, authorization URL /api/oauth/authorize, token URL /api/oauth/token, scopes: uploads:write)

Request body

filenamestring required

Client-supplied display name. Used for logging only; server picks the storage key.

mime_type'image/jpeg' | 'image/png' | 'image/webp' | 'video/mp4' | 'video/quicktime' required

Allowed MIME types only. Anything else is rejected with invalid_input.

size_bytesinteger required

File size in bytes. Per-tier limits: Growth 25 MB, Scale 100 MB, Agency 500 MB.

Example request

{
  "filename": "IMG_4823.jpg",
  "size_bytes": 5242880
}

Response

Presigned upload URL

keystring required

The server-chosen storage key. Send it to POST /uploads/verify after the PUT.

upload_urlstring uri required

Short-lived presigned PUT URL. Issue a single HTTP PUT carrying every header in required_headers.

required_headersobject

Headers the PUT MUST carry verbatim. Each value is bound into the URL's SigV4 signature, so omitting or altering one makes R2 reject the upload with 403. Send every entry as returned; do not hardcode the list — it can grow. Optional so a client can fall back to Content-Type + Content-Length against an older server.

public_urlstring uri required

Permanent public URL where the uploaded bytes will be served once the PUT completes.

expires_atstring date-time required

ISO 8601 timestamp at which upload_url stops accepting writes (15 min after issuance).

Example response

{
  "key": "uploads/6f1c.../0b8e1a2c-6a43-4f7e-9c2d-1b7f0c9d3a11.jpg",
  "required_headers": {
    "Content-Type": "image/jpeg",
    "Content-Length": "5242880",
    "Content-Disposition": "attachment"
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.