Reserve signed uploads in bulk
import { FloraClient } from '@flora-ai/flora';
const client = new FloraClient({ apiKey: process.env['FLORA_API_KEY'] });
const asset = await client.assets.reserveUploads({ workspace_id: 'ws_abc123', uploads: [ {}, ],});console.log(asset);curl -X POST 'https://app.flora.ai/api/v1/assets/reserve' \ -H 'Authorization: Bearer $FLORA_API_KEY' \ -H 'Content-Type: application/json' \ -d '{ "workspace_id": "ws_abc123", "uploads": [ {} ]}'Reserves up to 25 signed uploads in one request — the batch counterpart of POST /assets with source=“signed-url”, counted once against the workspace’s rate limit instead of once per file. workspace_id, project_id and folder apply to every upload; an upload’s own folder overrides the shared one. Each entry in assets echoes its index and carries either the single reservation’s fields (asset_id, upload, upload_url, expires_at, url) or ok false with an error; a failed entry, such as an unsupported content_type, never stops the rest. GLB entries require project_id and exact size_bytes. A workspace this credential cannot write, or a project_id outside the workspace, fails the whole request. Upload each file’s bytes using the returned descriptor: existing formats use multipart POST, while GLB uses raw-byte PUT to its resumable session. Then finish them in one call with POST /assets/complete. As on the single reservation, project_id associates each asset with a project; supported static media are surfaced on its canvas, while GLB Model3D assets are not auto-placed. Mutating public API requests support an optional Idempotency-Key header for client retries; duplicate keys within two hours return idempotency_duplicate, and a batch whose every entry was rejected releases its key (see the Idempotency guide).
Error responses use the standard error body.
Authorizations
Section titled “ Authorizations ”Request Body required
Section titled “ Request Body required ”object
Workspace identifier. Use the public API ID returned by list workspaces; it must start with ws_.
Project identifier. Use the public API ID returned by list projects; it must start with prj_. Every upload is associated with this project. Supported static media are surfaced on its canvas after completion; GLB Model3D assets are not auto-placed.
Destination folder for uploads that set none
Uploads to reserve, 1 to 25 per call
object
Asset file name. Signed uploads keep a supported filename extension. If the extension is missing or unsupported, the storage key uses the extension for a supported content_type, or .bin when content_type is omitted. Completion validates the uploaded bytes.
Asset content type, pinned in this upload’s policy
Destination folder for this upload
Responses
Section titled “ Responses ”Uploads reserved; each entry reports its own outcome.
object
One entry per requested upload, in request order: ok true with the single reservation’s fields, or ok false with error
object
Asset identifier
Asset URL
Workspace identifier
object
Upload URL
Upload form fields
object
object
Resumable upload session URL
Required upload headers
object
Upload URL (serialized)
Expiration time for the upload URL
Position of this entry in the request’s list
This upload was reserved
object
Position of this entry in the request’s list
This entry failed; error says why
Why this entry failed
object
Stable public API error code, as the single-asset operation would return it
Human-readable reason this entry failed
Example
{ "assets": [ { "asset_id": "asset_abc123", "uploaded_via": "signed_url", "workspace_id": "ws_abc123", "visibility": "workspace", "status": "pending_upload", "upload": { "method": "POST", "content_type": "multipart/form-data", "file_field": "file" }, "upload_url": "https://storage.googleapis.com/flora-user-assets", "ok": true } ]}