Skip to main content

Error Response Format

All API errors follow a consistent format:

HTTP Status Codes

Status CodeDescription
200Success
201Created successfully
400Bad Request - Invalid parameters
401Unauthorized - Invalid or missing API key
402Payment Required - Insufficient credits
403Forbidden - Pro plan required or unauthorized access
404Not Found - Resource doesn’t exist
409Conflict - Resource already exists
429Too Many Requests - Rate limit exceeded
500Internal Server Error

Common Error Codes

Authentication Errors

Status: 401
Cause: API key is invalid, expired, or malformed
Solution: Check your API key format and regenerate if necessary
Status: 403
Cause: Pro plan required for API access
Solution: Upgrade to Pro plan

Rate Limiting Errors

Status: 429
Cause: Too many requests in a short period
Solution: Implement exponential backoff and respect rate limits

Validation Errors

Status: 400
Cause: No prompt, script, voice_url, or avatar_url provided
Solution: Provide at least one content parameter
Status: 400
Cause: Script provided but no voice specified
Solution: Add voice_id or voice_url when using script
Status: 400
Cause: Specified voice_id not found
Solution: Use GET /voice/list to get valid voice IDs
Status: 400
Cause: Specified avatar_id not found
Solution: Use GET /avatar/list to get valid avatar IDs
Status: 400
Cause: Invalid video format specified
Solution: Use ‘vertical’, ‘square’, or ‘ads’

Resource Errors

Status: 402
Cause: Not enough credits for the operation
Solution: Purchase more credits or reduce resource usage
Status: 404
Cause: Job ID doesn’t exist
Solution: Verify the job_id is correct
Status: 403
Cause: Job doesn’t belong to your workspace
Solution: Only access jobs created by your API key
Status: 404
Cause: Video ID doesn’t exist
Solution: Verify the video_id is correct

Error Handling Best Practices

1. Always Check Status Codes

2. Implement Retry Logic

3. Handle Validation Errors

4. Monitor Rate Limits

Webhook Error Handling

When using webhooks, you may receive error notifications:
Handle webhook errors in your endpoint:
Always implement proper error handling and logging in production applications to diagnose issues quickly.