Skip to content
lumalabs.ai

Complete a presigned upload

POST/files/{file_id}/complete

Finalize a presigned upload after you have PUT the bytes to the upload URL. Kicks off ingest/moderation and returns the file, which transitions to ready (or failed) asynchronously — poll GET /files/{file_id} to observe the terminal state.

Path ParametersExpand Collapse
file_id: string
formatuuid
ReturnsExpand Collapse
File = object { id, created_at, mime_type, 8 more }

A file in the caller's namespace.

id: string

File identifier, referenced as ImageRef.file_id.

formatuuid
created_at: string

Creation timestamp.

formatdate-time
mime_type: string

MIME type of the stored bytes (for example, image/jpeg).

purpose: FilePurpose

How the file is intended to be used in a generation. input is the primary subject (e.g. the source image for an edit); reference is style/content guidance.

One of the following:
"input"
"reference"
size_bytes: number

Size of the stored object in bytes.

state: FileState

Lifecycle state of an uploaded file. pending until bytes are received and the ingest pipeline runs; ready once it can be referenced from a generation; failed if ingest/moderation rejected it; deleted after a soft-delete.

One of the following:
"pending"
"ready"
"failed"
"deleted"
deleted_at: optional string

Soft-delete timestamp, if the file was deleted.

formatdate-time
expires_at: optional string

TTL set at upload, if any. After this time Luma may automatically delete the file and reclaim its bytes — you don't need to call DELETE yourself.

formatdate-time
failure_reason: optional string

Human-readable reason when state is failed.

filename: optional string

Original filename supplied at upload, if any.

user_id: optional string

The opaque end-user tag supplied at upload, echoed back unchanged. Abuse-attribution only; not an access-control primitive.

Complete a presigned upload

curl https://agents.lumalabs.ai/v1/files/$FILE_ID/complete \
    -X POST \
    -H "Authorization: Bearer $LUMA_AGENTS_API_KEY"
{
  "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"
}
Returns Examples
{
  "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"
}