文件

列出文件

按用途筛选,使用 after 或 before 游标翻页。

GET /file/v1/files● 支持

请求参数

  • purposestring可选

    query: Only return files with the given purpose.

  • limitinteger可选
    默认 10000

    query: A limit on the number of objects to be returned. Limit can range between 1 and 10,000, and the default is 10,000.

  • orderstring可选
    默认 "desc"

    query: Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.

    取值 ascdesc
  • afterstring可选

    query: A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

  • scope_idstring可选

    query: Filter files by session scope. A nonexistent scope returns 404.

  • beforestring可选

    query: Return the preceding page; mutually exclusive with after.

返回

200 list

错误按 OpenAI 格式返回,参见 错误码

响应

HTTP 200

OK

application/json

名称类型说明
objectstringObject type; always `list`.
dataarray<object>Files of the page, in the requested order.
data[].idstringThe file identifier, which can be referenced in the API endpoints.
data[].bytesintegerThe size of the file, in bytes.
data[].created_atintegerThe Unix timestamp (in seconds) for when the file was created.
data[].expires_atintegerThe Unix timestamp (in seconds) for when the file will expire.
data[].filenamestringThe name of the file.
data[].objectstringThe object type, which is always `file`.
data[].purposestringUpload purpose. Image references in conversations require user_data.
data[].statusstringDeprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`.
data[].status_detailsstring | nullDeprecated; always null or absent.
data[].mime_typestringContent-detected MIME type.
data[].downloadablebooleanTenant-owned live files can be downloaded through this face.
data[].scopeobjectPresent for session output files.
data[].relative_pathstringPath within the session output directory; present for session outputs.
data[].revisionintegerSession output revision; present for session outputs.
first_idstringId of the first file of the page; usable as `before` to read the preceding page.
last_idstringId of the last file of the page; usable as `after` to read the next page.
has_morebooleanWhether more files exist beyond this page.