Skip to main content

GET /v1/files/:id

Retrieve metadata for a specific file.

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

Path Parameters

id
string
required
The ID of the file to retrieve

Response

id
string
The file identifier
object
string
The object type, always “file”
bytes
integer
The size of the file in bytes
created_at
integer
Unix timestamp of when the file was created
filename
string
The name of the file
purpose
string
The purpose of the file
status
string
The status of the file (e.g., “uploaded”, “processed”, “error”)

Example

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

Response Example

{
  "id": "file-abc123",
  "object": "file",
  "bytes": 140,
  "created_at": 1613779121,
  "filename": "training_data.jsonl",
  "purpose": "fine-tune",
  "status": "processed"
}

File Content

To retrieve the actual file content, use:
GET /v1/files/:id/content
This endpoint returns the raw file content as a download.

Upload File

Upload a new file

List Files

View all uploaded files

Delete File

Delete an uploaded file

Build docs developers (and LLMs) love