Skip to main content
GET
/
studio
/
v1
/
library
/
files
/
{file_id}
/
download
import requests

file_id = "your_file_id_here"
url = f"https://api.ai21.com/studio/v1/library/files/{file_id}/download"
headers = {"Authorization": "Bearer your_api_key_here"}

response = requests.get(url)

if response.status_code == 200:
    print("Download URL:", response.text)
else:
    print("Error:", response.status_code, response.text)

Path parameters

file_id
string
The unique ID of the file to download.

Response 200

Returns a string containing the signed download URL for the requested file. Example response:
"https://storage.ai21.com/files/file_123abc/download?token=xyz"

Response 422

No matching ID is found.
import requests

file_id = "your_file_id_here"
url = f"https://api.ai21.com/studio/v1/library/files/{file_id}/download"
headers = {"Authorization": "Bearer your_api_key_here"}

response = requests.get(url)

if response.status_code == 200:
    print("Download URL:", response.text)
else:
    print("Error:", response.status_code, response.text)
I