Skip to content

List Files

Retrieve a list of uploaded files.

Endpoint

GET /v1/files

Authentication

Authorization: Bearer gw_prod_...

Query Parameters

ParameterTypeRequiredDescription
purposestringNoFilter by purpose
statusstringNoFilter by status: uploaded, processing, processed, error
limitintegerNoNumber of results (1-100, default 20)
afterstringNoCursor for pagination
orderstringNoSort order: asc or desc (default)

Examples

List All Files

bash
curl https://api.gateflow.ai/v1/files \
  -H "Authorization: Bearer gw_prod_..."

Python

python
import openai

client = openai.OpenAI(
    base_url="https://api.gateflow.ai/v1",
    api_key="gw_prod_..."
)

files = client.files.list()

for file in files.data:
    print(f"{file.id}: {file.filename} ({file.status})")

Filter by Purpose

bash
curl "https://api.gateflow.ai/v1/files?purpose=document" \
  -H "Authorization: Bearer gw_prod_..."
python
files = client.files.list(purpose="document")

Filter by Status

bash
curl "https://api.gateflow.ai/v1/files?status=processed" \
  -H "Authorization: Bearer gw_prod_..."

Pagination

python
# Get first page
files = client.files.list(limit=10)

# Get next page
if files.has_more:
    next_files = client.files.list(
        limit=10,
        after=files.data[-1].id
    )

Combined Filters

bash
curl "https://api.gateflow.ai/v1/files?purpose=document&status=processed&limit=50" \
  -H "Authorization: Bearer gw_prod_..."

Response

json
{
  "object": "list",
  "data": [
    {
      "id": "file-abc123",
      "object": "file",
      "bytes": 1024000,
      "created_at": 1708099200,
      "filename": "document.pdf",
      "purpose": "document",
      "status": "processed",
      "status_details": null,
      "metadata": {
        "client": "acme"
      }
    },
    {
      "id": "file-def456",
      "object": "file",
      "bytes": 512000,
      "created_at": 1708012800,
      "filename": "report.docx",
      "purpose": "document",
      "status": "processed",
      "status_details": null,
      "metadata": {}
    }
  ],
  "has_more": true,
  "first_id": "file-abc123",
  "last_id": "file-def456"
}

Response Fields

FieldTypeDescription
objectstringAlways "list"
dataarrayArray of file objects
has_morebooleanWhether more results exist
first_idstringID of first item
last_idstringID of last item

File Object Fields

FieldTypeDescription
idstringUnique file identifier
objectstringAlways "file"
bytesintegerFile size in bytes
created_atintegerUnix timestamp of creation
filenamestringOriginal filename
purposestringFile purpose
statusstringProcessing status
status_detailsstringError details if failed
metadataobjectCustom metadata

GateFlow Extensions

List with Processing Details

bash
curl "https://api.gateflow.ai/v1/files?include=processing" \
  -H "Authorization: Bearer gw_prod_..."

Response:

json
{
  "object": "list",
  "data": [
    {
      "id": "file-abc123",
      "filename": "document.pdf",
      "status": "processed",
      "gateflow": {
        "process_id": "proc_xyz789",
        "pages": 15,
        "chunks": 42,
        "vectors_stored": true,
        "pii_detected": 3,
        "classification": "confidential"
      }
    }
  ]
}

List by Collection

bash
curl "https://api.gateflow.ai/v1/files?collection=legal-docs" \
  -H "Authorization: Bearer gw_prod_..."

List by Metadata

bash
curl "https://api.gateflow.ai/v1/files?metadata.client=acme" \
  -H "Authorization: Bearer gw_prod_..."

Errors

CodeDescription
400Invalid query parameters
401Invalid API key
429Rate limit exceeded

See Also

Built with reliability in mind.