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

# Quickstart

> Create an API key, send your first request, and fetch the final result

## 1. Get your API key

Before you call any API, you need a `API-KEY`.

### Create your account

> **Sign in to Midjourney API**
>
> open the [API Console](https://midjourney-api.com/dashboard). You can sign in with `Google`.

> **Default key and trial quota**
>
> After your account is created, Midjourney API generates a default `API-KEY`. This key is used across all Midjourney API endpoints.
>
> New accounts also receive `10 quota`  as trial balance.

## 2. Add the request header

All requests must include your API key in the header:

```bash theme={null}
API-KEY: YOUR_API_KEY
```

## 3. Send your first request

### Step 1: Submit a generation request

The example below creates a Midjourney image task.

```bash cURL theme={null}
curl --request POST \
  --url https://api.midjourney-api.com/midjourney/v1/submit-jobs \
  --header 'Content-Type: application/json' \
  --header 'API-KEY: YOUR_API_KEY' \
  --data '
{
  "prompt": "A cute kitten",
  "mode": "fast",
  "hookUrl": "<string>"
}
'
```

```python Python theme={null}
import requests

url = "https://api.midjourney-api.com/midjourney/v1/submit-jobs"

payload = {
    "prompt": "A cute kitten",
    "mode": "fast",
    "hookUrl": "<string>"
}
headers = {
    "API-KEY": "YOUR_API_KEY",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)
print(response.text)
```

```javascript JavaScript theme={null}
const options = {
  method: "POST",
  headers: {
    "API-KEY": "YOUR_API_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    prompt: "A cute kitten",
    mode: "fast",
    hookUrl: "<string>"
  })
};

fetch("https://api.midjourney-api.com/midjourney/v1/submit-jobs", options)
  .then((res) => res.json())
  .then((res) => console.log(res))
  .catch((err) => console.error(err));
```

```java Java theme={null}
HttpResponse<String> response = Unirest.post("https://api.midjourney-api.com/midjourney/v1/submit-jobs")
  .header("API-KEY", "YOUR_API_KEY")
  .header("Content-Type", "application/json")
  .body("{\n  \"prompt\": \"A cute kitten\",\n  \"mode\": \"fast\",\n  \"hookUrl\": \"<string>\"\n}")
  .asString();
```

#### Sample response

```json theme={null}
{
  "status": 0,
  "message": "success",
  "data": {
    "taskId": "TzmJP821WQM5jHOx7nR7r"
  }
}
```

### Step 2: Fetch the task result

Use the returned `jobId` to poll the result:

```bash cURL theme={null}
curl --request POST \
  --url https://api.midjourney-api.com/midjourney/v1/job-status \
  --header 'Content-Type: application/json' \
  --header 'API-KEY: YOUR_API_KEY' \
  --data '
{
    "taskIds":["VUtF55IGrp08Pi_GPf3hk","JRX-ATQfkrX04TDIKCip4"]
}
'
```

```python Python theme={null}
import requests

url = "https://api.midjourney-api.com/midjourney/v1/job-status"

payload = {
   "taskIds":["VUtF55IGrp08Pi_GPf3hk","JRX-ATQfkrX04TDIKCip4"]
}
headers = {
    "API-KEY": "YOUR_API_KEY",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)
print(response.text)
```

```javascript JavaScript theme={null}
const options = {
  method: "POST",
  headers: {
    "API-KEY": "YOUR_API_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
   "taskIds":["VUtF55IGrp08Pi_GPf3hk","JRX-ATQfkrX04TDIKCip4"]
  })
};

fetch("https://api.midjourney-api.com/midjourney/v1/job-status", options)
  .then((res) => res.json())
  .then((res) => console.log(res))
  .catch((err) => console.error(err));
```

```java Java theme={null}
HttpResponse<String> response = Unirest.post("https://api.midjourney-api.com/midjourney/v1/job-status")
  .header("API-KEY", "YOUR_API_KEY")
  .header("Content-Type", "application/json")
  .body("{\n  \"taskIds\": \"[\"VUtF55IGrp08Pi_GPf3hk\",\"JRX-ATQfkrX04TDIKCip4\"]\",}")
  .asString();
```

#### Sample response

```json theme={null}
{
  "data": [
    {
      "taskId": "rffghVAtBr-5lqjhuC8Nv",
      "status": 0
    },
    {
      "taskId": "TzmJP821WQM5jHOx7nR7r",
      "status": 2,
      "createdAt": 1766916846000,
      "failReason": "Invalid User ID or Personalize Code: ``123123``"
    },
    {
      "taskId": "JRTcg7frYrVn4PsnsboH6",
      "status": 1,
      "jobId": "089b3f2e-b120-4c30-8c1e-6bb02851f661",
      "images": [
        "https://cdn.midjourney.com/089b3f2e-b120-4c30-8c1e-6bb02851f661/0_0.png",
        "https://cdn.midjourney.com/089b3f2e-b120-4c30-8c1e-6bb02851f661/0_1.png",
        "https://cdn.midjourney.com/089b3f2e-b120-4c30-8c1e-6bb02851f661/0_2.png",
        "https://cdn.midjourney.com/089b3f2e-b120-4c30-8c1e-6bb02851f661/0_3.png"
      ],
      "prompt": "a dog play with a boy --niji 6 --ar 9:16",
      "mjPrompt": "a dog play with a boy --niji 6 --ar 9:16",
      "createdAt": 1766915367000,
      "meta": {
        "width": 816,
        "height": 1456
      }
    }
  ]
}
```

## Task statuses

| Status | Meaning |
| :- | :- |
| `0` | In progress |
| `1` | Completed successfully |
| `2` | Failed |

## Need help?

* For support, see [Contact](https://www.midjourney-api.com/contacts)


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