## Complete a presigned upload `client.Files.Complete(ctx, fileID) (*File, error)` **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. ### Parameters - `fileID string` ### Returns - `type File struct{…}` A file in the caller's namespace. - `ID string` File identifier, referenced as ImageRef.file_id. - `CreatedAt Time` Creation timestamp. - `MimeType 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. - `const FilePurposeInput FilePurpose = "input"` - `const FilePurposeReference FilePurpose = "reference"` - `SizeBytes int64` 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. - `const FileStatePending FileState = "pending"` - `const FileStateReady FileState = "ready"` - `const FileStateFailed FileState = "failed"` - `const FileStateDeleted FileState = "deleted"` - `DeletedAt Time` Soft-delete timestamp, if the file was deleted. - `ExpiresAt Time` 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. - `FailureReason string` Human-readable reason when state is failed. - `Filename string` Original filename supplied at upload, if any. - `UserID string` The opaque end-user tag supplied at upload, echoed back unchanged. Abuse-attribution only; not an access-control primitive. ### Example ```go package main import ( "context" "fmt" "github.com/lumalabs/luma-agents-go" "github.com/lumalabs/luma-agents-go/option" ) func main() { client := lumaagents.NewClient( option.WithAuthToken("My Auth Token"), ) file, err := client.Files.Complete(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", file.ID) } ``` #### Response ```json { "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" } ```