curl --request GET \
--url https://openrouter.ai/api/v1/files \
--header 'Authorization: Bearer <token>'import requests
url = "https://openrouter.ai/api/v1/files"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://openrouter.ai/api/v1/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://openrouter.ai/api/v1/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://openrouter.ai/api/v1/files"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://openrouter.ai/api/v1/files")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://openrouter.ai/api/v1/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"cursor": null,
"data": [
{
"created_at": "2025-01-01T00:00:00Z",
"downloadable": false,
"filename": "document.pdf",
"id": "or_file_011CNha8iCJcU1wXNR6q4V8w",
"mime_type": "application/pdf",
"size_bytes": 1024000,
"type": "file"
}
],
"first_id": "or_file_011CNha8iCJcU1wXNR6q4V8w",
"has_more": false,
"last_id": "or_file_011CNha8iCJcU1wXNR6q4V8w"
}{
"error": {
"code": 400,
"message": "Invalid request parameters"
}
}{
"error": {
"code": 401,
"message": "Missing Authentication header"
}
}{
"error": {
"code": 403,
"message": "Only management keys can perform this operation"
}
}{
"error": {
"code": 429,
"message": "Rate limit exceeded"
}
}{
"error": {
"code": 500,
"message": "Internal Server Error"
}
}{
"error": {
"code": 502,
"message": "Provider returned error"
}
}{
"error": {
"code": 503,
"message": "Service temporarily unavailable"
}
}List files
Lists files belonging to the workspace of the authenticating API key.
curl --request GET \
--url https://openrouter.ai/api/v1/files \
--header 'Authorization: Bearer <token>'import requests
url = "https://openrouter.ai/api/v1/files"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://openrouter.ai/api/v1/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://openrouter.ai/api/v1/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://openrouter.ai/api/v1/files"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://openrouter.ai/api/v1/files")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://openrouter.ai/api/v1/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"cursor": null,
"data": [
{
"created_at": "2025-01-01T00:00:00Z",
"downloadable": false,
"filename": "document.pdf",
"id": "or_file_011CNha8iCJcU1wXNR6q4V8w",
"mime_type": "application/pdf",
"size_bytes": 1024000,
"type": "file"
}
],
"first_id": "or_file_011CNha8iCJcU1wXNR6q4V8w",
"has_more": false,
"last_id": "or_file_011CNha8iCJcU1wXNR6q4V8w"
}{
"error": {
"code": 400,
"message": "Invalid request parameters"
}
}{
"error": {
"code": 401,
"message": "Missing Authentication header"
}
}{
"error": {
"code": 403,
"message": "Only management keys can perform this operation"
}
}{
"error": {
"code": 429,
"message": "Rate limit exceeded"
}
}{
"error": {
"code": 500,
"message": "Internal Server Error"
}
}{
"error": {
"code": 502,
"message": "Provider returned error"
}
}{
"error": {
"code": 503,
"message": "Service temporarily unavailable"
}
}Authorizations
API key as bearer token in Authorization header
Query Parameters
Maximum number of files to return (1–1000).
1 <= x <= 1000100
Opaque pagination cursor from a previous response.
"eyJjdXJzb3IiOiJvcl9maWxlXzAxMUNOaGE4aUNKY1Uxd1hOUjZxNFY4dyJ9"
Workspace to scope the request to. Defaults to the caller’s default workspace.
"a103d8b6-42f0-4e50-9a3c-bf41e2c3c1a7"
Store or read this file on the named provider using your own API key for it. Omit to use OpenRouter storage.
openai, anthropic "openai"
OpenAI-style forward cursor: the id to list after.
"or_file_011CNha8iCJcU1wXNR6q4V8w"
Anthropic-style forward cursor: the id to list after.
"or_file_011CNha8iCJcU1wXNR6q4V8w"
Anthropic-style reverse cursor. Not supported by OpenRouter storage.
"or_file_011CNha8iCJcU1wXNR6q4V8w"
Sort direction. Only asc is supported by OpenRouter storage.
asc, desc "asc"
Response
A page of files.
- Option 1
- Option 2
- Option 3
A page of files, in the negotiated shape.