Skip to main content

GET /v1/files

Returns a paginated list of files.

Authentication

Requires provider authentication headers:
x-portkey-provider: openai
Authorization: Bearer YOUR_OPENAI_API_KEY

Request

Headers

x-portkey-provider
string
required
The provider to route the request to (e.g., openai, azure-openai)
Authorization
string
required
Bearer token for the provider API

Query Parameters

purpose
string
Filter files by purpose (e.g., fine-tune, assistants, batch)

Response

data
array
Array of file objects
object
string
The object type, always “list”

Example

curl https://localhost:8787/v1/files \
  -H "x-portkey-provider: openai" \
  -H "Authorization: Bearer $OPENAI_API_KEY"

Response Example

{
  "data": [
    {
      "id": "file-abc123",
      "object": "file",
      "bytes": 140,
      "created_at": 1613779121,
      "filename": "training_data.jsonl",
      "purpose": "fine-tune"
    },
    {
      "id": "file-def456",
      "object": "file",
      "bytes": 2048,
      "created_at": 1613779150,
      "filename": "validation_data.jsonl",
      "purpose": "fine-tune"
    }
  ],
  "object": "list"
}

Upload File

Upload a new file

Retrieve File

Get file metadata

Delete File

Delete an uploaded file

Build docs developers (and LLMs) love