- Synchronous HTTP responses — direct return of
POST /xxx - Webhook callback bodies — POSTed to your
callback_urlonce an async task finishes
Synchronous response: success
On success the response carries upstream business fields and usually includes asuccess: true marker. See each API’s API reference for exact fields.
Example (Midjourney /midjourney/imagine):
Synchronous response: error
Error responses have nosuccess field — only error and trace_id:
| Field | Type | Notes |
|---|---|---|
error.code | string | Machine-readable code, see table below |
error.message | string | Human-readable description |
trace_id | string (UUID) | Request trace ID. Always include this when filing a support ticket. |
Webhook callback body
If you passedcallback_url when creating the task, we POST a JSON to that URL when the task finishes. The callback envelope differs from the sync envelope — it always includes a success field:
Success callback:
callback_url is hard to guess, or verify the incoming task_id against tasks you previously created.
HTTP status codes
| Status | Meaning | Client guidance |
|---|---|---|
200 | Success (sync result or async accepted) | Parse JSON |
400 | Malformed request | Read error.message, do not retry |
401 | Token invalid / expired / mismatched | Check credentials, do not retry |
403 | Balance exhausted / credential disabled / content moderation | Inspect error.code, usually do not retry |
404 | Endpoint not found | Verify URL |
429 | Rate limited | Retry with exponential backoff |
500 | Gateway or upstream internal error | Retry once with backoff; if still failing, escalate with trace_id |
504 | Upstream timeout | Backoff retry, or switch to async + webhook |
Verified error codes
These all come fromPlatformGateway exception classes. Service-specific upstream codes (e.g. Midjourney’s own task_failed) follow each API’s own docs.
error.code | HTTP | Meaning |
|---|---|---|
bad_request | 400 | Malformed JSON payload |
no_token | 400 | Missing Authorization header |
invalid_token | 401 | Token is wrong or revoked |
token_expired | 401 | Token expired |
token_mismatched | 401 | Token does not belong to the requested service |
disabled | 403 | Credential or application disabled |
used_up | 403 | Instance balance and / or general balance exhausted |
forbidden | 403 | Content moderation rejected |
no_api | 404 | Path not registered |
too_many_requests | 429 | Rate limit exceeded |
api_error | 500 | Gateway / upstream internal error |
timeout | 504 | Upstream inference timeout |
Retry guidance
- 4xx generally should not be auto-retried (429 excepted); inspect
error.messageand fix the request - 429 / 5xx may be retried with exponential backoff and jitter
- Persist
trace_idto your logs for the fastest support resolution
Filing a ticket
Always include:trace_id- Request URL, headers (mask the Token), and body
- Response status and body
support@acedata.cloud / status page.
