Skip to main content
GET
/
files
/
{file_id}
Get file metadata
curl --request GET \
  --url https://openrouter.ai/api/v1/files/{file_id} \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://openrouter.ai/api/v1/files/{file_id}"

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/{file_id}', 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/{file_id}",
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/{file_id}"

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/{file_id}")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://openrouter.ai/api/v1/files/{file_id}")

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
{
  "created_at": "2025-01-01T00:00:00Z",
  "downloadable": false,
  "filename": "document.pdf",
  "id": "file_011CNha8iCJcU1wXNR6q4V8w",
  "mime_type": "application/pdf",
  "size_bytes": 1024000,
  "type": "file"
}
{
"error": {
"code": 401,
"message": "Missing Authentication header"
}
}
{
"error": {
"code": 404,
"message": "Resource not found"
}
}
{
"error": {
"code": 429,
"message": "Rate limit exceeded"
}
}
{
"error": {
"code": 500,
"message": "Internal Server Error"
}
}

Authorizations

Authorization
string
header
required

API key as bearer token in Authorization header

Path Parameters

file_id
string
required
Example:

"file_011CNha8iCJcU1wXNR6q4V8w"

Query Parameters

workspace_id
string<uuid>

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

Example:

"a103d8b6-42f0-4e50-9a3c-bf41e2c3c1a7"

Response

The file metadata.

Metadata describing a stored file.

created_at
string
required
downloadable
boolean
required
filename
string
required
id
string
required
mime_type
string
required
size_bytes
integer
required
type
enum<string>
required
Available options:
file