Skip to navigation

Midjourney V8.2

View as Markdown

Midjourney V8.2 through one model ID. Generate four images from text and image prompts, then vary or upscale one of them or reroll the set, or retexture, edit, blend and describe images.

  • One model ID for every Midjourney operation. action picks it and defaults to generate; the buttons Midjourney shows under a result are actions too.
  • Asynchronous: the create call returns a task ID at once. A fast generate usually finishes in 1 to 3 minutes; poll for up to 10 minutes.
  • A generate returns four images. A follow-up names your earlier task in source_task_id and, where it picks an image, its position in index (1 to 4).
  • Midjourney parameters such as --ar, --s, --sref and --no go in prompt. Version, speed, quality and draft are fields.
  • Priced per call by speed and quality; upscale and describe have one low flat price. A refused request and a failed task cost nothing.
  • Results are deleted after 7 days. Download the images you want to keep.
POST/v1/images/tasksTry it

Opens this model in the API Explorer. Enter your BeatAPI API key to create a task: the call is real and is billed to your own balance.

Endpoint and authentication

POST https://api.beatapi.io/v1/images/tasks

Authorization

string · Required

Your BeatAPI API key, sent as Bearer <BEATAPI_API_KEY>. Create keys in the Dashboard. Keep keys on your server; never ship them in a browser or mobile app.

Send the body as JSON with Content-Type: application/json. Idempotency-Key is optional: send a unique value (at most 255 characters) per logical request and reuse it only to retry that exact body. Within 24 hours a retry with the same key and body returns the first response again with Idempotent-Replayed: true; the same key with a different body returns 409 idempotency_conflict. Responses other than 2xx are not stored, so a retry after a 400 or 402 runs again.

How a request works

  1. Create the task POST the parameters below to the endpoint. A 201 means the task was accepted and its price reserved from your balance; the work runs in the background. Save data.id.
  2. Wait for it to finish Call GET /v1/tasks/{task_id} and wait data.poll_after_seconds between calls (5 s for images, 8 s for videos) until status is succeeded or failed. Or register a webhook for task.succeeded and task.failed; keep polling as the fallback, because a task stopped by the processing timeout sends no event.
  3. Save the result On succeeded, download every data.output.media[].url and store the files you need; BeatAPI does not promise how long result URLs stay available. On failed, read data.error_code and data.error_message: the reserved amount was returned to your balance, and data.retryable says whether sending the same request again can succeed.

Input modes

ModeRequired inputsNotes
Generatemodel, promptThe default action. Optional images (1 to 5 image prompts), aspect_ratio, quality, speed, draft. Returns four images. prompt may be left out only when images holds two or more links.
Variationmodel, action, source_task_id, indexThe V button for one image of a four-image result. Returns four new images.
Upscalemodel, action, source_task_id, indexPicks one image of a four-image result and returns it alone, at the same pixel size. It takes no follow-up.
Rerollmodel, action, source_task_idRedraws the whole prompt of a four-image result as four new images. No index.
Retexturemodel, action, images, promptExactly one image. Keeps its composition and restyles it. Returns four images, which take no follow-up.
Edit (beta)model, action, images, promptExactly one PNG with transparent areas; only those are redrawn. Returns four images, which take no follow-up.
Blendmodel, action, images2 to 5 images merged into one picture; aspect_ratio 1:1, 3:2 or 2:3. Rendered with Midjourney V7.
Describemodel, action, imagesExactly one image. Returns four prompts in output.data.prompts and no image.

Request parameters

model

string · Required

The model to run.

Value: mj-v8.2

If the value is wrong

  • Missing: "model" is required
  • Unknown model ID: "model" mj-v7 is not catalogued
  • A video model sent to this endpoint: "model" seedance-2.5 is served by POST /v1/videos/tasks, not this endpoint

prompt

string · Optional

What to draw, as on midjourney.com: the description first, then any Midjourney parameters such as --ar 3:2 --s 250. For retexture and edit it describes the new look.

Length: 1–2048 characters

  • Required for generate unless images holds two or more links, and for retexture and edit. Other actions do not take it.
  • For generate, the text without links and -- parameters is at most 1024 characters.
  • Parameters that the API sets by field, and those it does not support, are refused; see the parameter table further down.

If the value is wrong

  • Left out on a generate with fewer than two images: generate needs "prompt"; only two or more images may go without one
  • Left out on retexture or edit: "prompt" is required for action retexture
  • Sent with an action that does not take it: prompt is not used by action upscale; leave it out
  • Empty or longer than the limit: "prompt" has an unsupported length
  • The text without links and parameters is too long: the prompt's text (without links and --parameters) is at most 1024 characters
  • A version parameter: remove --v from the prompt: the version is fixed at 8.2; leave it out
  • A speed parameter: remove --fast from the prompt: set the speed field to fast instead
  • A decimal ratio: --ar takes whole numbers, like 139:100 instead of 1.39:1
  • --q outside 1 to 4: --q takes 1, 2, 3 or 4 (detail; 4 is the most detailed); for a bigger picture set quality hd

action

string · Optional · Default: generate

The operation to run. Each action takes only its own fields (see the input modes above); any other field is refused, so you never pay for a setting that had no effect.

Allowed values: generate, variation, upscale, reroll, retexture, edit, blend, describe
Default: generate

  • generate starts afresh. variation, upscale and reroll work on a four-image result; an upscaled image takes no follow-up.
  • retexture, edit, blend and describe start from your own images in images.
  • Input is not case-sensitive; the documentation writes the lower-case form.

If the value is wrong

  • A value not in the list: "action" must be one of: [generate variation upscale reroll retexture edit blend describe]
  • A field the action does not take: quality is not used by action retexture; leave it out

