Skip to main content
GET
/
studio
/
v1
/
library
/
files
/
{file_id}
from ai21 import AI21Client

client = AI21Client()

# Replace with your actual file_id
file_id = "file_123abc"

# Retrieve file metadata
file_metadata = client.library.files.get(file_id=file_id)

print(file_metadata)
{
  "id": "file_123abc",
  "name": "customer_data.pdf",
  "size": 204800,
  "created_at": "2025-10-20T14:23:11Z",
  "labels": ["invoices", "Q3"]
}
The file_id is generated by AI21 when you upload the file.

Path Parameters

file_id
string
The unique ID of the file to retrieve.

Responses

Response 200

A successful response returns metadata about the requested file.
id
string
The file ID.
name
string
The file name.
size
int
File size in bytes.
created_at
string
File creation timestamp.
labels
array
Labels assigned to the file
errorCode
int
Error code, if any.
errorMessage
string
Error message, if any.

Response 422

No matching ID is found.
from ai21 import AI21Client

client = AI21Client()

# Replace with your actual file_id
file_id = "file_123abc"

# Retrieve file metadata
file_metadata = client.library.files.get(file_id=file_id)

print(file_metadata)
{
  "id": "file_123abc",
  "name": "customer_data.pdf",
  "size": 204800,
  "created_at": "2025-10-20T14:23:11Z",
  "labels": ["invoices", "Q3"]
}
I