Error Handling
The Soku API uses standard HTTP status codes and returns structured error responses with machine-readable codes, human-readable messages, and request identifiers for troubleshooting.Error Response Format
All error responses follow a consistent JSON structure:| Field | Type | Description |
|---|---|---|
error.type | string | The error category: "invalid_request_error" (4xx), "authentication_error" (401/403), or "api_error" (5xx) |
error.code | string | A machine-readable error code. Use this for programmatic error handling. |
error.message | string | A human-readable description of the error. Suitable for logging but not guaranteed to be stable across API versions. |
error.timestamp | string | ISO 8601 timestamp of when the error occurred |
error.requestId | string | A unique identifier for the request. Include this when contacting support. |
error.details | object | Additional context about the error. The shape varies by error type. May be empty or omitted. |
Error Codes Reference
400 Bad Request
validation_error
One or more fields in the request body are missing, malformed, or contain invalid values.
| Cause | Solution |
|---|---|
| Missing required field | Check the endpoint documentation for required fields |
| Invalid field type (for example, string instead of array) | Verify the data types match the API specification |
| Invalid URL format in media fields | Ensure URLs are well-formed with http:// or https:// |
Empty platform array | Include at least one platform target |
Invalid scheduledTime format | Use ISO 8601 format: 2026-03-02T09:00:00.000Z |
scheduledTime is in the past | Use a future timestamp |
upload_failed
The media URL provided in the request could not be downloaded or stored.
| Cause | Solution |
|---|---|
| Media URL is unreachable or returns an error | Verify the URL is publicly accessible |
| Media file is too large | Check platform-specific size limits |
| Unsupported media format | Use a supported format (MP4, JPEG, PNG, WebP) |
missing_integrations
One or more platform targets in the request are not connected to your Soku account.
missing_account
The specified accountId does not exist for the given platform, or you have multiple accounts for a platform and did not specify which one to use.
| Cause | Solution |
|---|---|
Typo in accountId | Verify the account ID in Settings > Integrations |
| Account was disconnected | Reconnect the account in the dashboard |
Multiple accounts exist but no accountId specified | Use the object format with platform and accountId instead of a string |
401 Unauthorized
unauthorized
The request is missing authentication credentials, or the provided credentials are invalid.
| Cause | Solution |
|---|---|
soku-api-key header is missing | Add the header to your request |
| API key is misspelled or truncated | Verify you copied the full key including the sk_live_ prefix |
| API key has been revoked | Create a new key in Settings > API Keys |
Using Authorization instead of soku-api-key | Use the correct header name: soku-api-key |
| Firebase ID token is invalid (key management endpoints) | Refresh your Firebase ID token |
402 Payment Required
insufficient_credits
Your account does not have enough AI credits to complete the requested operation.
403 Forbidden
forbidden
The request was authenticated but the account does not have permission to perform the action. This typically means your subscription is not active.
| Cause | Solution |
|---|---|
| Subscription has expired | Renew your subscription in Account > Billing |
| Subscription was canceled | Resubscribe from the billing page |
| Free trial has ended | Subscribe to a paid plan |
| Payment method declined | Update your payment method in Account > Billing |
404 Not Found
not_found
The requested resource does not exist.
| Cause | Solution |
|---|---|
| Invalid template slug | Check your template slugs in the Templates section of the dashboard |
| Invalid media ID | Verify the media ID exists in your media library |
| Invalid repurpose link ID | List your repurpose links with GET /v1/repurposeLinks to find valid IDs |
| Invalid API key ID (for revocation) | List your keys with GET /v1/api-keys to find valid IDs |
409 Conflict
idempotency_conflict
The same idempotency key was used with a different request payload.
429 Too Many Requests
rate_limit_exceeded
You have exceeded the rate limit for your tier.
Retry-After header with the number of seconds to wait.
Solution: Wait the number of seconds specified in the Retry-After header before retrying. Implement exponential backoff in your client. See Rate Limits for best practices.
500 Internal Server Error
dispatch_failed
The post was created but delivery to one or more platforms failed during dispatching.
post_creation_failed
An internal error occurred while creating the post.
requestId.
internal_error
A general internal server error.
requestId.
HTTP Status Code Summary
| Status Code | Meaning | Typical Error Codes |
|---|---|---|
| 400 | Bad Request | validation_error, missing_integrations, missing_account, upload_failed |
| 401 | Unauthorized | unauthorized |
| 402 | Payment Required | insufficient_credits |
| 403 | Forbidden | forbidden |
| 404 | Not Found | not_found |
| 409 | Conflict | idempotency_conflict |
| 429 | Too Many Requests | rate_limit_exceeded |
| 500 | Internal Server Error | dispatch_failed, post_creation_failed, internal_error |
Error Handling Best Practices
Use the error code, not the message
Always base your error handling logic on theerror.code field, not error.message. Messages may change between API versions; codes are stable.
Log the requestId
Always log therequestId from error responses. This value is essential for debugging with Soku support.
Implement retry logic for transient errors
Errors with status codes429 and 500 are often transient and can be resolved by retrying:
| Status | Retry? | Strategy |
|---|---|---|
| 400 | No | Fix the request. Retrying with the same payload will produce the same error. |
| 401 | No | Fix authentication. Retrying will not help. |
| 402 | No | Purchase credits first. |
| 403 | No | Activate subscription first. |
| 404 | No | Fix the resource identifier. |
| 429 | Yes | Wait for Retry-After seconds, then retry with exponential backoff. |
| 500 | Yes | Retry with exponential backoff. Maximum 3 retries recommended. |
Validate before sending
Check required fields and data formats on the client side before making an API call. This reduces unnecessary requests and avoids hitting rate limits with invalid payloads.Getting Help
If you encounter persistent errors or need assistance debugging an issue:- Note the
requestIdfrom the error response. - Note the timestamp and the endpoint you called.
- Contact Soku support with these details for faster resolution.
Next Steps
| Topic | Description |
|---|---|
| Rate Limits | Detailed rate limiting information and best practices |
| Code Examples | Complete examples with error handling built in |
| API Troubleshooting | Common API issues and solutions |