Task Status Query
Check the current status of a voice cloning task.
Request Information
- Method:
GET
- Endpoint:
/api/instant/task-status
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
task_id | string | Yes | The task ID to check |
api_key | string | Yes | Your unique API key |
Response
Success Response (200 OK)
{
"task_id": "1406bf34-735c-4b21-98ac-a135b2afb1c8",
"status": "processing",
"created_at": "2025-01-25 10:30:00",
"updated_at": "2025-01-25 10:32:15"
}
Error Response
- 400 Bad Request: Missing required parameters (e.g.,
api_key
)
Task Status Description
Status | Description |
---|---|
pending | Task submitted, waiting for processing |
processing | Task is being processed |
completed | Task completed, result can be retrieved |
failed | Task processing failed |
Example Request
curl -X GET "https://aivoiceclonefree.com/api/instant/task-status?task_id=1406bf34-735c-4b21-98ac-a135b2afb1c8&api_key=your_api_key_here"
Polling Recommendations
- Polling Interval: Recommended to query status every 30 seconds
- Timeout Handling: Contact technical support if task doesn’t complete within 10 minutes
- Status Changes:
pending
→processing
→completed
pending
→processing
→failed
Usage Examples
JavaScript Polling Example
async function pollTaskStatus(taskId, apiKey) {
const maxAttempts = 20; // Maximum 20 queries
const interval = 30000; // 30 second interval
for (let i = 0; i < maxAttempts; i++) {
try {
const response = await fetch(
`https://aivoiceclonefree.com/api/instant/task-status?task_id=${taskId}&api_key=${apiKey}`
);
const data = await response.json();
console.log(`Status check ${i + 1}: ${data.status}`);
if (data.status === 'completed') {
console.log('Task completed!');
return data;
} else if (data.status === 'failed') {
console.log('Task failed');
return data;
}
// Wait 30 seconds before next query
await new Promise(resolve => setTimeout(resolve, interval));
} catch (error) {
console.error('Error querying status:', error);
}
}
console.log('Query timeout');
return null;
}
Python Polling Example
import requests
import time
def poll_task_status(task_id, api_key, max_attempts=20, interval=30):
for i in range(max_attempts):
try:
response = requests.get(
'https://aivoiceclonefree.com/api/instant/task-status',
params={
'task_id': task_id,
'api_key': api_key
}
)
data = response.json()
print(f"Status check {i + 1}: {data['status']}")
if data['status'] == 'completed':
print('Task completed!')
return data
elif data['status'] == 'failed':
print('Task failed')
return data
# Wait 30 seconds before next query
time.sleep(interval)
except Exception as e:
print(f'Error querying status: {e}')
print('Query timeout')
return None
Next Steps
When task status becomes completed
, you can:
- Use Get Task Result to download the audio file
- If status is
failed
, check error information and resubmit the task
Last updated on