Files

Lists files belonging to the workspace of the authenticating API key.

get/files

Request

  • Base URL: https://openrouter.ai/api/v1
  • URL: https://openrouter.ai/api/v1/files
  • Auth: HTTP bearer

Query parameters

limitinteger

Maximum number of files to return (1–1000).

Example:100
cursorstring

Opaque pagination cursor from a previous response.

Example:eyJjdXJzb3IiOiJvcl9maWxlXzAxMUNOaGE4aUNKY1Uxd1hOUjZxNFY4dyJ9
workspace_idstring uuid

Workspace to scope the request to. Defaults to the caller’s default workspace.

Example:a103d8b6-42f0-4e50-9a3c-bf41e2c3c1a7
provider'openai' | 'anthropic'

Store or read this file on the named provider using your own API key for it. Omit to use OpenRouter storage.

Example:openai
afterstring

OpenAI-style forward cursor: the id to list after.

Example:or_file_011CNha8iCJcU1wXNR6q4V8w
after_idstring

Anthropic-style forward cursor: the id to list after.

Example:or_file_011CNha8iCJcU1wXNR6q4V8w
before_idstring

Anthropic-style reverse cursor. Not supported by OpenRouter storage.

Example:or_file_011CNha8iCJcU1wXNR6q4V8w
order'asc' | 'desc'

Sort direction. Only asc is supported by OpenRouter storage.

Example:asc

Response

A page of files.

OR
OR

Example response

{
  "_shape": "openrouter",
  "cursor": null,
  "data": [],
  "first_id": null,
  "has_more": false,
  "last_id": null
}

Changes

    • breaking

      added to the response body oneOf list for the response status

    • breaking

      the response's body type changed from object to no type for status

    • breaking

      removed the required property from the response with the status

    • breaking

      removed the required property from the response with the status

    • breaking

      removed the required property from the response with the status

    • breaking

      removed the required property from the response with the status

    • breaking

      removed the required property from the response with the status

    • info

      added the new optional query request parameter after

    • info

      added the new optional query request parameter after_id

    • info

      added the new optional query request parameter before_id

    • info

      added the new optional query request parameter order

    • info

      added the new optional query request parameter provider

    • info

      added response discriminator for the response status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status