Poll this endpoint to check the status of your 3D model generation task.
If the create response included poll_url, prefer calling that exact URL for polling. /v1/tasks/{id} is the canonical fixed status endpoint for 3D jobs, and id / task_id should be treated as the same async task identity. If the task no longer exists or is no longer available in the public task record, TokenLab returns async_task_not_found with the message Task not found or no longer available.
Path Parameters
The 3D generation task ID.
Response
Async task identifier alias when provided.
Preferred polling URL when the create response supplies one.
Task status: pending, processing, completed, or failed.
Optional progress value. Returned only when a real progress value is available; use status to determine completion.
URL to download the 3D model file (when completed).
URL to download the GLB format model (when available).
URL to download the FBX format model (when available).
Error message (when failed).
cURL
Python
JavaScript
Go
PHP
curl "https://api.tokenlab.sh/v1/tasks/ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
-H "Authorization: Bearer sk-your-api-key"
import requests
import time
task_id = "ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
poll_url = f "/v1/tasks/ { task_id } "
while True :
response = requests.get(
f "https://api.tokenlab.sh { poll_url } " ,
headers = { "Authorization" : "Bearer sk-your-api-key" }
)
result = response.json()
if result[ "status" ] == "completed" :
print ( f "3D Model URL: { result[ 'model_url' ] } " )
break
elif result[ "status" ] == "failed" :
print ( f "Error: { result[ 'error' ] } " )
break
time.sleep( 5 ) # Poll every 5 seconds
const taskId = 'ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' ;
const pollUrl = `/v1/tasks/ ${ taskId } ` ;
async function pollFor3DModel () {
while ( true ) {
const response = await fetch (
`https://api.tokenlab.sh ${ pollUrl } ` ,
{ headers: { 'Authorization' : 'Bearer sk-your-api-key' } }
);
const result = await response . json ();
if ( result . status === 'completed' ) {
console . log ( `3D Model URL: ${ result . model_url } ` );
return result . model_url ;
} else if ( result . status === 'failed' ) {
throw new Error ( result . error );
}
await new Promise ( r => setTimeout ( r , 5000 ));
}
}
package main
import (
" encoding/json "
" fmt "
" net/http "
" time "
)
func main () {
taskID := "ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
pollURL := fmt . Sprintf ( "https://api.tokenlab.sh/v1/tasks/ %s " , taskID )
for {
req , _ := http . NewRequest ( "GET" ,
pollURL , nil )
req . Header . Set ( "Authorization" , "Bearer sk-your-api-key" )
client := & http . Client {}
resp , _ := client . Do ( req )
var result map [ string ] interface {}
json . NewDecoder ( resp . Body ). Decode ( & result )
resp . Body . Close ()
if result [ "status" ] == "completed" {
fmt . Printf ( "3D Model URL: %s \n " , result [ "model_url" ])
break
} else if result [ "status" ] == "failed" {
fmt . Printf ( "Error: %s \n " , result [ "error" ])
break
}
time . Sleep ( 5 * time . Second )
}
}
<? php
$taskId = 'ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' ;
$pollUrl = "https://api.tokenlab.sh/v1/tasks/{ $taskId }" ;
while ( true ) {
$ch = curl_init ( $pollUrl );
curl_setopt_array ( $ch , [
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer sk-your-api-key'
]
]);
$response = curl_exec ( $ch );
curl_close ( $ch );
$result = json_decode ( $response , true );
if ( $result [ 'status' ] === 'completed' ) {
echo "3D Model URL: { $result ['model_url']} \n " ;
break ;
} elseif ( $result [ 'status' ] === 'failed' ) {
echo "Error: { $result ['error']} \n " ;
break ;
}
sleep ( 5 );
}
{
"id" : "ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ,
"task_id" : "ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ,
"poll_url" : "/v1/tasks/ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ,
"status" : "completed" ,
"model_url" : "https://cdn.example.com/3d/abc123.glb" ,
"glb_url" : "https://cdn.example.com/3d/abc123.glb" ,
"fbx_url" : "https://cdn.example.com/3d/abc123.fbx"
}