Delete file
Delete a file from OpenAI's storage. This is useful for cleanup and managing storage costs.
<Note>
**Important**: Deleting a file is permanent and cannot be undone. Make sure you no longer need the file or have downloaded its contents before deletion.
</Note>
<Note>
**Customer credentials required**: This endpoint requires your own OpenAI API key configured in Respan dashboard (Settings → Providers).
</Note>
## Path parameters
- `file_id` *string* **required**: The unique identifier of the file to delete. Format: `file-xxxxx`
**Example**
```
file-abc123
```
## Response
Returns a confirmation object indicating the file was deleted.
```json 200 OK
{
"id": "file-abc123",
"object": "file",
"deleted": true
}
```
```json 404 Not Found
{
"error": {
"message": "No such file: file-abc123",
"type": "invalid_request_error"
}
}
```
```json 401 Unauthorized
{
"error": "Authentication credentials were not provided."
}
```
```python Python
file_id = "file-abc123"
url = f"https://api.respan.ai/api/files/{file_id}/"
headers = {
"Authorization": "Bearer YOUR_API_KEY"
}
response = requests.delete(url, headers=headers)
print(response.json())
```
```typescript TypeScript
const fileId = 'file-abc123';
const url = `https://api.respan.ai/api/files/${fileId}/`;
const headers = {
'Authorization': 'Bearer YOUR_API_KEY'
};
const response = await fetch(url, {
method: 'DELETE',
headers: headers
});
const data = await response.json();
console.log(data);
```
```bash cURL
curl -X DELETE https://api.respan.ai/api/files/file-abc123/ \
-H "Authorization: Bearer YOUR_API_KEY"
```
Authentication
AuthorizationBearer
API key authentication. Get your API key from https://platform.respan.ai/platform/api-keys
Path parameters
file_id
The unique identifier of the file to delete. Format: file-xxxxx
Response
No content
Errors
401
Unauthorized Error