Reserve an Asset and mint an upload URL
Reserves an Asset and returns a presigned PUT URL to upload the bytes to. The URL is valid for one hour, and expiresAt says when it stops being accepted.
The client uploads directly to storage — the bytes never pass through this worker, because Cloudflare rejects over-limit request bodies at the proxy before any code runs. Call POST /assets/{id}/finalize once the upload completes.
The URL is the credential: anyone holding it can write that one key until it expires. Nothing is known about the file until finalize inspects what actually landed, so size and type cannot be enforced here.
The reserved Asset stays pending until finalize. No read, rename or list answers a pending Asset, and a reservation nobody finalizes is swept a day later, together with whatever landed under it.
Request
- Base URL: https://api.adcrunch.dev
- URL: https://api.adcrunch.dev/assets/uploads
- Auth: HTTP bearer
Request body
Example request
{
"filename": "spring-sale.mp4"
}Response
The reservation. Send the bytes to uploadUrl, then finalize assetId.
Example response
{
"assetId": "ast_7c1e9a",
"expiresAt": 1790003600000,
"uploadUrl": "https://b7f3c81a29d64e0fa5c3d1e8b0947265.r2.cloudflarestorage.com/assets/org_3a7f10/ast_7c1e9a?X-Amz-Expires=3600&X-Amz-Date=20260921T141320Z&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=4f8e2a6c1b9d7e3f5a0c2b4d6e8f1a3c%2F20260921%2Fauto%2Fs3%2Faws4_request&X-Amz-SignedHeaders=host&X-Amz-Signature=7d1c4a9f2e8b0536c1a7e94d2b6f038a5c1e9b7d3f6a2c805d4e1b93a7f0c625"
}Changes
No recorded changes to this operation across all 1 revision of this API.