images

string[] · Optional

Your own images as public HTTPS links. For generate they are image prompts (1 to 5); retexture, edit and describe take exactly one; blend takes 2 to 5.

Items: 1–5
Each item is a public https:// URL. For a local file, upload it first with POST /v1/files and pass the returned data.url.

  • Links must be public and download within a few seconds. Have a local file? Upload it with POST /v1/files and send the returned link.
  • For edit, send a PNG and cut out (make transparent) the parts to change. An image without transparency, such as any JPEG, is still drawn and billed.
  • Follow-ups (variation, upscale, reroll) work on source_task_id and do not take images.
  • Positions in error messages are 0-based: images[0] is the first link.

If the value is wrong

  • Missing on retexture, edit, blend or describe: "images" is required for action describe
  • Fewer than blend needs: action blend needs at least 2 image(s) in "images"
  • More than one for describe, retexture or edit: action describe takes at most 1 image(s) in "images"
  • More than five: "images" accepts at most 5 items
  • Not an https:// link: "images[0]" must be a public HTTPS URL

aspect_ratio

string · Optional

Shape of the image as width:height, for generate and blend.

Allowed values: 1:1, 4:3, 3:4, 3:2, 2:3, 16:9, 9:16, 21:9, 9:21, 5:4, 4:5, 2:1, 1:2

  • A generate without it is drawn 1:1.
  • blend takes only 1:1 (its default), 3:2 or 2:3.
  • For any other shape write --ar W:H with whole numbers in prompt, for example --ar 7:4; it overrides this field.

If the value is wrong

  • A value not in the list: "aspect_ratio" must be one of: [1:1 4:3 3:4 3:2 2:3 16:9 9:16 21:9 9:21 5:4 4:5 2:1 1:2]
  • A blend with another shape: "aspect_ratio" for blend is one of: 1:1, 3:2, 2:3

quality

string · Optional · Default: standard

hd draws about 2K instead of the standard size. It is set when you generate and cannot be added later.

Allowed values: standard, hd
Default: standard

  • At fast, hd costs more; at relax it costs the same.
  • upscale returns the image at the pixel size it was drawn at; it does not enlarge it. Ask for hd on the first call when you want a bigger picture.
  • A follow-up runs at its source task’s quality. Leave the field out on a follow-up, or send the same value.
  • retexture, edit, blend and describe do not take it.

If the value is wrong

  • A value not in the list: "quality" must be one of: [standard hd]
  • Together with draft: draft cannot be combined with quality hd
  • A follow-up asking for another quality than its source task: source_task_id was made at quality hd and a follow-up runs the same; leave quality out

speed

string · Optional · Default: fast

fast (the default) usually finishes a generate in 1 to 3 minutes; relax takes 2 to 5 minutes and costs less.

Allowed values: fast, relax
Default: fast

  • A follow-up runs at its source task’s speed and is billed at it. Leave the field out on a follow-up, or send the same value.
  • describe does not take it.

If the value is wrong

  • A value not in the list: "speed" must be one of: [fast relax]
  • A follow-up asking for another speed than its source task: source_task_id was made at speed relax and a follow-up runs the same; leave speed out

draft

boolean · Optional

For generate only. true returns 24 quick 512 px drafts at a generate’s price, to explore a prompt before rendering it in full.

  • Works at either speed; cannot be combined with quality hd.
  • A draft takes no follow-up and its images cannot be picked. To render a prompt in full, send it again without draft; write --seed N in the draft’s prompt for a similar, not identical, composition.

If the value is wrong

  • Not a boolean: "draft" must be a boolean
  • A follow-up on a draft: source_task_id is a draft, which takes no follow-up; send the prompt again without draft (add --seed N to keep a similar composition)

source_task_id

string · Optional

For a follow-up: the id of your own earlier Midjourney task that it works on. The task must have succeeded.

  • Read output.data.follow_ups of that task first: it lists the actions the result accepts. Any other follow-up is refused at no charge.
  • An upscaled image takes no follow-up. To vary it, send variation with the source_task_id of its four-image result and the same index.
  • Results of upscale, retexture, edit, describe and drafts take no follow-up.

If the value is wrong

  • Not a task id: "source_task_id" must be the id of one of your earlier tasks: "task_" followed by 32 letters or digits
  • Missing on a follow-up: "source_task_id" is required for action upscale: the id of your own Midjourney task it works on
  • The source task is still running or failed: source_task_id has not finished successfully; wait for it to succeed and try again
  • A task of another model: source_task_id was made by seedream-5.5, not Midjourney; name one of your Midjourney tasks
  • A follow-up on an upscaled image: an upscaled image takes no follow-up; to vary it, send action variation with source_task_id of its four-image result and the same index
  • A result of retexture, edit or describe: source_task_id is the result of retexture, which takes no follow-up
  • The same image of the same result upscaled again: that image of source_task_id was already upscaled in task_Up4Rk9Ns2Wq7Zx5Mc8Hv1Lb6Tj3Fd0Gy; use that task's result
  • An action that result does not list in follow_ups: this result does not support action upscale; generate the image again and continue from the new result

index

integer · Optional

Which image of a four-image result to work on, 1 to 4. It is 1-based and counts output.media of the source task.

Range: 1–4

  • Required for upscale and variation.
  • Not used by reroll or by actions without source_task_id.

If the value is wrong

  • Missing on upscale or variation: "index" is required for action upscale
  • Not a whole number from 1 to 4: "index" is outside its supported range

callback_url

string · Optional

An address to notify when this task succeeds or fails: a public HTTPS URL on the same scheme, host and port as one of your enabled webhook endpoints, which signs the delivery with its secret.

