Skip to main content

DELETE /v1/files/:id

Delete a file.
Deleting a file is permanent and cannot be undone. Make sure the file is no longer needed before deleting.

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 delete

Response

id
string
The ID of the deleted file
object
string
The object type, always “file”
deleted
boolean
Whether the file was successfully deleted (always true on success)

Example

curl -X DELETE 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",
  "deleted": true
}

Error Handling

Common errors:
  • 404 Not Found: The file ID doesn’t exist
  • 403 Forbidden: You don’t have permission to delete this file
  • 409 Conflict: The file is currently being used by another operation

Upload File

Upload a new file

List Files

View all uploaded files

Retrieve File

Get file metadata

Build docs developers (and LLMs) love