Upload an asset
Upload a local or hosted image to FLORA with the TypeScript SDK or curl and use the resulting asset URL as a Technique or generation input.
To run a Technique or generation on your own image or video, get the file into FLORA first and pass the asset's URL as the input. This recipe covers doing that from your own code with the TypeScript SDK or curl.
Working from an AI client such as Claude, ChatGPT or a coding agent? FLORA MCP has its own upload flow, including a browser upload link for chat clients. See Upload your own images, video and files.
What you'll build: a flow that takes a local file path or a hosted URL, uploads it, and returns a ready FLORA URL to use as an input.
Choose a path
A local file, and you use TypeScript
client.assets.upload(): one call, any size
A file at a public https:// URL
Pass the URL; FLORA fetches it (up to 50 MB)
A local file of 4 MB or less, and you use curl
Send the bytes directly as multipart/form-data
A larger local file, and you use curl
Signed upload: reserve, POST the bytes, complete
Many files
Reserve and complete up to 25 per request
Allowed types are images (JPEG, PNG, WebP, GIF, AVIF, HEIC, HEIF), video (MP4, WebM, QuickTime), audio (MP3, WAV, OGG, M4A) and PDF. Never base64-encode a file into a JSON body.
TypeScript: one call
client.assets.upload() takes a file path, a public URL, a File or Blob, or raw bytes. It sends small files directly, uses a signed upload for large ones, lets FLORA fetch URLs itself, then waits until the asset is ready:
import { FloraClient } from "@flora-ai/flora"
const client = new FloraClient()
const asset = await client.assets.upload("./photo.png", {
workspace_id: "ws_abc123",
project_id: "prj_abc123", // optional: also puts the asset on this project's canvas
})
console.log(asset.asset_id, asset.status, asset.url)A hosted file works the same way, without downloading it first:
If the host needs a login or blocks hotlinking, FLORA can't fetch it. Download the file and upload it from disk instead.
curl: direct bytes (4 MB or smaller)
The response is the asset, with its url.
Signed upload with curl
For files over 4 MB, reserve an upload, send the bytes straight to storage, then mark the asset complete. This script needs jq:
Copy the form fields mechanically; don't edit them or ask anyone for storage credentials. If the reservation expires before you upload, call POST /assets/{assetId}/retry for fresh instructions.
Use it as an input
The ready asset's url is a public HTTPS URL, so it works for any imageUrl or videoUrl Technique input:
For a generation, pass it in the model's image parameter (such as image_url, listed in GET /models). See Generations.
Attach it to a project
Passing project_id at upload puts the asset on that project's canvas. To add an existing asset to a project later:
Upload many files
Every request counts against your workspace's rate limit. For many files, reserve up to 25 signed uploads in one request with POST /assets/reserve, upload each file with its own upload instructions, then complete them in one request with POST /assets/complete. Each counts once, however many files it carries. See Assets for the request and response shapes.
Tips
Wait for
status: "ready"before you pass the URL to a run.client.assets.upload()does this for you.Upload ahead of time. Don't put an upload in the critical path of an interactive UI without a loading state.
A
failedasset has afailure_message, often an unsupported type or a file over the size or 150-megapixel limit.
Related
Assets: every asset endpoint.
Generate a grid: use the uploaded asset as an input.
Iterate on outputs: combine uploaded references with generated outputs.
Last updated
Was this helpful?