Length: ≤ 2048 characters

  • Register the endpoint first with POST /v1/webhooks. BeatAPI sends task.succeeded or task.failed with the same body, headers and retries as an account webhook; an account endpoint subscribed to the event receives it too, and an address identical to that endpoint’s is notified once.
  • The callback stops when the signing endpoint is deleted, disabled or moved to another host.

If the value is wrong

  • The value is not a string: "callback_url" must be a string.
  • The address is longer than 2048 characters: "callback_url" must be at most 2048 characters.
  • It is not a URL, or has no host or no http or https scheme: "callback_url" must be a valid https URL.
  • It uses http, or points to a private or otherwise non-public address: "callback_url" must be a public HTTPS URL.
  • No enabled webhook endpoint has the same scheme, host and port: "callback_url" must be on the host of one of your active webhook endpoints, whose secret signs it; register one with POST /v1/webhooks.

The gateway also checks these combinations before creating the task:

  • action picks the operation and defaults to generate; each action takes only the fields listed for it here, and any other field is refused
  • a refused request (HTTP 400) and a failed task are not charged
  • generate: prompt (required unless images holds 2 or more links), optional images (1-5 public image links used as image prompts), aspect_ratio (1:1 when left out), quality, speed, draft; returns four images
  • quality hd draws about 2K at generate time; it cannot be added later, so set it on the first call when you want a bigger picture
  • variation: source_task_id of a four-image result and index (1-4); Midjourney’s V button for that image, returning four new images
  • upscale: source_task_id of a four-image result and index (1-4); it picks that image and returns it alone at the same pixel size (it does not enlarge), and an upscaled image takes no follow-up
  • reroll: source_task_id of a four-image result, no index; redraws the whole prompt as four new images
  • retexture and edit: images (exactly 1) and prompt; retexture keeps the composition and restyles it by prompt; edit (beta) redraws the transparent areas of a PNG, so cut out the parts to change: an image without transparency (any JPEG) is still drawn and billed; both return four images, which take no follow-up
  • blend: images (2-5) and optional aspect_ratio 1:1 (default), 3:2 or 2:3; it renders with Midjourney V7, so its look can differ from V8.2 images; describe: images (exactly 1), returns four prompts in output.data.prompts and no image
  • index is 1-based and counts output.media of the source task; output.data.kind (grid, single or text) and output.data.follow_ups list what a finished task accepts (occasionally fewer, or none, when the task was served by an overflow route), and any other follow-up is refused at no charge; read it before planning a chain
  • a follow-up runs at the source task’s speed and quality (leave both out, or send the same values) and is billed as a new image at those settings, except upscale and describe, which have one flat price
  • a draft result takes no follow-up and its images cannot be selected: to render a prompt in full, send it again without draft (write —seed N in the draft’s prompt for a similar, not identical, composition)
  • Midjourney parameters go in prompt as on midjourney.com: —ar W:H with whole numbers (overrides aspect_ratio), —s 0-1000, —c 0-100, —seed 0-4294967295, —exp 0-100, —q 1-4, —raw, —no, —tile, —weird 0-3000, —iw 0-3, —sref (links or codes) and —sw; for generate the text without links and parameters is at most 1024 characters
  • set the version (8.2), speed, quality and draft by fields only: a prompt with —v, —niji, —fast, —relax, —turbo, —hd or —draft is refused, as are —oref, —cref, —stop, —p, —bs, —repeat, —edit, —stealth and —public, which this API does not support
  • speed fast (default) usually takes 1-3 minutes, relax 2-5 minutes at a lower price, edit and retexture up to 5 minutes, upscale and describe seconds; poll for up to 10 minutes; quality hd costs more at fast and the same at relax; draft works at either speed, returns 24 quick 512 px images at a generate’s price and cannot be hd
  • image links must be public and download within a few seconds; upload a local file with POST /v1/files and send its link; save the results you want to keep: images are deleted after 7 days

Actions at a glance

Every action is a new task on the same endpoint. output.data.kind of the result says what it is: grid (four images), single (one upscaled image) or text.

ActionWorks onFields besides model and actionReturns
generateText and image promptsprompt, images, aspect_ratio, quality, speed, draftFour images
variationA four-image resultsource_task_id, index, speed, qualityFour images
upscaleA four-image resultsource_task_id, index, speed, qualityOne image, no follow-up
rerollA four-image resultsource_task_id, speed, qualityFour images
retextureOne image of yoursimages, prompt, speedFour images, no follow-up
edit (beta)One PNG of yoursimages, prompt, speedFour images, no follow-up
blend2 to 5 images of yoursimages, aspect_ratio, speedFour images
describeOne image of yoursimagesFour prompts, no image
  • A field the action does not take is refused, not ignored: a stray index on a generate would otherwise be paid for and have no effect.
  • blend renders with Midjourney V7, so its look can differ from V8.2 images.

Chaining follow-ups

A follow-up names one of your own finished Midjourney tasks in source_task_id. It works on a four-image result, and index picks one of its images: 1 is the first item of that task’s output.media, 4 the last.

  • variation with index: the V button, four new images close to that one.
  • upscale with index: the U button, that image alone. Upscaling the same image of the same result again is refused and names the task that already holds it.
  • reroll: four new images from the same prompt.

An upscaled image takes no follow-up; to vary it, send variation with its four-image result and the same index. Results of retexture, edit, describe and drafts take no follow-up either.

Before you plan a chain, read output.data.follow_ups of the task you want to continue: it lists exactly the actions that result accepts. A result can list fewer, or none, when it was made on a fallback line; any other follow-up is refused at no charge, and you can generate the image again and continue from the new result.

