You must include your provider credentials via the
x-portkey-api-key header or a virtual key. See Authentication for details.Upload a file
POST /v1/files
Uploads a file that can be used with fine-tuning, batch processing, or other provider features. The request body must be multipart/form-data.
Request
The provider to route the request to (e.g.
openai, azure-openai).Your Portkey API key or the provider API key depending on your setup.
The file object to upload. Must be a supported file format for the target provider.
The intended purpose of the file. Common values:
fine-tune, batch, assistants.Response
The unique identifier for the uploaded file.
Always
file.Size of the file in bytes.
Unix timestamp when the file was created.
The name of the uploaded file.
The purpose the file was uploaded for.
Processing status of the file. Values:
uploaded, processed, error.List files
GET /v1/files
Returns a list of files that have been uploaded to the configured provider.
Request
The provider to route the request to.
Your Portkey API key or provider API key.
Filter files by purpose. For example,
fine-tune or batch.Response
Always
list.Array of file objects. Each object has the same shape as the Upload a file response.
Retrieve file metadata
GET /v1/files/:id
Returns metadata for a specific file by its ID.
Request
The ID of the file to retrieve.
The provider to route the request to.
Your Portkey API key or provider API key.
Response
Returns a single file object with the same fields as the Upload a file response.Retrieve file content
GET /v1/files/:id/content
Returns the raw content of a file.
Request
The ID of the file whose content to retrieve.
The provider to route the request to.
Your Portkey API key or provider API key.
Response
Returns the raw file bytes with the content type set by the provider.Delete a file
DELETE /v1/files/:id
Deletes a file from the provider. The file must not be in use by any active fine-tuning jobs or batches.
Request
The ID of the file to delete.
The provider to route the request to.
Your Portkey API key or provider API key.
Response
The ID of the deleted file.
Always
file.true if the file was successfully deleted.