Skip to main content
File

Retrieve file

Retrieve file details by file ID.

GET
/files/{file_id}
Python
import os
from openai import OpenAI

client = OpenAI(
  api_key=os.getenv("DASHSCOPE_API_KEY"),
  base_url="https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
)

file = client.files.retrieve(
  file_id="file-batch-xxx"
)
print(file.model_dump_json())
{
  "id": "file-batch-xxx",
  "bytes": 27,
  "created_at": 1722480306,
  "filename": "test.txt",
  "object": "file",
  "purpose": "batch",
  "status": "processed",
  "status_details": null
}

Authorizations

string
header
required

Qwen Cloud API Key. Create one in the console.

Path Parameters

string
required

The ID of the file to retrieve.

file-batch-xxx

Response

200-application/json
string

Unique file identifier.

file-fe-xxx
integer

File size in bytes.

2055
integer

Unix timestamp (seconds) when the file was created.

1729065448
string

The uploaded filename.

test.txt
enum<string>

Always file.

file
string

File purpose. Valid values: batch, file-extract, batch_output.

file-extract
string

Current file status.

processed
string | null

Additional status details. null when no details available.