A follow-up runs at the speed and quality of its source task, and is billed at them. Leave speed and quality out, or send the same values; a different value is refused.

Speed, quality and drafts

SettingWhat it doesPrice
speed fast (default)A generate usually takes 1 to 3 minutes.Higher rate
speed relaxUsually 2 to 5 minutes.Lower rate
quality hdDraws about 2K. Set it when you generate; it cannot be added later.Higher at fast, the same at relax
draft true24 quick 512 px images to explore a prompt; no follow-up, no hd.A generate’s price at that speed
  • edit and retexture can take up to 5 minutes; upscale and describe take seconds. Poll for up to 10 minutes before you give up on a task.
  • upscale picks an image; it does not enlarge it. The upscaled image has the pixel size it was drawn at.

Midjourney parameters in the prompt

Write Midjourney’s own parameters at the end of prompt, as on midjourney.com. They are passed on as written.

ParameterValuesNotes
--ar W:HWhole numbers, such as 7:4Overrides aspect_ratio. Decimals such as 1.39:1 are refused; write 139:100.
--s0 to 1000Stylize.
--c0 to 100Chaos: how different the four images are.
--seed0 to 4294967295Repeatable starting noise.
--q1 to 4Detail; 4 is the most detailed. For a bigger picture use quality hd.
--sref and --swImage links or style codes; weightStyle reference and its weight.
--iw0 to 3Weight of the image prompts in images.
--exp0 to 100Experimental aesthetics.
--weird0 to 3000Unconventional results.
--noWordsWhat to leave out.
--raw, --tileNo valueLess default styling; a seamless tile.
  • Set the version (8.2), speed, quality and draft by fields: a prompt with --v, --niji, --fast, --relax, --turbo, --hd or --draft is refused.
  • Not supported by this API, and refused: --oref, --cref, --stop, --p, --bs, --repeat, --edit, --stealth, --public.
  • For generate, the text without links and parameters is at most 1024 characters.

Results and retention

Images are stored for 7 days and then deleted; download the ones you want to keep. describe stores no file: its four prompts are in output.data.prompts.

Image links you send must be public and download within a few seconds. A link that cannot be fetched fails the task, which is not charged.

Request examples

cURL
curl --request POST \
--url https://api.beatapi.io/v1/images/tasks \
--header "Authorization: Bearer $BEATAPI_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "mj-v8.2",
"prompt": "A lighthouse on a basalt cliff at dusk, storm clouds breaking, cinematic light --s 250",
"aspect_ratio": "16:9"
}'
Python
import os
import requests
response = requests.post(
"https://api.beatapi.io/v1/images/tasks",
headers={"Authorization": f"Bearer {os.environ['BEATAPI_API_KEY']}"},
json={
"model": "mj-v8.2",
"prompt": "A lighthouse on a basalt cliff at dusk, storm clouds breaking, cinematic light --s 250",
"aspect_ratio": "16:9"
},
timeout=60,
)
body = response.json()
if not response.ok:
raise RuntimeError(f"{response.status_code} {body['error']['code']}: {body['error']['message']}")
task = body["data"]
print(task["id"], task["status"])
JavaScript
const response = await fetch('https://api.beatapi.io/v1/images/tasks', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.BEATAPI_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"model": "mj-v8.2",
"prompt": "A lighthouse on a basalt cliff at dusk, storm clouds breaking, cinematic light --s 250",
"aspect_ratio": "16:9"
}),
});
const body = await response.json();
if (!response.ok) throw new Error(`${response.status} ${body.error.code}: ${body.error.message}`);
console.log(body.data.id, body.data.status);

Generate four images

The default action. Midjourney parameters go at the end of the prompt.

curl --request POST \
--url https://api.beatapi.io/v1/images/tasks \
--header "Authorization: Bearer $BEATAPI_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "mj-v8.2",
"prompt": "A lighthouse on a basalt cliff at dusk, storm clouds breaking, cinematic light --s 250",
"aspect_ratio": "16:9"
}'

Vary image 3

The V3 button: four new images close to the third image of the generate above.

curl --request POST \
--url https://api.beatapi.io/v1/images/tasks \
--header "Authorization: Bearer $BEATAPI_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "mj-v8.2",
"action": "variation",
"source_task_id": "task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ",
"index": 3
}'

Upscale image 2

The U2 button on the variation result: the second image alone, at the pixel size it was drawn at. It takes no follow-up.

curl --request POST \
--url https://api.beatapi.io/v1/images/tasks \
--header "Authorization: Bearer $BEATAPI_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "mj-v8.2",
"action": "upscale",
"source_task_id": "task_Vb3nK8wQ2mZr5Tx9Lc4Hd7Jf1Ps6Ya0E",
"index": 2
}'

Describe an image

Four prompts that would draw an image like yours, in output.data.prompts.

curl --request POST \
--url https://api.beatapi.io/v1/images/tasks \
--header "Authorization: Bearer $BEATAPI_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "mj-v8.2",
"action": "describe",
"images": [
"https://cdn.beatapi.io/samples/smart-bottle.png"
]
}'

Image prompt and style reference at relax, in HD

A product image as image prompt, a style reference in the prompt; relax costs less and hd costs nothing extra there.

curl --request POST \
--url https://api.beatapi.io/v1/images/tasks \
--header "Authorization: Bearer $BEATAPI_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "mj-v8.2",
"prompt": "The bottle on a sunlit kitchen counter, soft morning light --sref https://cdn.beatapi.io/samples/neon-singer.png --sw 200",
"images": [
"https://cdn.beatapi.io/samples/smart-bottle.png"
],
"aspect_ratio": "4:5",
"speed": "relax",
"quality": "hd"
}'

