> ## 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.

# Retrieve file

Get information about a specific file by its ID. Returns metadata including filename, size, creation time, and purpose.

<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 retrieve. Format: `file-xxxxx`

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

## Response

Returns the file object with metadata.

<ResponseExample>
  ```json 200 OK theme={"system"}
  {
    "id": "file-abc123",
    "object": "file",
    "bytes": 1024,
    "created_at": 1677610602,
    "filename": "batch_input.jsonl",
    "purpose": "batch"
  }
  ```

  ```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.get(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: 'GET',
      headers: headers
  });

  const data = await response.json();
  console.log(data);
  ```

  ```bash cURL theme={"system"}
  curl https://api.keywordsai.co/api/files/file-abc123/ \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```
</RequestExample>
