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

# Imagine (text-to-image)

> POST /mj/submit/imagine — submit a Midjourney text-to-image task

Submit a Midjourney text-to-image task (equivalent to Discord's `/imagine`).

## Request

```bash theme={null}
curl https://openp.ai/mj/submit/imagine \
  -H "Authorization: Bearer $OPENPAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A futuristic cyberpunk city at night, neon lights, --ar 16:9 --v 6",
    "notifyHook": "https://your-server.com/mj-callback"
  }'
```

### Parameters

| Field         | Type   | Required | Description                                                               |
| ------------- | ------ | :------: | ------------------------------------------------------------------------- |
| `prompt`      | string |     ✅    | Generation prompt, may include parameters like `--ar`, `--v`, `--style`   |
| `base64Array` | array  |          | Array of reference-image base64 (the image prompt attached to `/imagine`) |
| `notifyHook`  | string |          | Callback URL; OpenPAI POSTs the task result when it completes             |
| `state`       | string |          | Custom pass-through field, returned verbatim in the callback              |
| `botType`     | string |          | `MID_JOURNEY` (default) or `NIJI_JOURNEY`                                 |

## Response

```json theme={null}
{
  "code": 1,
  "description": "Submitted",
  "result": "1737200000000000",
  "properties": {}
}
```

`result` is the task ID — use it later to query progress or submit U/V actions.

| code | Meaning                                           |
| ---- | ------------------------------------------------- |
| `1`  | Submitted successfully                            |
| `21` | An identical task already exists (will be reused) |
| `22` | The task entered the queue                        |
| `-1` | Submission failed, see `description`              |

## Query the task

See [Fetch](/en/api-reference/midjourney/fetch).

## Follow-up actions (U/V/Reroll)

See [Change](/en/api-reference/midjourney/change).

## Billing

A fixed charge per **number of tasks + action type**, tied to the upstream Midjourney subscription price.
Failed tasks (no callback or an upstream error) are not billed.