Blend two images

Merges the images into one picture, rendered with Midjourney V7. No prompt.

curl --request POST \
--url https://api.beatapi.io/v1/images/tasks \
--header "Authorization: Bearer $BEATAPI_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "mj-v8.2",
"action": "blend",
"images": [
"https://cdn.beatapi.io/samples/smart-bottle.png",
"https://cdn.beatapi.io/samples/neon-singer.png"
],
"aspect_ratio": "3:2"
}'

Responses

Create a task (201)

The task object. output is null until the task succeeds. Fields marked “while running” disappear once the task finishes.

{
"data": {
"id": "task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ",
"object": "task",
"task_kind": "image",
"capability_id": "mj-v8.2",
"capability_version": 1,
"media_type": "image",
"model": "mj-v8.2",
"status": "queued",
"stage": "queued",
"created_at": 1791993600,
"updated_at": 1791993600,
"completed_at": null,
"poll_after_seconds": 5,
"output": null,
"usage": {
"credits_reserved": 0.08,
"credits_settled": 0,
"credits_refunded": 0,
"credits_charged": 0.08
},
"request_id": "202611260732156684925978268d9d6yOLdMCKV",
"error_code": null,
"error_message": null
}
}
FieldTypeDescription
data.idstringTask ID: task_ followed by 32 letters and digits. Use it to poll and to match webhook events.
data.objectstringAlways task.
data.task_kindstringimage or video.
data.capability_idstringThe model ID you sent.
data.capability_versionintegerContract version of the model, currently 1.
data.media_typestringimage or video.
data.modelstringThe model ID you sent (same as capability_id).
data.statusstringqueued, processing, succeeded or failed. Only the last two are final.
data.stagestringRepeats status; kept for older clients.
data.created_atintegerWhen the task was created, Unix seconds.
data.updated_atintegerLast change, Unix seconds.
data.completed_atinteger | nullWhen the task finished, Unix seconds; null while it runs.
data.poll_after_secondsintegerWhile running: how long to wait before the next poll (5 for images, 8 for videos).
data.typical_secondsobjectWhile running, when enough recent tasks exist: p50 and p90 completion times in seconds over the last window, from samples tasks.
data.outputobject | nullThe result; null until status is succeeded. See the output fields below.
data.usage.credits_reservednumberUSD held from your balance when the task was created.
data.usage.credits_chargednumberUSD this task costs; 0 on a failed task.
data.usage.credits_settlednumberUSD finally taken; set when the task succeeds, otherwise 0.
data.usage.credits_refundednumberUSD returned to your balance; equals the reservation on a failed task once the refund is recorded.
data.usage.billable_duration_secondsintegerVideo only: the seconds the price is based on. Absent when the model reports no duration.
data.request_idstringRequest ID. Include it when you contact support.
data.error_codestring | nullFailure code; null unless the task failed.
data.error_messagestring | nullWhat went wrong and what to change; null unless the task failed.

Finished task

GET /v1/tasks/{task_id} returns HTTP 200 with status: "succeeded" and the result in data.output.

{
"data": {
"id": "task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ",
"object": "task",
"task_kind": "image",
"capability_id": "mj-v8.2",
"capability_version": 1,
"media_type": "image",
"model": "mj-v8.2",
"status": "succeeded",
"stage": "succeeded",
"created_at": 1791993600,
"updated_at": 1791993690,
"completed_at": 1791993690,
"output": {
"media": [
{
"type": "image",
"url": "https://media.beatapi.io/outputs/task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ/0.png",
"mime_type": "image/png"
},
{
"type": "image",
"url": "https://media.beatapi.io/outputs/task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ/1.png",
"mime_type": "image/png"
},
{
"type": "image",
"url": "https://media.beatapi.io/outputs/task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ/2.png",
"mime_type": "image/png"
},
{
"type": "image",
"url": "https://media.beatapi.io/outputs/task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ/3.png",
"mime_type": "image/png"
}
],
"url": "https://media.beatapi.io/outputs/task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ/0.png",
"r2_url": "https://media.beatapi.io/outputs/task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ/0.png",
"data": {
"kind": "grid",
"follow_ups": [
"variation",
"upscale",
"reroll"
]
}
},
"usage": {
"credits_reserved": 0.08,
"credits_settled": 0.08,
"credits_refunded": 0,
"credits_charged": 0.08
},
"request_id": "202611260732156684925978268d9d6yOLdMCKV",
"error_code": null,
"error_message": null
}
}

Output fields

FieldTypeDescription
output.mediaobject[]The images: four for a grid, one for an upscale, none for describe. index counts these from 1.
output.media[].typestringAlways image.
output.media[].urlstringHTTPS link to the stored image. It is deleted after 7 days; download what you want to keep.
output.media[].mime_typestringThe stored file type, image/png.
output.urlstringThe primary asset: the first image link. Empty for describe.
output.r2_urlstringThe old name of output.url, with the same value; output.url is the one to read.
output.data.kindstringgrid (four images), single (one upscaled image) or text (describe).
output.data.follow_upsstring[]The actions this result accepts as source_task_id. Empty when it takes none.
output.data.promptsstring[]Describe only: the four prompts.

Failed task

A failed task is still HTTP 200 on GET /v1/tasks/{task_id}: the failure is in the body. The reservation is returned in full, so nothing is charged.

