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

# Midjourney API

> Access Midjourney through the unified asynchronous API backed by APIMart

<Note>
  Midjourney uses ToAPIs task IDs. Requests require `Authorization: Bearer YOUR_API_KEY`. If you are in mainland China, use `https://toapis.cn` as the Base URL instead.
</Note>

Supported actions:

`imagine`, `blend`, `describe`, `edits`, `upscale`, `variation`, `high-variation`, `low-variation`, `reroll`, `zoom`, `pan`, `inpaint`, `modal`, `video`, `remix-strong`, `remix-subtle`.

Every submission returns a task ID. Use the [query endpoint](./query) to retrieve results. You do not need to provide or retain the upstream APIMart task ID.

## Endpoints

| Operation | Method and path |
| - | - |
| Default generation | `POST /v1/midjourney/generations` |
| Specific action | `POST /v1/midjourney/generations/{action}` |
| Query a task | `GET /v1/midjourney/{task_id}` |

The default generation endpoint is equivalent to `imagine`.

## Common request fields

<ParamField body="model" type="string" required>
  Must be `midjourney`.
</ParamField>

<ParamField body="prompt" type="string">
  Text prompt. Required for `imagine` and `edits`; optional for `modal`, which inherits the parent prompt by default.
</ParamField>

<ParamField body="image_urls" type="string[]">
  Publicly accessible image URLs. Use the [image upload endpoint](../../uploads/images) first; do not submit base64 directly. Each image must be no larger than 12 MiB.
</ParamField>

<ParamField body="task_id" type="string">
  Parent task ID for image actions, video, and Remix. The task must belong to the user associated with the current API key.
</ParamField>

<ParamField body="speed" type="string" default="relax">
  `relax`, `fast`, or `turbo`.
</ParamField>

<ParamField body="version" type="string">
  Midjourney version, such as `v8.2`, `v8.1`, `v7`, or `v6.1`.
</ParamField>

## Submit a task

```bash cURL theme={null}
curl --request POST \
  --url https://toapis.com/v1/midjourney/generations/imagine \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "midjourney",
    "prompt": "a cinematic lighthouse above a stormy sea",
    "speed": "fast",
    "version": "v8.2"
  }'
```

```json Response theme={null}
{
  "id": "tsk_img_xxx",
  "object": "generation.task",
  "model": "midjourney",
  "status": "queued",
  "progress": 0,
  "created_at": 1710000000
}
```

<Warning>
  APIMart does not provide a cancellation endpoint. ToAPIs does not expose a fabricated cancellation endpoint. Failed tasks follow the standard refund and webhook rules.
</Warning>


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