Upload a file
POST/files
Upload a file to your namespace, then reference it from a generation via ImageRef.file_id (as source, image_ref[], video.start_frame, keyframes, and so on). Two upload modes share this endpoint, selected by Content-Type:
-
multipart/form-data — send the bytes inline in the
filepart. Best for small files (subject to an inline size cap; larger files must use the presigned flow). The returned file is alreadypendingingest. -
application/json — request a presigned upload. The response
uploadenvelope tells you where to PUT the bytes; afterward call POST /files/{file_id}/complete to start ingest. Use this for larger files.
Body Parameters JSON
Returns
Upload a file
curl https://agents.lumalabs.ai/v1/files \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $LUMA_AGENTS_API_KEY" \ -d '{ "mime_type": "x", "size_bytes": 1 }'201 example
{ "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "file": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created_at": "2019-12-27T18:11:19.117Z", "mime_type": "mime_type", "purpose": "input", "size_bytes": 0, "state": "pending", "deleted_at": "2019-12-27T18:11:19.117Z", "expires_at": "2019-12-27T18:11:19.117Z", "failure_reason": "failure_reason", "filename": "filename", "user_id": "user_id" }, "state": "pending", "upload": { "expires_at": "2019-12-27T18:11:19.117Z", "method": "method", "url": "https://example.com", "headers": { "foo": "string" } }}Returns Examples
201 example
{ "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "file": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created_at": "2019-12-27T18:11:19.117Z", "mime_type": "mime_type", "purpose": "input", "size_bytes": 0, "state": "pending", "deleted_at": "2019-12-27T18:11:19.117Z", "expires_at": "2019-12-27T18:11:19.117Z", "failure_reason": "failure_reason", "filename": "filename", "user_id": "user_id" }, "state": "pending", "upload": { "expires_at": "2019-12-27T18:11:19.117Z", "method": "method", "url": "https://example.com", "headers": { "foo": "string" } }}