{
"data": {
"id": "task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ",
"object": "task",
"task_kind": "image",
"capability_id": "mj-v8.2",
"capability_version": 1,
"media_type": "image",
"model": "mj-v8.2",
"status": "failed",
"stage": "failed",
"created_at": 1791993600,
"updated_at": 1791993690,
"completed_at": 1791993690,
"output": null,
"usage": {
"credits_reserved": 0.08,
"credits_settled": 0,
"credits_refunded": 0.08,
"credits_charged": 0
},
"retryable": true,
"request_id": "202611260732156684925978268d9d6yOLdMCKV",
"error_code": "processing_failed",
"error_message": "The task failed during processing on our side. Retry; a failed task is refunded.",
"error": {
"code": "processing_failed",
"message": "The task failed during processing on our side. Retry; a failed task is refunded.",
"retryable": true
}
}
}
FieldTypeDescription
data.error_codestringOne of bad_request and content_policy_violation (change the request) or processing_unavailable, processing_timeout, processing_failed and result_transfer_failed (try again later). See Errors.
data.error_messagestringA sentence that names the problem and the fix.
data.retryablebooleanPresent only on a failed task: true when the same request can succeed if you send it again.
data.errorobjectPresent only on a failed task: code, message and retryable in one object, the same values as data.error_code, data.error_message and data.retryable.
data.usageobjectOnce the refund is recorded (normally at the moment the task fails): credits_charged and credits_settled are 0, and credits_refunded equals credits_reserved.

Complete example

Create a task, wait for it with the server’s polling hint, and print the result URLs. Set BEATAPI_API_KEY in your environment and install requests.

import os
import time
import uuid
import requests
API = "https://api.beatapi.io"
HEADERS = {"Authorization": f"Bearer {os.environ['BEATAPI_API_KEY']}"}
def create_task(body: dict) -> dict:
# One Idempotency-Key per logical request: a retry with the same key cannot create a second task.
headers = {**HEADERS, "Idempotency-Key": str(uuid.uuid4())}
for attempt in range(3):
response = requests.post(f"{API}/v1/images/tasks", headers=headers, json=body, timeout=60)
if response.status_code in (429, 503) and attempt < 2:
time.sleep(int(response.headers.get("Retry-After", 10)))
continue
break
try:
payload = response.json()
except ValueError: # an edge error page is not JSON
response.raise_for_status()
raise
if not response.ok:
error = payload["error"]
raise RuntimeError(f"{response.status_code} {error['code']}: {error['message']} (request_id={error.get('request_id')})")
return payload["data"]
def wait_for_task(task_id: str, timeout_seconds: int = 1800) -> dict:
deadline = time.monotonic() + timeout_seconds
while time.monotonic() < deadline:
response = requests.get(f"{API}/v1/tasks/{task_id}", headers=HEADERS, timeout=30)
if response.status_code == 429 or response.status_code >= 500:
time.sleep(int(response.headers.get("Retry-After", 10)))
continue
response.raise_for_status()
task = response.json()["data"]
if task["status"] in ("succeeded", "failed"):
return task
time.sleep(task.get("poll_after_seconds", 5))
raise TimeoutError(f"task {task_id} is still running; keep polling later")
task = create_task({
"model": "mj-v8.2",
"prompt": "A lighthouse on a basalt cliff at dusk, storm clouds breaking, cinematic light --s 250",
"aspect_ratio": "16:9"
})
print("created", task["id"])
task = wait_for_task(task["id"])
if task["status"] == "failed":
raise SystemExit(f"{task['error_code']}: {task['error_message']}")
for item in task["output"]["media"]:
print(item["url"])

Billing

  • Each call is one task with one price, set by speed and quality (table below). A generate, variation, reroll, retexture, edit, blend or draft costs one call at those settings, whatever the number of images it returns.
  • A follow-up is billed at its source task’s speed and quality. upscale and describe have one flat price at any speed.
  • The price is reserved when the task is created. A request refused with HTTP 400 costs nothing, and a failed task returns the reservation in full: credits_refunded then equals credits_reserved.
  • An edit with an image that has no transparency is still drawn and billed.

Current list prices, the same as on Pricing. An account with a negotiated discount pays less; data.usage on the task always shows the amount actually charged.

OptionList price (USD)
1 image · fast_hd$0.11
1 image · relax$0.055
1 image · relax_hd$0.055
1 image · upscale$0.02
1 image · describe$0.02
1 image · fast$0.08

Common errors

Error or symptomCauseFix
400 "index" is required for action upscaleAn upscale without the image to pick.Send index 1 to 4, the position in the source task’s output.media.
400 an upscaled image takes no follow-up; to vary it, send action variation with source_task_id of its four-image result and the same indexA follow-up sent on an upscale result.Send variation with the four-image task’s id and the same index.
400 that image of source_task_id was already upscaled in task_Up4Rk9Ns2Wq7Zx5Mc8Hv1Lb6Tj3Fd0Gy; use that task's resultThe same image of the same result was upscaled before.Read the result of the task the message names. The refused request costs nothing.
400 prompt is not used by action upscale; leave it outA field the action does not take.Send only the fields listed for that action.
400 remove --v from the prompt: the version is fixed at 8.2; leave it outA prompt copied from midjourney.com with --v, --fast, --hd or another parameter this API sets by field.Remove it and use the field (speed, quality, draft).
400 source_task_id is a draft, which takes no follow-up; send the prompt again without draft (add --seed N to keep a similar composition)A follow-up on a draft result.Send the prompt again without draft.
400 source_task_id was made at speed relax and a follow-up runs the same; leave speed outA follow-up with another speed or quality than its source task.Leave both fields out on follow-ups.
Four images that look unchanged after editThe image had no transparent areas, so nothing was cut out to redraw. It was still billed.Send a PNG with the parts to change made transparent.
Task failed after images were sentA link opened a web page, a login page or an expired URL, or did not download within a few seconds.Link directly to the image file, or upload it with POST /v1/files. Nothing is charged.
Task failed with content_policy_violationThe prompt or an image was refused by moderation.Change the prompt or the image. Retrying unchanged fails again; nothing is charged.
An image link no longer opensResults are deleted after 7 days.Download results soon after the task succeeds.

