Skip to main content
The Magnific API uses standard HTTP status codes. A 2xx code means the request worked, a 4xx code means something in the request has to change, and a 5xx code means the problem is on our side.

Error body

Error responses are JSON objects with a human-readable message and the request_id of the request:
A few errors, such as a request to an unknown path, return the description in detail instead of message. Read message first and fall back to detail.

Validation errors

When the request body or its parameters are not valid, the API answers 400 Bad Request with Content-Type: application/problem+json and one entry per invalid field:

Request ID

Every response carries the request ID in the X-Request-Id header, and error responses also include it in the body as request_id. Both hold the same value. When you contact support about a failed request, send us its request_id: it lets us find that exact request. We generate the ID for every request; log it on your side next to your own request identifiers.
The request_id identifies an HTTP request, not a task. To follow a generation task, use the task_id returned when you create it. The webhook body also has a request_id field, but there it holds the task ID (the same value as task_id) and is not related to the request_id of errors.

Status codes

Retrying requests

Retry only the errors that can succeed later: 429, 500, 502, 503 and 504. Wait longer between attempts (for example 1, 2, 4 and 8 seconds) and stop after a few attempts. Other 4xx errors return the same answer until you change the request.
A 502 or 504 on a POST that creates a task does not always mean the task was not created: the request may have reached the model before the error. Before you retry, list your recent tasks with the GET endpoint of the same model to avoid creating, and paying for, the same task twice.

Failed tasks

An error status code means the request itself failed. A task that was created correctly can still fail later while it runs: in that case the GET endpoint of the task, and the webhook if you set one, return the task with status: FAILED. Use the task_id when you ask us about a failed task.