> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rixapi.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Midjourney Quickstart

> Generate your first images, collect the result, then upscale, vary, or animate them

Each way to create a Midjourney task has its own endpoint: `/midjourney/imagine` generates, `/midjourney/blend` blends, `/midjourney/video` animates, and so on. Operations on existing images, such as upscale and variation, all go through `/midjourney/action`. You submit, get a task ID, then fetch the result. This page walks you through your first set of images.

## Generate your first images

Write the prompt the way you would in Midjourney. Parameters such as `--ar`, `--sref`, and `--niji` go straight into it.

```bash bash theme={null}
curl https://api.ephone.ai/midjourney/imagine \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "a red bicycle leaning on a brick wall, morning light --ar 3:2"
  }'
```

```python imagine.py theme={null}
import requests

resp = requests.post(
    "https://api.ephone.ai/midjourney/imagine",
    headers={"Authorization": f"Bearer {API_KEY}"},
    json={"prompt": "a red bicycle leaning on a brick wall, morning light --ar 3:2"},
)
task_id = resp.json()["task_id"]
```

```javascript imagine.js theme={null}
const resp = await fetch("https://api.ephone.ai/midjourney/imagine", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    prompt: "a red bicycle leaning on a brick wall, morning light --ar 3:2",
  }),
});
const { task_id } = await resp.json();
```

You get a task ID back:

```json theme={null}
{
  "task_id": "mj-0cd1cef934d741b4ab3643ed25515a90",
  "action": "imagine",
  "status": "submitted",
  "prompt": "a red bicycle leaning on a brick wall, morning light --ar 3:2 --v 8.2",
  "created_at": 1792154579
}
```

> [!NOTE]
>
> If the prompt doesn't name a version, `--v 8.2` (the current Midjourney default) is added. The returned `prompt` is exactly what was submitted.

## Collect the result

Generation is asynchronous. Fetch the task by its ID:

```bash theme={null}
curl https://api.ephone.ai/midjourney/task/mj-0cd1cef934d741b4ab3643ed25515a90 \
  -H "Authorization: Bearer $API_KEY"
```

`status` moves through `submitted` (queued), `in_progress` (generating), then `success` or `failure`. In fast mode a set of images usually takes about a minute. When it's done:

```json theme={null}
{
  "task_id": "mj-0cd1cef934d741b4ab3643ed25515a90",
  "action": "imagine",
  "status": "success",
  "prompt": "a red bicycle leaning on a brick wall, morning light --ar 3:2 --v 8.2",
  "images": [
    "https://.../1.png",
    "https://.../2.png",
    "https://.../3.png",
    "https://.../4.png"
  ],
  "seed": 3277589003,
  "actions": ["upscale", "variation", "remix", "zoom", "pan", "inpaint", "video", "reroll"],
  "created_at": 1792154579,
  "finished_at": 1792154629
}
```

* `images` holds four separate images, not a stitched grid. Download and use them directly.
* On failure `status` is `failure`, the reason is in `fail_reason`, and the charge is refunded.

If you'd rather not poll, pass `notify_hook` (your receiving URL) when you submit. When the task finishes we POST the same body the fetch endpoint returns.

## Keep going

`actions` lists the operations you can run next on this task. Call `/midjourney/action` with one of them as `action`, plus `task_id`; to work on one image, also pass `index` (which image, starting at 1):

```bash theme={null}
curl https://api.ephone.ai/midjourney/action \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "upscale",
    "task_id": "mj-0cd1cef934d741b4ab3643ed25515a90",
    "index": 2
  }'
```

You get a new task ID, fetched the same way. The new task has its own `actions`, so you can keep chaining: upscale image 2, zoom out on the upscaled image, then turn it into a video.

> [!TIP]
>
> No more assembling a `custom_id` from buttons. Any operation listed in `actions` can be run; anything else returns `unsupported_action`.

## Choose a speed

Pick a speed with the `speed` parameter. The default is `fast`:

| Value | Meaning |
| - | - |
| `relax` | Slow and queued, billed at 0.4x the fast price |
| `fast` | Fast, the default |
| `turbo` | Fastest, billed at 2x the fast price |

```json theme={null}
{ "prompt": "a red bicycle --ar 3:2", "speed": "relax" }
```

You can also write `--relax`, `--fast`, or `--turbo` in the prompt as you would in Midjourney. If both are present, the `speed` parameter wins. Video endpoints don't support `relax`.

## Choose a version

Add a version parameter at the end of the prompt; without one, V8.2 is used:

| Version | How to write it | Notes |
| - | - | - |
| V8.2 | Leave it out, or `--v 8.2` | Default version; supports drafts `--draft` and HD `--hd` |
| V7 | `--v 7` | The previous default |
| V8.1 | `--v 8.1` | Supports drafts `--draft` and HD `--hd` |
| V8 | `--v 8` | Results can only be varied, remixed, rerolled or animated |
| V6.1 / V6 | `--v 6.1` / `--v 6` | Older versions |
| Niji 7 / Niji 6 | `--niji 7` / `--niji 6` | Anime style; no drafts or HD |

```json theme={null}
{ "prompt": "a red fox in the snow, cinematic light --ar 3:2 --v 7" }
```

`edit` supports V8.1 and V8.2 only (V8.2 by default), and `retexture` supports V7 and V6 only. Follow-up operations such as upscale and variation keep the version of the original image.

## Two ways to call

The examples above call the endpoints directly. If you already use the [unified task API](https://docs.rixapi.com/docs/en/guides/task.md), the model name is `midjourney-` plus the action name (for example `midjourney-imagine`, `midjourney-upscale`), and the parameters go in `input` without `action`:

```bash theme={null}
curl https://api.ephone.ai/v1/task/submit \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "midjourney-imagine",
    "input": {
      "prompt": "a red bicycle leaning on a brick wall, morning light --ar 3:2"
    }
  }'
```

Task IDs work across both: images generated through the unified API can be upscaled with `/midjourney/action`, and the other way around. Billing is identical.

## Next

> [card] [Midjourney Capabilities and Parameters](https://docs.rixapi.com/docs/en/guides/midjourney-workflows.md)
>
> Every endpoint, prompt parameters, video, and billing


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.