Skip to content

Reserve signed uploads in bulk

POST
/assets/reserve
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);

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.

Media type application/json
object
workspace_id
required

Workspace identifier. Use the public API ID returned by list workspaces; it must start with ws_.

string
/^ws_\S+$/
project_id

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.

string
/^prj_\S+$/
folder

Destination folder for uploads that set none

string
uploads
required

Uploads to reserve, 1 to 25 per call

Array<object>
>= 1 items <= 25 items
object
file_name

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.

string
content_type

Asset content type, pinned in this upload’s policy

string
size_bytes
integer
folder

Destination folder for this upload

string

Uploads reserved; each entry reports its own outcome.

Media type application/json
object
assets
required

One entry per requested upload, in request order: ok true with the single reservation’s fields, or ok false with error

Array
<= 25 items
Any of:
object
asset_id
required

Asset identifier

string
/^asset_\S+$/
uploaded_via
required
Allowed value: signed_url
url
required

Asset URL

string format: uri
workspace_id
required

Workspace identifier

string
/^ws_\S+$/
visibility
required
Allowed value: workspace
status
required
string
Allowed values: pending_upload ready failed
upload
required
Any of:
object
url
required

Upload URL

string format: uri
method
required
Allowed value: POST
content_type
required
Allowed value: multipart/form-data
file_field
required
Allowed value: file
form_fields
required

Upload form fields

object
key
additional properties
string
upload_url
required

Upload URL (serialized)

string
expires_at
required

Expiration time for the upload URL

string format: date-time
index
required

Position of this entry in the request’s list

integer
ok
required

This upload was reserved

boolean
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
}
]
}