> ## Documentation Index
> Fetch the complete documentation index at: https://docs.keywordsai.co/llms.txt
> Use this file to discover all available pages before exploring further.

# 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 Keywords AI dashboard (Settings → Providers).
</Note>

## Path parameters

<ParamField path="file_id" type="string" required>
  The unique identifier of the file to delete. Format: `file-xxxxx`

  <Accordion title="Example">
    ```
    file-abc123
    ```
  </Accordion>
</ParamField>

## Response

Returns a confirmation object indicating the file was deleted.

<ResponseExample>
  ```json 200 OK theme={"system"}
  {
    "id": "file-abc123",
    "object": "file",
    "deleted": true
  }
  ```

  ```json 404 Not Found theme={"system"}
  {
    "error": {
      "message": "No such file: file-abc123",
      "type": "invalid_request_error"
    }
  }
  ```

  ```json 401 Unauthorized theme={"system"}
  {
    "error": "Authentication credentials were not provided."
  }
  ```
</ResponseExample>

<RequestExample>
  ```python Python theme={"system"}
  import requests

  file_id = "file-abc123"
  url = f"https://api.keywordsai.co/api/files/{file_id}/"
  headers = {
      "Authorization": "Bearer YOUR_API_KEY"
  }

  response = requests.delete(url, headers=headers)
  print(response.json())
  ```

  ```typescript TypeScript theme={"system"}
  const fileId = 'file-abc123';
  const url = `https://api.keywordsai.co/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 theme={"system"}
  curl -X DELETE https://api.keywordsai.co/api/files/file-abc123/ \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```
</RequestExample>
