Skip to content
lumalabs.ai

List files

client.Files.List(ctx, query) (*FileList, error)
GET/files

List the files in your namespace, newest first. Keyset-paginated: when has_more is true, pass next_cursor back as cursor.

ParametersExpand Collapse
query FileListParams
Cursor param.Field[string]optional

Opaque pagination cursor from a prior response's next_cursor.

Limit param.Field[int64]optional

Maximum files to return (1–100). Defaults to 25.

minimum1
maximum100
Purpose param.Field[FilePurpose]optional

Filter to files with this purpose.

State param.Field[FileState]optional

Filter to files in this state.

ReturnsExpand Collapse
type FileList struct{…}

Keyset-paginated page of files, newest first. When has_more is true, pass next_cursor back as the cursor query parameter to fetch the next page. next_cursor is opaque.

Data []File

Files in this page.

ID string

File identifier, referenced as ImageRef.file_id.

formatuuid
CreatedAt Time

Creation timestamp.

formatdate-time
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.

One of the following:
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.

One of the following:
const FileStatePending FileState = "pending"
const FileStateReady FileState = "ready"
const FileStateFailed FileState = "failed"
const FileStateDeleted FileState = "deleted"
DeletedAt Timeoptional

Soft-delete timestamp, if the file was deleted.

formatdate-time
ExpiresAt Timeoptional

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
FailureReason stringoptional

Human-readable reason when state is failed.

Filename stringoptional

Original filename supplied at upload, if any.

UserID stringoptional

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

HasMore bool

Whether more files exist beyond this page.

NextCursor stringoptional

Opaque cursor for the next page, when has_more is true.

List files

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"),
  )
  fileList, err := client.Files.List(context.TODO(), lumaagents.FileListParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", fileList.Data)
}
{
  "data": [
    {
      "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"
    }
  ],
  "has_more": true,
  "next_cursor": "next_cursor"
}
Returns Examples
{
  "data": [
    {
      "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"
    }
  ],
  "has_more": true,
  "next_cursor": "next_cursor"
}