Get Asset
curl --request GET \
--url https://api.example.com/api/v1/assets/{assetId} \
--header 'Authorization: <authorization>'import requests
url = "https://api.example.com/api/v1/assets/{assetId}"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.example.com/api/v1/assets/{assetId}', 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://api.example.com/api/v1/assets/{assetId}",
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: <authorization>"
],
]);
$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://api.example.com/api/v1/assets/{assetId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/assets/{assetId}")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/assets/{assetId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"url": {},
"content_type": "<string>",
"size": {},
"state": "<string>",
"duration": {},
"width": {},
"height": {},
"created_at": "<string>",
"NOT_FOUND": {},
"UNAUTHORIZED": {}
}Assets
Get Asset
Retrieve details about a specific asset by its ID
GET
/
api
/
v1
/
assets
/
{assetId}
Get Asset
curl --request GET \
--url https://api.example.com/api/v1/assets/{assetId} \
--header 'Authorization: <authorization>'import requests
url = "https://api.example.com/api/v1/assets/{assetId}"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.example.com/api/v1/assets/{assetId}', 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://api.example.com/api/v1/assets/{assetId}",
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: <authorization>"
],
]);
$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://api.example.com/api/v1/assets/{assetId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/assets/{assetId}")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/assets/{assetId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"url": {},
"content_type": "<string>",
"size": {},
"state": "<string>",
"duration": {},
"width": {},
"height": {},
"created_at": "<string>",
"NOT_FOUND": {},
"UNAUTHORIZED": {}
}Overview
Fetch metadata and details for a specific uploaded asset using its unique identifier.Request
Path Parameters
string
required
The unique identifier of the asset (UUID format)
Headers
string
required
Bearer token with your API key:
Bearer sk-bab-your-api-keyResponse
string
Unique identifier for the asset
string
Asset filename
string | null
S3 URL to access the asset
string
MIME type of the file
number | null
File size in bytes
string
Current state:
uploading, processing, ready, or errornumber | null
Duration in seconds (for video/audio files)
number | null
Width in pixels (for image/video files)
number | null
Height in pixels (for image/video files)
string
ISO 8601 timestamp of when the asset was uploaded
Examples
curl https://api.babou.ai/api/v1/assets/ast_abc123xyz456789012 \
-H "Authorization: Bearer $BABOU_API_KEY"
async function getAsset(assetId: string) {
const response = await fetch(
`https://api.babou.ai/api/v1/assets/${assetId}`,
{
headers: {
'Authorization': `Bearer ${process.env.BABOU_API_KEY}`
}
}
);
if (!response.ok) {
throw new Error(`Failed to fetch asset: ${response.statusText}`);
}
const asset = await response.json();
return asset;
}
const asset = await getAsset('ast_abc123xyz456789012');
console.log('Asset URL:', asset.url);
console.log('Size:', asset.size, 'bytes');
import os
import requests
def get_asset(asset_id):
response = requests.get(
f'https://api.babou.ai/api/v1/assets/{asset_id}',
headers={'Authorization': f'Bearer {os.environ["BABOU_API_KEY"]}'}
)
if not response.ok:
raise Exception(f'Failed to fetch asset: {response.text}')
return response.json()
asset = get_asset('ast_abc123xyz456789012')
print(f'Asset URL: {asset["url"]}')
print(f'Size: {asset["size"]} bytes')
Response Example
{
"id": "ast_abc123xyz456789012",
"name": "uploaded-file",
"url": "s3://babou-assets/assets/ast_abc123xyz456789012-original",
"content_type": "image/png",
"size": 245678,
"state": "ready",
"duration": null,
"width": 1920,
"height": 1080,
"created_at": "2025-12-02T10:00:00Z"
}
Error Responses
404
Asset not found or you don’t have access
{
"error": "Asset not found",
"code": "NOT_FOUND"
}
401
Invalid or missing API key
{
"error": "Unauthorized - Invalid API key",
"code": "UNAUTHORIZED"
}
Use Cases
Check upload status
Check upload status
After uploading a large file, poll this endpoint to verify the upload completed successfully:
async function waitForAssetReady(assetId: string, maxAttempts = 10) {
for (let i = 0; i < maxAttempts; i++) {
const asset = await getAsset(assetId);
if (asset.state === 'ready') {
return asset;
}
if (asset.state === 'failed') {
throw new Error('Asset upload failed');
}
await new Promise(r => setTimeout(r, 2000)); // Wait 2s
}
throw new Error('Asset not ready after maximum attempts');
}
Verify asset before using in project
Verify asset before using in project
Before referencing an asset in your video project, verify it exists and is accessible:
async function validateAsset(assetId: string) {
try {
const asset = await getAsset(assetId);
return asset.state === 'ready';
} catch (error) {
console.error('Asset validation failed:', error);
return false;
}
}
Get download URL
Get download URL
Retrieve the public URL to download or display the asset:
def get_asset_url(asset_id):
asset = get_asset(asset_id)
return asset['url']
# Use the URL to download
import requests
url = get_asset_url('ast_abc123xyz456789012')
content = requests.get(url).content
Next Steps
Upload Asset
Upload a new asset
List Assets
View all your assets