# Retrieve File

Returns information about a specific file.

## Endpoint

```http
GET /files/{file_id}
```

operationId: `retrieveFile`

### Servers

- `https://api.deepseek.com`

## Authentication

### Alternative 1

**bearerAuth**

`Authorization: Bearer <API_KEY>`

```yaml
type: http
scheme: bearer
```

## Parameters

**`file_id`** (path) — required

The ID of the file to retrieve.

- `type`: `string`

## Responses

### 200

OK, returns the `file object`.

#### application/json

- Reference: [FileObject](#schema-file-object) (`#/components/schemas/FileObject`)

**Example**

```json
{
  "id": "file-api-0a1b2c3d4e5f60718293a4b5c6d7e8f9",
  "object": "file",
  "bytes": 102400,
  "created_at": 1700000000,
  "filename": "image.jpg",
  "purpose": "user_data"
}
```

## Code samples

### curl

```bash
# Set DEEPSEEK_API_KEY to your API key before running this example.
# Set DEEPSEEK_FILE_ID to the id returned by the upload example.
curl --silent --show-error --max-time 60 "https://api.deepseek.com/files/${DEEPSEEK_FILE_ID}" \
  --header "Authorization: Bearer ${DEEPSEEK_API_KEY}"
```

### Python — OpenAI SDK

```python
# Set DEEPSEEK_API_KEY to your API key before running this example.
# Set DEEPSEEK_FILE_ID to the id returned by the upload example.
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["DEEPSEEK_API_KEY"],
    base_url="https://api.deepseek.com",
    timeout=60.0,
)

info = client.files.retrieve(os.environ["DEEPSEEK_FILE_ID"])
print(info.model_dump_json(indent=2))
```

## Referenced schemas

### schema-file-object

**FileObject** — `#/components/schemas/FileObject`

Describes a file that has been uploaded to the Files API. A file uploaded with an OCR purpose is returned only after parsing succeeds.

- `type`: `object`

- `required`: `["id","object","bytes","created_at","filename","purpose"]`

- **Properties**

  - **`id`** (required)

    The file identifier, of the form `file-api-...`, which can be referenced in chat completion requests.

    - `type`: `string`

  - **`object`** (required)

    The object type, which is always `file`.

    - `type`: `string`

    - `enum`: `["file"]`

  - **`bytes`** (required)

    The size of the file in bytes.

    - `type`: `integer`

  - **`created_at`** (required)

    The Unix timestamp (in seconds) of when the file was created.

    - `type`: `integer`

  - **`filename`** (required)

    The name of the file.

    - `type`: `string`

  - **`purpose`** (required)

    The intended purpose of the file.

    - `type`: `string`

    - `enum`: `["user_data","text_recognition","rich_layout_recognition"]`

  - **`expires_at`** (optional)

    The Unix timestamp (in seconds) of when the file expires. Only present when an expiration was set at upload time.

    - `type`: `integer`
