Errors
Error codes and response format for the Ssemble API.
Error response format
All API errors follow a consistent JSON structure:
| Field | Type | Description |
|---|---|---|
code | string | Machine-readable error code for programmatic handling |
message | string | Human-readable description explaining what went wrong |
details | object | null | Additional context about the error (e.g., invalid field values) |
Error codes reference
Client errors (4xx)
| HTTP Status | Code | Description |
|---|---|---|
| 400 | invalid_request | Missing or invalid parameters in the request body |
| 400 | invalid_youtube_url | The YouTube URL is invalid, unreachable, or is a Shorts URL |
| 400 | video_too_long | Video duration exceeds the 5-hour (18,000 second) limit |
| 400 | url_validation_failed | Failed to validate or fetch the provided URL |
| 401 | missing_api_key | No API key header was provided in the request |
| 401 | invalid_api_key | API key format is wrong, key not found, or key has been revoked |
| 403 | subscription_required | An active subscription is required to use the API |
| 403 | insufficient_credits | Account has no remaining credits to create shorts |
| 404 | resource_not_found | The requested resource (request ID) does not exist |
| 429 | rate_limit_exceeded | Too many requests — slow down and check rate limit headers |
Server errors (5xx)
| HTTP Status | Code | Description |
|---|---|---|
| 500 | internal_error | An unexpected server error occurred — safe to retry |
Handling errors in code
JavaScript
Python
Common error scenarios
Invalid request parameters
Returned when required fields are missing or parameter values are invalid.
Common triggers:
- Missing
urlorfileUrl - Both
urlandfileUrlprovided (must provide exactly one) - Missing
startorend startis negativeendis less than or equal tostart- Time window (
end - start) exceeds 1,200 seconds (20 minutes) - Time window (
end - start) is less than 1 second - Invalid
templateIdformat (must be 24-character hex) - Non-existent
templateId(valid format but not found in template library) - Invalid
musicName(track not found in music library) - Invalid
gameVideoName(video not found in game video library) - Invalid
memeHookName(clip not found in meme hook library) - Invalid
preferredLengthvalue - Invalid
languageorcaptionLanguagecode - Invalid
layoutvalue ctaEnabledistruebutctaTextis missingctaTextexceeds 200 charactersfileUrldoesn't start withhttp://orhttps://- Invalid JSON in request body
Invalid YouTube URL
Common triggers:
- YouTube Shorts URL (
youtube.com/shorts/...) — use the full video URL instead - Private or deleted video
- URL is not a valid YouTube video link
- Region-restricted video that can't be accessed
Rate limit exceeded
The details object includes retryAfter (for per-endpoint limits) or limit + reset (for account-level limits). You can also check the response headers:
See Rate Limits for detailed limits per endpoint and best practices.
Insufficient credits
Each short creation consumes 1 credit. Purchase additional credits or upgrade your plan at app.ssemble.com.
Authentication failure
When no API key is provided:
When the API key is invalid or revoked:
Verify your API key is correct and included in the X-API-Key or Authorization: Bearer header. See Authentication for details.
Resource not found
The request ID doesn't exist or belongs to a different account. Verify the ID is correct and was created with the same API key.
Internal server error
Server errors are typically transient. Wait a few seconds and retry the request. If the error persists, contact support.
Best practices for error handling
- Always check
response.ok(or the HTTP status code) before parsing the response body as success data. - Use the
codefield for programmatic error handling, not themessage— messages may change over time. - Retry on
500errors with exponential backoff. A simple strategy: wait 1s, 2s, 4s, then give up. - Don't retry
4xxerrors (except429) — they indicate a problem with your request that needs to be fixed. - Log the full error response including
detailsfor debugging. Thedetailsfield often contains the specific field or value that caused the error. - Handle
429gracefully — read theX-RateLimit-Resetheader and schedule retries accordingly.
