Skip to content
BrainyShorts Docs
Esc
navigateopen⌘Jpreview

Reserve a managed media upload

Returns a presigned PUT URL, valid for 10 minutes. PUT the bytes, then call PATCH to complete. If already_uploaded is true, skip the PUT and reuse asset_id. Requires the media:write scope.

POST/api/cli/media/uploads
Authorization
AuthorizationBearer token (ba_sk_...) · headerrequired

API key from /dashboard/api-keys. Keys expire after 365 days.

Request body
requiredapplication/json
asset_idstring<uuid>

Optional, for idempotent retries

content_typestringrequired
Allowed:image/jpegimage/pngimage/webpvideo/mp4
content_lengthintegerrequired

Images up to 15 MiB, MP4 up to 200 MiB

min 1
content_sha256stringrequired
matches ^[a-f0-9]{64}$
content_md5stringrequired
matches ^[a-f0-9]{32}$
Responses
201

Reserved

asset_idstring<uuid>
already_uploadedboolean
upload_urlstring<uri>
upload_methodstring
upload_headersobject
expires_atstring<date-time>
mediaobject

Existing asset when already_uploaded is true

nextstring
401

Missing, invalid, expired, or revoked API key

errorstringrequired
codestring
409

MEDIA_UPLOAD_CONFLICT

errorstringrequired
codestring
429

MEDIA_STORAGE_QUOTA_EXCEEDED: over 10 pending uploads, 2,000 objects, or 20 GiB

errorstringrequired
codestring
Try it
Server
Authorization
Bodyapplication/json
Request
curl -X POST "https://www.brainyshorts.com/api/cli/media/uploads" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "asset_id": "b4695157-0d1d-4da0-8f9e-5c53149389e4",
  "content_type": "image/jpeg",
  "content_length": 1,
  "content_sha256": "string",
  "content_md5": "string"
}'
Response
{
  "asset_id": "b4695157-0d1d-4da0-8f9e-5c53149389e4",
  "already_uploaded": true,
  "upload_url": "http://example.com",
  "upload_method": "PUT",
  "upload_headers": {
    "property1": "string",
    "property2": "string"
  },
  "expires_at": "2019-08-24T14:15:22Z",
  "media": {},
  "next": "string"
}