Skip to main content
File

List files

List all files in your account (uploaded files and batch results), with filtering by purpose, creation time, and pagination.

GET
/files
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_list = client.files.list(
  after="file-batch-xxx",
  limit=20
)
print(file_list.model_dump_json())
{
  "data": [
    {
      "id": "file-batch-xxx",
      "bytes": 27,
      "created_at": 1722480543,
      "filename": "test.txt",
      "object": "file",
      "purpose": "batch",
      "status": "processed",
      "status_details": null
    },
    {
      "id": "file-batch-yyy",
      "bytes": 431986,
      "created_at": 1718089390,
      "filename": "test.pdf",
      "object": "file",
      "purpose": "batch",
      "status": "processed",
      "status_details": null
    }
  ],
  "object": "list",
  "has_more": false
}

Authorizations

string
header
required

Qwen Cloud API Key. Create one in the console.

Query Parameters

string

Pagination cursor. Set to the file_id of the last item on the current page to retrieve the next page.

file-batch-xxx
integer
default2000

Number of files per page. Range: 1-2,000. Default: 2,000.

1 <= x <= 2000
enum<string>

Filter files by purpose. Valid values: file-extract, batch.

file-extract,batch
string

Returns files created before this time. Accepts formats: yyyyMMddHHmmss, yyyy-MM-dd HH:mm:ss, yyyy-MM-dd, yyyyMMdd.

20250306123000
string

Returns files created after this time. Accepts formats: yyyyMMddHHmmss, yyyy-MM-dd HH:mm:ss, yyyy-MM-dd, yyyyMMdd.

20250306123000

Response

200-application/json
enum<string>

Always list.

list
object[]

List of file objects.

boolean

Whether a next page exists.