curl --request POST \
--url https://api.mage.space/v1/{architecture}/generate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "Editorial portrait in soft daylight, 35mm film look"
}
'import requests
url = "https://api.mage.space/v1/{architecture}/generate"
payload = { "prompt": "Editorial portrait in soft daylight, 35mm film look" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({prompt: 'Editorial portrait in soft daylight, 35mm film look'})
};
fetch('https://api.mage.space/v1/{architecture}/generate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"request_id": "d7e6c0f3-6699-4f6c-bb45-2ad7fd9158ff",
"status": "in_progress",
"architecture": "flux2",
"model_id": "flux2-dev",
"created_at": "2026-09-17T14:52:48.000Z",
"updated_at": "2026-09-17T14:52:49.000Z",
"billing": {
"mode": "gems",
"gems_charged": 40
},
"result": null,
"error": null,
"status_url": "https://api.mage.space/v1/requests/d7e6c0f3-6699-4f6c-bb45-2ad7fd9158ff/status",
"cancel_url": "https://api.mage.space/v1/requests/d7e6c0f3-6699-4f6c-bb45-2ad7fd9158ff/cancel"
}{
"error": {
"code": "invalid_config",
"message": "`resolution` must be one of: 768P, 2K."
}
}{
"error": {
"code": "unauthorized",
"message": "The API key is invalid or has been revoked."
}
}{
"error": {
"code": "insufficient_gems",
"message": "This generation costs 40 gems and the account balance is too low.",
"request_id": "d7e6c0f3-6699-4f6c-bb45-2ad7fd9158ff",
"gems_required": 40
}
}{
"error": {
"code": "content_blocked",
"message": "The request was blocked by Mage's content policy.",
"request_id": "d7e6c0f3-6699-4f6c-bb45-2ad7fd9158ff"
}
}{
"error": {
"code": "architecture_not_found",
"message": "Unknown architecture `fluxx`. List architectures at GET /v1/architectures."
}
}{
"error": {
"code": "architecture_retired",
"message": "This architecture has been retired.",
"request_id": "d7e6c0f3-6699-4f6c-bb45-2ad7fd9158ff"
}
}{
"error": {
"code": "too_many_requests",
"message": "At most 20 generations may be in flight at once for this account; 20 are running now."
}
}{
"error": {
"code": "content_blocked",
"message": "The request was blocked by an external content restriction.",
"request_id": "d7e6c0f3-6699-4f6c-bb45-2ad7fd9158ff"
}
}{
"error": {
"code": "internal_error",
"message": "Something went wrong on our side. Retry, and contact support if it persists."
}
}Generate
Submit a generation with any Mage model: the partial config body, the Idempotency-Key header, the 202 response, and every error the generate endpoint can return.
curl --request POST \
--url https://api.mage.space/v1/{architecture}/generate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "Editorial portrait in soft daylight, 35mm film look"
}
'import requests
url = "https://api.mage.space/v1/{architecture}/generate"
payload = { "prompt": "Editorial portrait in soft daylight, 35mm film look" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({prompt: 'Editorial portrait in soft daylight, 35mm film look'})
};
fetch('https://api.mage.space/v1/{architecture}/generate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"request_id": "d7e6c0f3-6699-4f6c-bb45-2ad7fd9158ff",
"status": "in_progress",
"architecture": "flux2",
"model_id": "flux2-dev",
"created_at": "2026-09-17T14:52:48.000Z",
"updated_at": "2026-09-17T14:52:49.000Z",
"billing": {
"mode": "gems",
"gems_charged": 40
},
"result": null,
"error": null,
"status_url": "https://api.mage.space/v1/requests/d7e6c0f3-6699-4f6c-bb45-2ad7fd9158ff/status",
"cancel_url": "https://api.mage.space/v1/requests/d7e6c0f3-6699-4f6c-bb45-2ad7fd9158ff/cancel"
}{
"error": {
"code": "invalid_config",
"message": "`resolution` must be one of: 768P, 2K."
}
}{
"error": {
"code": "unauthorized",
"message": "The API key is invalid or has been revoked."
}
}{
"error": {
"code": "insufficient_gems",
"message": "This generation costs 40 gems and the account balance is too low.",
"request_id": "d7e6c0f3-6699-4f6c-bb45-2ad7fd9158ff",
"gems_required": 40
}
}{
"error": {
"code": "content_blocked",
"message": "The request was blocked by Mage's content policy.",
"request_id": "d7e6c0f3-6699-4f6c-bb45-2ad7fd9158ff"
}
}{
"error": {
"code": "architecture_not_found",
"message": "Unknown architecture `fluxx`. List architectures at GET /v1/architectures."
}
}{
"error": {
"code": "architecture_retired",
"message": "This architecture has been retired.",
"request_id": "d7e6c0f3-6699-4f6c-bb45-2ad7fd9158ff"
}
}{
"error": {
"code": "too_many_requests",
"message": "At most 20 generations may be in flight at once for this account; 20 are running now."
}
}{
"error": {
"code": "content_blocked",
"message": "The request was blocked by an external content restriction.",
"request_id": "d7e6c0f3-6699-4f6c-bb45-2ad7fd9158ff"
}
}{
"error": {
"code": "internal_error",
"message": "Something went wrong on our side. Retry, and contact support if it persists."
}
}GET /v1/architectures as input_schema.
The response is the request’s current state, with status_url to poll and cancel_url to stop it. Gems are charged when the request is accepted; a request that fails is refunded. See Requests and lifecycle for what happens next.
This page documents the endpoint in general. For a specific model, open its page under Models: the playground there is filled in with that model’s fields.Authorizations
An API key from Settings → API, sent as Authorization: Bearer mage_sk_…. Keys are for server-side code only.
Headers
A key of your choosing, 1 to 255 characters, scoped to your API key. A retried submit with the same key returns the original request with 200 instead of charging again. The key identifies the first submission made with it; later bodies are not compared. A refusal recorded under the key (its envelope carries request_id) replays the same way, so a new attempt needs a new key.
1 - 255Path Parameters
The architecture id, from the catalog.
mango, krea_2, minimax_h3, z_image, stable_diffusion_xl, kiwi, peach_max, blueberry, wan_22, wan, flux2, flux, chroma, peach, qwen_image, qwen_image_edit_plus, hidream, framepack, ltx_video, selfie, stable_diffusion_v15, stable_diffusion_v35_large, stable_diffusion_v35_medium, veo3, veo3_1, flux_kontext_dev, guava, nano_banana_v2, sdxl_plus, cherry, raspberry, grok_image, grok_video, berry, gpt_image_2, anima, melon, plum, lemon Body
A partial config for the architecture.
Response
The request was accepted; poll status_url for the result. A retried submit whose Idempotency-Key was used before answers 200 with the same shape, the original request, and charges nothing.
The request id, also the id in status_url and cancel_url.
queued and in_progress are live; completed, failed, and cancelled are final.
queued, in_progress, completed, failed, cancelled The architecture the request generates with.
The model variant, when the architecture has variants.
When the request was accepted.
When the request last changed.
Show child attributes
Show child attributes
The output once status is completed, else null.
Show child attributes
Show child attributes
Why the request failed once status is failed, else null.
Show child attributes
Show child attributes
Poll this URL for the request.
POST to this URL to stop the request.