HTTP errors at a glance

Errors before a task exists arrive as a non-2xx response, and nothing is charged. Branch on error.code or error.retryable; message names the problem. The full list and retry policy are on Errors.

{
"error": {
"code": "bad_request",
"message": "\"prompt\" is required",
"retryable": false,
"request_id": "202611260732156684925978268d9d6yOLdMCKV"
}
}
HTTP statuserror.codeWhat to do
400bad_request, content_policy_violationFix the request; the message names the field. Do not retry unchanged.
401missing_api_key, invalid_api_key (older clients may see unauthorized)Send a valid key as Authorization: Bearer <key>.
402insufficient_creditsTop up, or raise the key’s quota, then send it again.
403forbiddenThe key or account may not use this model (for example, free credit only covers some models). Do not retry unchanged.
404not_foundOn GET /v1/tasks/{task_id}: the task does not exist for this key’s account. Check the ID.
409idempotency_conflictUse a new Idempotency-Key, or wait for the first request with this key to finish.
429rate_limit_exceededWait Retry-After seconds (also error.retry_after_seconds), then retry.
500internal_errorRetry with backoff; contact support with request_id if it continues.
503processing_unavailable, processing_timeout, processing_failed, result_transfer_failedNothing was charged. Retry with exponential backoff.

Authentication

AuthorizationBearer

Send your API key as Authorization: Bearer <BEATAPI_API_KEY>.

Headers

Idempotency-KeystringOptional<=255 characters

Send the body as JSON with Content-Type: application/json. Idempotency-Key is optional: send a unique value (at most 255 characters) per logical request and reuse it only to retry that exact body. Within 24 hours a retry with the same key and body returns the first response again with Idempotent-Replayed: true; the same key with a different body returns 409 idempotency_conflict. Responses other than 2xx are not stored, so a retry after a 400 or 402 runs again.

Request

This endpoint expects an object.
modelenumRequired

The model to run.

Value: mj-v8.2

If the value is wrong

  • Missing: "model" is required
  • Unknown model ID: "model" mj-v7 is not catalogued
  • A video model sent to this endpoint: "model" seedance-2.5 is served by POST /v1/videos/tasks, not this endpoint
Allowed values:
actionenumOptionalDefaults to generate

The operation to run. Each action takes only its own fields (see the input modes above); any other field is refused, so you never pay for a setting that had no effect.

Allowed values: generate, variation, upscale, reroll, retexture, edit, blend, describe

Default: generate

  • generate starts afresh. variation, upscale and reroll work on a four-image result; an upscaled image takes no follow-up.
  • retexture, edit, blend and describe start from your own images in images.
  • Input is not case-sensitive; the documentation writes the lower-case form.

If the value is wrong

  • A value not in the list: "action" must be one of: [generate variation upscale reroll retexture edit blend describe]
  • A field the action does not take: quality is not used by action retexture; leave it out
aspect_ratioenumOptional

Shape of the image as width:height, for generate and blend.

Allowed values: 1:1, 4:3, 3:4, 3:2, 2:3, 16:9, 9:16, 21:9, 9:21, 5:4, 4:5, 2:1, 1:2

  • A generate without it is drawn 1:1.
  • blend takes only 1:1 (its default), 3:2 or 2:3.
  • For any other shape write --ar W:H with whole numbers in prompt, for example --ar 7:4; it overrides this field.

If the value is wrong

  • A value not in the list: "aspect_ratio" must be one of: [1:1 4:3 3:4 3:2 2:3 16:9 9:16 21:9 9:21 5:4 4:5 2:1 1:2]
  • A blend with another shape: "aspect_ratio" for blend is one of: 1:1, 3:2, 2:3
draftbooleanOptional

For generate only. true returns 24 quick 512 px drafts at a generate’s price, to explore a prompt before rendering it in full.

  • Works at either speed; cannot be combined with quality hd.
  • A draft takes no follow-up and its images cannot be picked. To render a prompt in full, send it again without draft; write --seed N in the draft’s prompt for a similar, not identical, composition.

If the value is wrong

  • Not a boolean: "draft" must be a boolean
  • A follow-up on a draft: source_task_id is a draft, which takes no follow-up; send the prompt again without draft (add --seed N to keep a similar composition)
imageslist of stringsOptional

Your own images as public HTTPS links. For generate they are image prompts (1 to 5); retexture, edit and describe take exactly one; blend takes 2 to 5.

Items: 1–5

Each item is a public https:// URL. For a local file, upload it first with POST /v1/files and pass the returned data.url.

  • Links must be public and download within a few seconds. Have a local file? Upload it with POST /v1/files and send the returned link.
  • For edit, send a PNG and cut out (make transparent) the parts to change. An image without transparency, such as any JPEG, is still drawn and billed.
  • Follow-ups (variation, upscale, reroll) work on source_task_id and do not take images.
  • Positions in error messages are 0-based: images[0] is the first link.

If the value is wrong

  • Missing on retexture, edit, blend or describe: "images" is required for action describe
  • Fewer than blend needs: action blend needs at least 2 image(s) in "images"
  • More than one for describe, retexture or edit: action describe takes at most 1 image(s) in "images"
  • More than five: "images" accepts at most 5 items
  • Not an https:// link: "images[0]" must be a public HTTPS URL
indexintegerOptional1-4

Which image of a four-image result to work on, 1 to 4. It is 1-based and counts output.media of the source task.

Range: 1–4

  • Required for upscale and variation.
  • Not used by reroll or by actions without source_task_id.

