Files & uploads
Many generations take file inputs — reference images, inpainting masks, poses, depth maps, or audio. You upload a file once, then pass its file_id into generation requests.
Upload flow
Section titled “Upload flow”Uploads go directly to storage with a resumable upload. You request a signed URL, then upload the bytes yourself.
-
Request an upload URL
Terminal window curl -X POST https://api.app.layer.ai/api/v1/workspaces/$WORKSPACE_ID/files/upload-url \-H "Authorization: Bearer $LAYER_TOKEN" \-H "Content-Type: application/json" \-d '{ "content_type": "image/png" }'# → { "file_id": "…", "upload_url": "https://storage.googleapis.com/…", "content_type": "image/png", "source_type": "asset" } -
Start a resumable session by POSTing to
upload_urlwith thex-goog-resumable: startheader; the response’sLocationis your session URI. -
Upload the bytes with a
PUTto the session URI.
Supported types & sizes
Section titled “Supported types & sizes”| Type | Content types | Max size |
|---|---|---|
| Image | image/png, image/jpeg, image/webp |
64 MB |
| Video | video/mp4 |
64 MB |
| Audio | audio/wav, audio/mpeg |
64 MB |
| Archive | application/zip |
100 MB |
Using files in a generation
Section titled “Using files in a generation”Pass the returned file_id into a generation request. Reference images and other guidance go in guidance_files; an inpainting mask goes in mask (request it with source_type: "mask", and it must be an image):
{ "model_id": "MODEL_ID", "parameters": { "prompt": "replace the sky with aurora", "guidance_files": [{ "file_id": "FILE_ID" }], "mask": { "file_id": "MASK_FILE_ID" } }}Layer resolves each file_id to the stored object internally — you don’t pass URLs.
Downloads
Section titled “Downloads”There is no download endpoint. Generated outputs are returned as URLs in the run result (see Async jobs); fetch those directly.