Overview
Midjourney is an async image model for high-quality diffusion generation, source-image-guided generation, region editing, variation, upscaling, reroll, and draft enhancement. Use this page when you are ready to call the API after trying Midjourney in the APIXO playground.| Capability | Value |
|---|---|
| Model ID | midjourney |
| Modes | text-to-image, image-to-image, image-edit, vary, upscale, reroll, enhance |
| Prompt length | Non-empty. Route limits are up to 2000 characters or up to 7500 UTF-8 bytes; keep prompts under 2000 characters for portable requests. |
| Reference images | text-to-image supports up to 20 image_urls as image prompts. image-to-image requires at least one image reference field and still uses diffusion. image-edit requires exactly 1 source image for the edit base. |
| Aspect ratios | 1:1, 1:2, 2:1, 2:3, 3:2, 3:4, 4:3, 5:6, 6:5, 9:16, 16:9 |
| Speeds | fast, turbo, draft; relaxed is deprecated by the official provider. To maintain compatibility, we still accept this value, but it will be converted to fast for execution and billing. draft belongs to the diffusion family, so it is available for text-to-image and image-to-image when version=7. |
| Result count | Usually 4 images for generation and variation, usually 1 image for upscale and enhance |
Workflow categories
| Category | Modes | Description |
|---|---|---|
| Direct generation | text-to-image, image-to-image, image-edit | Submit a new task directly. image-to-image is the diffusion route with at least one required image reference. image-edit is the region editing workflow. |
| Secondary editing | vary, upscale, reroll, enhance | Operate on a previous Midjourney task result. reroll uses taskId. vary, upscale, and enhance use taskId plus imageIndex. enhance is only available for draft results. |
Endpoint and authentication
Base URL:| Method | Endpoint | Purpose |
|---|---|---|
POST | /generateTask/midjourney | Submit a Midjourney task |
GET | /statusTask/midjourney?taskId={taskId} | Poll task status and retrieve results |
Copy-paste async quickstart
This minimal request submits a text-to-image task and returns ataskId.
taskId; you need it to poll for the final result.
Poll for result
resultJson after state becomes success:
data.supported_actions directly when you want to present follow-up actions to users. It is returned at the same level as resultJson and is only present when follow-up operations are available.
The follow-up action set depends on the source task mode:
| Source mode | Follow-up modes |
|---|---|
text-to-image | reroll, vary, upscale, image-edit, enhance |
image-to-image | reroll, vary, upscale, image-edit, enhance |
image-edit | image-edit, upscale |
vary | reroll, vary, upscale, image-edit |
upscale | vary, image-edit |
reroll | reroll, vary, upscale, image-edit, enhance |
enhance | vary, upscale, image-edit |
enhance is only returned for successful v7 + draft generation-family results. Follow-up actions that continue from a specific image can include imageIndex_options so clients can ask the user which image to continue from.
Request body
Text-to-image
Image-to-image
Image-edit
Useimage-edit when you want to edit a specific region. If mask, canvas, and imgPos are omitted on compatible routes, the backend can auto-fill a full-image edit region from image_urls[0].
Vary
Upscale
Reroll
Enhance
Parameters
Result delivery mode. Use
async for polling with statusTask, or callback for webhook delivery.Required when
request_type is callback. Must be a public HTTPS URL that can receive the final task payload. See Webhooks.Midjourney input parameters.
Response format
Submit task response
POST /generateTask/midjourney returns a task ID when the task is accepted:
API status code.
200 means the task was accepted.Human-readable status message.
Unique APIXO task identifier used with the status endpoint.
Status response fields
Unique APIXO task identifier.
Current task state:
pending, processing, success, or failed.JSON string containing the generated image URLs. Present when
state is success.Optional follow-up actions for successful results. This field is returned at the same level as
resultJson in data.Machine-readable failure code. Present when
state is failed.Human-readable failure message. Present when
state is failed.Task creation timestamp in Unix milliseconds.
Task completion timestamp in Unix milliseconds. Present after completion.
Processing duration in milliseconds. Present after completion.
Webhook callback mode
Use callback mode when your backend should receive the final result automatically instead of polling.Billing
Midjourney is billed per use. The selected mode and speed determine the unit price. The current public pricing is easiest to understand in two families:| Category | Mode | APIXO price | Notes |
|---|---|---|---|
| Direct generation | text-to-image | $0.10 / use (draft), $0.20 / use (fast), $0.40 / use (turbo) | Diffusion generation. v8.1 with is_hd=true and fast is $0.30 / use. |
| Direct generation | image-to-image | Same as text-to-image | Uses the same diffusion route as text-to-image, but requires at least one image reference input. |
| Direct generation | image-edit | $0.30 / use (fast), $0.60 / use (turbo) | Region editing workflow. |
| Secondary editing | vary | $0.30 / use | Requires a previous taskId and imageIndex. |
| Secondary editing | upscale | $0.30 / use | Requires a previous taskId and imageIndex. |
| Secondary editing | reroll | Same as the source task price | Re-runs the previous successful task with the same configuration. |
| Secondary editing | enhance | See Pricing | Draft-only enhancement workflow. Requires a previous taskId and imageIndex. |
Latency and polling
Actual latency may vary by prompt complexity, mode, selected route, and current queue load.| Mode or speed | Typical generation time | Recommended first poll | Poll interval |
|---|---|---|---|
turbo generation | 15s-25s | 20s after task creation | 3s-5s |
fast generation | 30s-45s | 20s after task creation | 3s-5s |
vary, upscale, or enhance | 15s-60s | 15s after task creation | 3s-5s |
reroll | Similar to the original generation speed | 20s after task creation | 3s-5s |
429, slow down requests and retry with backoff. For account-level details, see System APIs.
Errors and troubleshooting
HTTP errors
| Code | Meaning | What to do |
|---|---|---|
400 | Invalid request body, mode, parameter, prompt, or image URL | Fix the request before retrying |
401 | Missing or invalid API key | Check the Authorization header |
402 | Insufficient balance or quota | Add balance or switch account/key |
403 | Key or route cannot access the model | Check permissions and route strategy |
429 | Rate limit or concurrency limit reached | Retry with exponential backoff |
500 | Server error | Retry with backoff |
502 | Upstream provider error | Retry with backoff |
504 | Upstream timeout | Retry or use callback mode for long-running jobs |
Task failure codes
| Fail code | Meaning | What to do |
|---|---|---|
PromptInvalid | Prompt is invalid or rejected by the provider | Rewrite the prompt and remove unsafe or malformed content |
MissingParameter | Required request parameters are missing | Check mode, prompt, speed, image_urls, taskId, and imageIndex |
SensitiveContentDetected | Input or output was flagged by safety checks | Change the prompt or source image |
InputOutputSensitiveContentDetected | The input or output was flagged as sensitive | Try different inputs |
Upload error | Image upload or image size validation failed | Use a public direct image URL and keep image files within supported limits |
Website TimeOut | MidJourney official website did not respond after multiple attempts | Retry later or use callback mode |
Task TimeOut | The upstream task became outdated or timed out | Retry the generation |
RateLimitExceeded | Upstream or APIXO rate limit was reached | Retry with exponential backoff |
Common fixes
| Symptom | Fix |
|---|---|
Invalid mode type | Use one of text-to-image, image-to-image, image-edit, vary, upscale, reroll, or enhance. |
| Parameter is ignored | Use stable API field names: aspect_ratio, variety, stylization, and weirdness. |
| Prompt unexpectedly loses flags | Move Midjourney flags out of prompt; text after the first -- is stripped by the backend. |
taskId not found for vary, upscale, reroll, or enhance | Use the APIXO task ID from a previous Midjourney result, not the upstream provider task ID. |
| Image-edit fails to read image size | Use a public, directly fetchable source image URL. The backend reads image_urls[0] to fill default canvas and mask values. |
relaxed does not match expected execution speed or billing | relaxed is accepted for compatibility, but APIXO converts it to fast for execution and billing. |
draft is rejected | draft is only supported in the diffusion family (text-to-image and image-to-image) when version=7. |
enhance is rejected | enhance only works for successful Midjourney draft results. |