If the value is wrong

  • Missing on upscale or variation: "index" is required for action upscale
  • Not a whole number from 1 to 4: "index" is outside its supported range
promptstringOptional1-2048 characters

What to draw, as on midjourney.com: the description first, then any Midjourney parameters such as --ar 3:2 --s 250. For retexture and edit it describes the new look.

Length: 1–2048 characters

  • Required for generate unless images holds two or more links, and for retexture and edit. Other actions do not take it.
  • For generate, the text without links and -- parameters is at most 1024 characters.
  • Parameters that the API sets by field, and those it does not support, are refused; see the parameter table further down.

If the value is wrong

  • Left out on a generate with fewer than two images: generate needs "prompt"; only two or more images may go without one
  • Left out on retexture or edit: "prompt" is required for action retexture
  • Sent with an action that does not take it: prompt is not used by action upscale; leave it out
  • Empty or longer than the limit: "prompt" has an unsupported length
  • The text without links and parameters is too long: the prompt's text (without links and --parameters) is at most 1024 characters
  • A version parameter: remove --v from the prompt: the version is fixed at 8.2; leave it out
  • A speed parameter: remove --fast from the prompt: set the speed field to fast instead
  • A decimal ratio: --ar takes whole numbers, like 139:100 instead of 1.39:1
  • --q outside 1 to 4: --q takes 1, 2, 3 or 4 (detail; 4 is the most detailed); for a bigger picture set quality hd
qualityenumOptionalDefaults to standard

hd draws about 2K instead of the standard size. It is set when you generate and cannot be added later.

Allowed values: standard, hd

Default: standard

  • At fast, hd costs more; at relax it costs the same.
  • upscale returns the image at the pixel size it was drawn at; it does not enlarge it. Ask for hd on the first call when you want a bigger picture.
  • A follow-up runs at its source task’s quality. Leave the field out on a follow-up, or send the same value.
  • retexture, edit, blend and describe do not take it.

If the value is wrong

  • A value not in the list: "quality" must be one of: [standard hd]
  • Together with draft: draft cannot be combined with quality hd
  • A follow-up asking for another quality than its source task: source_task_id was made at quality hd and a follow-up runs the same; leave quality out
Allowed values:
source_task_idstringOptionalformat: "task-id"

For a follow-up: the id of your own earlier Midjourney task that it works on. The task must have succeeded.

  • Read output.data.follow_ups of that task first: it lists the actions the result accepts. Any other follow-up is refused at no charge.
  • An upscaled image takes no follow-up. To vary it, send variation with the source_task_id of its four-image result and the same index.
  • Results of upscale, retexture, edit, describe and drafts take no follow-up.

If the value is wrong

  • Not a task id: "source_task_id" must be the id of one of your earlier tasks: "task_" followed by 32 letters or digits
  • Missing on a follow-up: "source_task_id" is required for action upscale: the id of your own Midjourney task it works on
  • The source task is still running or failed: source_task_id has not finished successfully; wait for it to succeed and try again
  • A task of another model: source_task_id was made by seedream-5.5, not Midjourney; name one of your Midjourney tasks
  • A follow-up on an upscaled image: an upscaled image takes no follow-up; to vary it, send action variation with source_task_id of its four-image result and the same index
  • A result of retexture, edit or describe: source_task_id is the result of retexture, which takes no follow-up
  • The same image of the same result upscaled again: that image of source_task_id was already upscaled in task_Up4Rk9Ns2Wq7Zx5Mc8Hv1Lb6Tj3Fd0Gy; use that task's result
  • An action that result does not list in follow_ups: this result does not support action upscale; generate the image again and continue from the new result
speedenumOptionalDefaults to fast

fast (the default) usually finishes a generate in 1 to 3 minutes; relax takes 2 to 5 minutes and costs less.

Allowed values: fast, relax

Default: fast

  • A follow-up runs at its source task’s speed and is billed at it. Leave the field out on a follow-up, or send the same value.
  • describe does not take it.

If the value is wrong

  • A value not in the list: "speed" must be one of: [fast relax]
  • A follow-up asking for another speed than its source task: source_task_id was made at speed relax and a follow-up runs the same; leave speed out
Allowed values:
callback_urlstringOptional<=2048 characters

An address to notify when this task succeeds or fails: a public HTTPS URL on the same scheme, host and port as one of your enabled webhook endpoints, which signs the delivery with its secret.

Length: ≤ 2048 characters

  • Register the endpoint first with POST /v1/webhooks. BeatAPI sends task.succeeded or task.failed with the same body, headers and retries as an account webhook; an account endpoint subscribed to the event receives it too, and an address identical to that endpoint’s is notified once.
  • The callback stops when the signing endpoint is deleted, disabled or moved to another host.

If the value is wrong

  • The value is not a string: "callback_url" must be a string.
  • The address is longer than 2048 characters: "callback_url" must be at most 2048 characters.
  • It is not a URL, or has no host or no http or https scheme: "callback_url" must be a valid https URL.
  • It uses http, or points to a private or otherwise non-public address: "callback_url" must be a public HTTPS URL.
  • No enabled webhook endpoint has the same scheme, host and port: "callback_url" must be on the host of one of your active webhook endpoints, whose secret signs it; register one with POST /v1/webhooks.

Response

The task object. output is null until the task succeeds. Fields marked “while running” disappear once the task finishes.

dataobject
Accepted or current BeatAPI task state.

Errors

400
Bad Request Error
401
Unauthorized Error
402
Payment Required Error
403
Forbidden Error
409
Conflict Error
429
Too Many Requests Error
500
Internal Server Error
503
Service Unavailable Error