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

# Midjourney API overview

>  - Overview of Midjourney text-to-image (Imagine) / image-guided / follow-up actions / image-to-video endpoints
- Async task mode: receive task_id after submission, poll for the result
- New routes auto-inject model=midjourney and support native MJ args, structured body fields, and metadata 

<Note>
  **Base URL:** `https://gccai.heqingsong.uk`

  **Auth:** `Authorization: Bearer <token>`

  New `/v1/midjourney/...` routes automatically inject `model=midjourney`; you do not need to pass `model` in the request body.
</Note>

## Quick start

```bash theme={null}
# 1. Submit an Imagine job
curl -X POST https://gccai.heqingsong.uk/v1/midjourney/generations \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "a cute cat, watercolor style --ar 16:9"}'

# 2. Poll the unified task API until status=completed
curl https://gccai.heqingsong.uk/v1/tasks/task_01JWXXXX \
  -H "Authorization: Bearer <token>"

# 3. Upscale image 1
curl -X POST https://gccai.heqingsong.uk/v1/midjourney/generations/upscale \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"task_id": "task_01JWXXXX", "index": 1}'
```

## API overview

See each feature's sub-page for full fields, examples, and notes.

| Feature                        | Path                                                             | Doc                                |
| ------------------------------ | ---------------------------------------------------------------- | ---------------------------------- |
| Text-to-image (default entry)  | `POST /v1/midjourney/generations`                                | [Imagine](./imagine)               |
| Text-to-image (explicit entry) | `POST /v1/midjourney/generations/imagine`                        | [Imagine](./imagine)               |
| Multi-image blend              | `POST /v1/midjourney/generations/blend`                          | [Blend](./blend)                   |
| Image to text (describe)       | `POST /v1/midjourney/generations/describe`                       | [Describe](./describe)             |
| Image edit                     | `POST /v1/midjourney/generations/edits`                          | [Edits](./edits)                   |
| Upscale a tile                 | `POST /v1/midjourney/generations/upscale`                        | [Upscale](./upscale)               |
| Variation                      | `POST /v1/midjourney/generations/variation`                      | [Variation](./variation)           |
| High variation                 | `POST /v1/midjourney/generations/high-variation`                 | [High Variation](./high-variation) |
| Low variation                  | `POST /v1/midjourney/generations/low-variation`                  | [Low Variation](./low-variation)   |
| Reroll                         | `POST /v1/midjourney/generations/reroll`                         | [Reroll](./reroll)                 |
| Zoom out                       | `POST /v1/midjourney/generations/zoom`                           | [Zoom](./zoom)                     |
| Pan                            | `POST /v1/midjourney/generations/pan`                            | [Pan](./pan)                       |
| Inpaint                        | `POST /v1/midjourney/generations/inpaint`                        | [Inpaint](./inpaint)               |
| Modal parameters               | `POST /v1/midjourney/generations/modal`                          | [Modal](./modal)                   |
| Image-to-video                 | `POST /v1/midjourney/generations/video`                          | [Video](./video)                   |
| Remix (strong / subtle)        | `POST /v1/midjourney/generations/remix-strong` · `/remix-subtle` | [Remix](./remix)                   |
| Task query                     | `GET /v1/tasks/{task_id}` · `/v1/midjourney/{task_id}`           | [Get task](./query)                |

See also: [Best practices](./best-practices) (polling / retries / troubleshooting) · [End-to-end workflows](./workflow) (curl walkthroughs + client wrappers)

## End-to-end flow

```mermaid theme={null}
flowchart TB
  A["① POST /generations<br/>submit Imagine"] --> B["② GET /v1/tasks/{task_id}<br/>poll until completed"]
  B --> C["③ If buttons are needed<br/>GET /v1/midjourney/{task_id}"]
  C --> D1["/upscale"]
  C --> D2["/variation"]
  C --> D3["/reroll"]
  C --> D4["/zoom"]
  C --> D5["/inpaint<br/>(enters MODAL)"]
  D5 --> M["/modal<br/>submit mask + prompt"]
```

## Errors

### Error response format

```json theme={null}
{
  "error": {
    "type": "invalid_request_error",
    "message": "prompt is required"
  }
}
```

### Common errors

| HTTP | type                    | Meaning                                               |
| ---- | ----------------------- | ----------------------------------------------------- |
| 400  | `invalid_request_error` | Bad parameters (missing required, wrong format, etc.) |
| 401  | `authentication_error`  | Invalid API key                                       |
| 402  | `payment_required`      | Insufficient balance                                  |
| 404  | `not_found`             | Task not found                                        |
| 429  | `rate_limit_error`      | Rate limited                                          |
| 500  | `internal_error`        | Server error                                          |

### Task failures

Common `fail_reason` values:

* `Banned prompt detected` — banned prompt content
* `Task timeout` — task timeout (auto refund after 30+ minutes)
* `No available upstream` — service temporarily unavailable, retry later

## Billing

The unified model name for new MJ routes is `midjourney`. Billing keys are generated from action, version, and speed. The usual match order is:

```text theme={null}
midjourney@<action>-<version>-<speed>
-> midjourney@<action>-<version>
-> midjourney@<action>-<speed>
-> midjourney@<action>
-> midjourney
```

| Action         | Bill name                                     | Notes                                  |
| -------------- | --------------------------------------------- | -------------------------------------- |
| Imagine        | `midjourney@imagine[-version][-speed]`        | Text-to-image / image-guided           |
| Blend          | `midjourney@blend[-speed]`                    | Multi-image blend                      |
| Describe       | `midjourney@describe[-speed]`                 | Image to text                          |
| Edits          | `midjourney@edits[-speed]`                    | Image edit                             |
| Upscale        | `midjourney@upscale[-version][-speed]`        | Upscale                                |
| Variation      | `midjourney@variation[-version][-speed]`      | Variation                              |
| High Variation | `midjourney@high_variation[-version][-speed]` | Strong variation                       |
| Low Variation  | `midjourney@low_variation[-version][-speed]`  | Subtle variation                       |
| Reroll         | `midjourney@reroll[-version][-speed]`         | Regenerate                             |
| Zoom           | `midjourney@zoom[-version][-speed]`           | Zoom out / outpaint                    |
| Pan            | `midjourney@pan[-version][-speed]`            | Pan outpaint                           |
| Inpaint        | `midjourney@inpaint[-version][-speed]`        | Inpaint entry                          |
| Modal          | `midjourney@modal[-speed]`                    | Inpaint follow-up parameters           |
| Video          | `midjourney@video` / `midjourney@video-720p`  | Image-to-video, charged × `batch_size` |
| Remix Strong   | `midjourney@remix_strong[-speed]`             | Strong reshape (v8.1 / v8.2 only)      |
| Remix Subtle   | `midjourney@remix_subtle[-speed]`             | Subtle reshape (v8.1 / v8.2 only)      |

Notes:

* `speed=relax` or omitted `speed` does not add a speed suffix; `fast` / `turbo` add the corresponding suffix.
* Main versions normalize to `v8.2`, `v8.1`, `v7`, `v6.1`, `v5.2`, and `v5.1`.
* `niji=true + version=7/6` normalizes to `niji7` / `niji6`.

> See console pricing. Failed jobs are fully refunded.
