> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/portkey-AI/gateway/llms.txt
> Use this file to discover all available pages before exploring further.

# Retrieve File

> Returns information about a specific file

## GET /v1/files/:id

Retrieve metadata for a specific file.

## Authentication

Requires provider authentication headers:

```bash theme={null}
x-portkey-provider: openai
Authorization: Bearer YOUR_OPENAI_API_KEY
```

## Request

### Headers

<ParamField header="x-portkey-provider" type="string" required>
  The provider to route the request to (e.g., `openai`, `azure-openai`)
</ParamField>

<ParamField header="Authorization" type="string" required>
  Bearer token for the provider API
</ParamField>

### Path Parameters

<ParamField path="id" type="string" required>
  The ID of the file to retrieve
</ParamField>

## Response

<ResponseField name="id" type="string">
  The file identifier
</ResponseField>

<ResponseField name="object" type="string">
  The object type, always "file"
</ResponseField>

<ResponseField name="bytes" type="integer">
  The size of the file in bytes
</ResponseField>

<ResponseField name="created_at" type="integer">
  Unix timestamp of when the file was created
</ResponseField>

<ResponseField name="filename" type="string">
  The name of the file
</ResponseField>

<ResponseField name="purpose" type="string">
  The purpose of the file
</ResponseField>

<ResponseField name="status" type="string">
  The status of the file (e.g., "uploaded", "processed", "error")
</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl https://localhost:8787/v1/files/file-abc123 \
    -H "x-portkey-provider: openai" \
    -H "Authorization: Bearer $OPENAI_API_KEY"
  ```

  ```python Python theme={null}
  from portkey_ai import Portkey

  client = Portkey(
      provider="openai",
      Authorization="sk-***"
  )

  file = client.files.retrieve("file-abc123")
  print(f"File {file.id}: {file.filename}")
  print(f"Status: {file.status}")
  ```

  ```javascript JavaScript theme={null}
  import Portkey from 'portkey-ai';

  const client = new Portkey({
      provider: "openai",
      Authorization: "sk-***"
  });

  const file = await client.files.retrieve("file-abc123");
  console.log(`File ${file.id}: ${file.filename}`);
  console.log(`Status: ${file.status}`);
  ```
</CodeGroup>

### Response Example

```json theme={null}
{
  "id": "file-abc123",
  "object": "file",
  "bytes": 140,
  "created_at": 1613779121,
  "filename": "training_data.jsonl",
  "purpose": "fine-tune",
  "status": "processed"
}
```

## File Content

To retrieve the actual file content, use:

```bash theme={null}
GET /v1/files/:id/content
```

This endpoint returns the raw file content as a download.

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Upload File" icon="upload" href="/api/files/upload">
    Upload a new file
  </Card>

  <Card title="List Files" icon="list" href="/api/files/list">
    View all uploaded files
  </Card>

  <Card title="Delete File" icon="trash" href="/api/files/delete">
    Delete an uploaded file
  </Card>
</CardGroup>
