Blob Upload Tokens
Mint a short-lived upload token with POST /v1/upload-tokens so a browser can upload straight to Blob Storage without your API key.
POST
string
required
The API key for your account. You can find this in your account settings.
blob:write scope and a paid plan.
The token goes in the Authorization header of Object Post or the chunked upload routes, and works nowhere else (403 UPLOAD_TOKEN_NOT_ALLOWED). Everything you set when minting it is pinned: the browser can’t change the name, prefix, visibility, expiry or metadata, send a larger file, or use another file type.
- Each upload spends one use: a call to Object Post, or opening a chunked upload (its parts and completion don’t spend more).
- Without a
name, the browser picks it and the name always gets a security hash, so a leaked token can never replace your existing files. - The token stops working when its uses run out (
401 UPLOAD_TOKEN_USED), when it expires or when the API key that minted it is revoked (401 ACCESS_DENIED).
string
Pins the file name. Without it, the browser sends
name in the query.string
Pins the prefix. A browser that sends a different one gets
403 PREFIX_NOT_ALLOWED.boolean
Pins the visibility.
boolean
Only with
name: false lets the upload replace the file with that name. Otherwise the name always gets a hash.string | null
Pins the expiry (
30d, 6h), or null for none. Under 7 days needs Enterprise.number
Maximum file size in bytes, from 512 to 10737418240 (10 GiB).
string[]
Accepted extensions, 1 to 20, lowercase and without the dot (
png, tar.gz).object
Metadata added to every file uploaded with the token. Pro and Enterprise only.
number
default:"900"
How long the token lasts, from 60 to 3600 seconds.
number
default:"1"
How many uploads the token allows, from 1 to 100.
Rate limits
120 tokens per minute (
RATE_LIMITED, 429). Minting stores nothing, so one token per end-user upload is fine.Response
string
“success” if successful, “error” if not.
object
Errors
When the browser uploads:
401 UPLOAD_TOKEN_USED (used up), 401 ACCESS_DENIED (expired or revoked), 403 PREFIX_NOT_ALLOWED (other prefix), 400 FILE_TYPE_NOT_ALLOWED (extension not allowed) and 413 FILE_TOO_LARGE (over max_size).
