Midjourney API V2
Mode
Our Midjourney API V2 provides relax, fast, and turbo modes of image generation, corresponding to their Midjourney equivalents.
Mode Selection
Please use the process_mode parameter in the API body to select modes (please refrain from using the in-prompt-mode to select modes).
Below are rules about mode selection:
- If the process mode is not specified, system will default to the in-prompt-mode. If the in-prompt-mode is also not specified, then the system default is relax mode. For example:
- If process mode = "" & in-prompt-mode = relax | will use relax
- If process mode = "" & in-prompt-mode = fast | will use fast
- If process mode = "" & in-prompt-mode = unspecified | will use relax
- Process mode overrides in-prompt-mode; for example:
- If process mode = fast & in-prompt-mode = relax | will use fast
- If process mode = relax & in-prompt-mode = fast | will use relax
- For BYOA users, rules will apply depending on the available resource of your Midjourney account(s). For example:
- Fast or turbo jobs will be routed to any accounts with available fast hours. If none is available, the job will be processed as a relax job on any accounts with relax GPU time.
- Relax jobs will be routed to any accounts that is not on the Basic Plan (the $10 plan) because this plan has no relax GPU time. If none is available, then an error will be returned.
- If your only Midjourney account's account setting is relax, then all the jobs processed by this account will be relax mode regardless mode selection from GoAPI. Also, when you set your Midjourney account to relax mode, we will not use it for any fast job, and this might result in wasted fast hours.
- If your Midjourney account's setting is fast, then all jobs will be processed as per mode selection from GoAPI. When your Midjourney account runs out of fast hours, we will automatically change that account's setting to relax.
Note:
- Endpoints such as
upscale
,variation
,outpaint
, andpan
don’t support process mode. Instead, they inherit the process mode from the parent task automatically.
Endpoints
Below is a typical workflow diagram with available Midjourney API endpoints from GoAPI:
Imagine
Writing Midjourney prompt just like you would like write prompt in the Discord community with /imagine command.
Example Request
import requests X-API-KEY = "YOUR_API_KEY" endpoint = "https://api.midjourneyapi.xyz/mj/v2/imagine" headers = { "X-API-KEY": X-API-KEY } data = { "prompt": "a cute cat", "aspect_ratio": "4:3", "process_mode": "fast", "webhook_endpoint": "", "webhook_secret": "" } response = requests.post(endpoint, headers=headers, json=data) print(response.status_code) print(response.json())
Example Response
{
"task_id": "807400b9-9d79-465b-8ecc-eecb7419dbbc",
"status": "success",
"message": ""
}
Reroll
Example Request
import requests X-API-KEY = "YOUR_API_KEY" endpoint = "https://api.midjourneyapi.xyz/mj/v2/reroll" headers = { "X-API-KEY": X-API-KEY } data = { "origin_task_id": "cbf31ba7-c83b-4cb4-a875-ff60e499e0bc", "prompt": "a cute cartoon blue cat, weird", "aspect_ratio": "4:3" } response = requests.post(endpoint, headers=headers, json=data) print(response.status_code) print(response.json())
Example Response
{
'task_id': '9cd1c5e3-52a8-4b3f-8dbc-4a13a772fcbe',
'status': 'success',
'message': ''
}
Upscale
- The 'process_mode' parameter is not supported for this endpoint, it is automatically inherited from the parent task (origin_task_id).
- If you want to do an upscale 4x for example, you'd have to use this upscale endpoint to first upscale one of the four images returned from the imagine endpoint; and call this upscale endpoint again with index '4x' and use the taskID of the previous upscale task for the 'origin_task_id' parameter.
Example Request
import requests X-API-KEY = "YOUR_API_KEY" endpoint = "https://api.midjourneyapi.xyz/mj/v2/upscale" headers = { "X-API-KEY": X-API-KEY } data = { "origin_task_id": "e5caaac5-4a6d-4078-b2d3-b973d907b611", "index": "1", "webhook_endpoint": "", "webhook_secret": "" } response = requests.post(endpoint, headers=headers, json=data) print(response.status_code) print(response.json())
Example Response
{
"task_id": "e5caaac5-4a6d-4078-b2d3-b973d907b611",
"status": "success",
"message": ""
}
Variation
- The 'process_mode' parameter is not supported for this endpoint, it is automatically inherited from the parent task (origin_task_id).
Example Request
import requests X-API-KEY = "YOUR_API_KEY" endpoint = "https://api.midjourneyapi.xyz/mj/v2/variation" headers = { "X-API-KEY": X-API-KEY } data = { "origin_task_id": "45ffd445-28cf-45fc-9ac5-7ee5d426c901", "index": "1", "prompt": "a cute cat with a hat", "aspect_ratio": "3:4" "webhook_endpoint": "", "webhook_secret": "" } response = requests.post(endpoint, headers=headers, json=data) print(response.status_code) print(response.json())
Example Response
{
"task_id": "e5caaac5-4a6d-4078-b2d3-b973d907b611",
"status": "success",
"message": ""
}
Inpaint
Midjourney Inpainting UI is a simple tool to replicate Midjourney's inpainting model interface. You can generate mask base64 code using this open-source tool.
Example Request
import requests import json url = "https://api.midjourneyapi.xyz/mj/v2/inpaint" payload = json.dumps({ "origin_task_id": "1d536e18-c8a8-4ac5-9c4b-ae5895cc1f29", "prompt": "mirror", "skip_prompt_check": False, "mask": "UklGRuoVAABXRUJQVlA4WAoAAAAgAAAAzwQAnwMASUNDUMgBAAAAAAHIAAAAAAQwAABtbnRyUkdCIFhZWiAH4AABAAEAAAAAAABhY3NwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA9tYAAQAAAADTLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlkZXNjAAAA8AAAACRyWFlaAAABFAAAABRnWFlaAAABKAAAABRiWFlaAAABPAAAABR3dHB0AAABUAAAABRyVFJDAAABZAAAAChnVFJDAAABZAAAAChiVFJDAAABZAAAAChjcHJ0AAABjAAAADxtbHVjAAAAAAAAAAEAAAAMZW5VUwAAAAgAAAAcAHMAUgBHAEJYWVogAAAAAAAAb6IAADj1AAADkFhZWiAAAAAAAABimQAAt4UAABjaWFlaIAAAAAAAACSgAAAPhAAAts9YWVogAAAAAAAA9tYAAQAAAADTLXBhcmEAAAAAAAQAAAACZmYAAPKnAAANWQAAE9AAAApbAAAAAAAAAABtbHVjAAAAAAAAAAEAAAAMZW5VUwAAACAAAAAcAEcAbwBvAGcAbABlACAASQBuAGMALgAgADIAMAAxADZWUDgg/BMAAHAwAZ0BKtAEoAM+bTabSaQjIqEg0QgIgA2JaW78fJn+vQdnXX+lf9x/p3iP/F/6Z/Iv5//pP69+/HzP1PVBT4X9R/0/9s/tfoB3k8AL8a/lH+2/Tj9aeGD1L9APUC7g/7D+q+KN/Vfxr1V+s3+O9wD9O/8zxg1AD+K/1j/zf3L1nf+T/Uf5z0xfTP/m/yP+Q+Rv+W/3X/tfsP3B/23///u0frABp8bUOcZQD3U30bUOcZQD3U30bUOcZQD3U30bUOcZQD3U30bUOcZQD3U30bUO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FzbZAAAAAAAAAAAAAAAAAAAAAAAAAA=" }) headers = { 'X-API-Key': 'YOUR_API_KEY', 'Content-Type': 'application/json' } response = requests.request("POST", url, headers=headers, data=payload) print(response.text)
Example Response
{
"task_id": "807400b9-9d79-465b-8ecc-eecb7419dbbc",
"status": "success",
"message": ""
}
Outpaint
The 'process_mode' parameter is not supported for this endpoint, it is automatically inherited from the parent task.
Example Request
import requests X-API-KEY = "YOUR_API_KEY" endpoint = "https://api.midjourneyapi.xyz/mj/v2/outpaint" headers = { "X-API-KEY": X-API-KEY } data = { "origin_task_id": "45ffd445-28cf-45fc-9ac5-7ee5d426c901", "zoom_ratio": "2", "aspect_ratio": "4:3", "prompt": "a cute cat with a hat", "webhook_endpoint": "", "webhook_secret": "" } response = requests.post(endpoint, headers=headers, json=data) print(response.status_code) print(response.json())
Example Response
{
"task_id": "e5caaac5-4a6d-4078-b2d3-b973d907b611",
"status": "success",
"message": ""
}
Pan
The 'process_mode' parameter is not supported for this endpoint, it is automatically inherited from the parent task.
Example Request
import requests X-API-KEY = "YOUR_API_KEY" endpoint = "https://api.midjourneyapi.xyz/mj/v2/pan" headers = { "X-API-KEY": X-API-KEY } data = { "origin_task_id": "45ffd445-28cf-45fc-9ac5-7ee5d426c901", "direction": "left", "prompt": "a cute cat with a hat", "webhook_endpoint": "", "webhook_secret": "" } response = requests.post(endpoint, headers=headers, json=data) print(response.status_code) print(response.json())
Example Response
{
"task_id": "43507b86-1495-44f5-ac89-40d15dccc729",
"status": "success",
"message": ""
}
Describe
- Note: Discord CDN links will not work with this endpoint.
Example Request
import requests X-API-KEY = "YOUR_API_KEY" endpoint = "https://api.midjourneyapi.xyz/mj/v2/describe" headers = { "X-API-KEY": X-API-KEY } data = { "image_url": "https://sample.png", "process_mode": "fast", "webhook_endpoint": "", "webhook_secret": "" } response = requests.post(endpoint, headers=headers, json=data) print(response.status_code) print(response.json())
** Example Response
{
"task_id": "8a8dff39-b516-4484-8ef4-830e068f2763",
"status": "success",
"message": ""
}
Blend
- Note: Discord CDN links will not work with this endpoint.
Example Request
import requests X-API-KEY = "YOUR_API_KEY" endpoint = "https://api.midjourneyapi.xyz/mj/v2/blend" headers = { "X-API-KEY": X-API-KEY } data = { "image_urls": [ "https://sample1.png", "https://sample2.png" ], "process_mode": "fast", "webhook_endpoint": "", "webhook_secret": "" } response = requests.post(endpoint, headers=headers, json=data) print(response.status_code) print(response.json())
Example Response
{
"task_id": "5a5a81b1-406e-415e-9d62-a00ac5ec149b",
"status": "success",
"message": "request Content-Type isn't multipart/form-data"
}
Seed
Make a request to /imagine
, then make a seed request with task_id
to get a new task_id
, then fetch the result; you will receive a seed value in task_result
.
Example Request
import requests endpoint = "https://api.midjourneyapi.xyz/mj/v2/seed" data = { "task_id": "c0295660-4710-4b09-8fc4-73ed09b114ec" } response = requests.post(endpoint, json=data) print(response.status_code) print(response.json())
Example Response
{
"task_id": "c319e01f-1a06-4fba-bcfa-b92890805151",
"status": "success",
"message": ""
}
CreateTaskResponse
Unified response format for all the above create task requests.
Parameter | Description |
---|---|
task_id | Task id |
status | Task creation result: - success: task creation was successful. - failed: task creation was unsuccessful. |
message | Error message, possible causes for task creation failure: - Body parsing failed. - Original task does not exist. - Task with same index already created. - Insufficient credit balance. |
Example Response Format
// sample create task success { "task_id": "e5caaac5-4a6d-4078-b2d3-b973d907b611", "status": "success", "message": "" }
Fetch
Example Request
import requests endpoint = "https://api.midjourneyapi.xyz/mj/v2/fetch" data = { "task_id": "c0295660-4710-4b09-8fc4-73ed09b114ec" } response = requests.post(endpoint, json=data) print(response.status_code) print(response.json())
General response
Parameter | Description |
---|---|
task_id | Task id |
task_type | task type |
process_time | task processing time(/second) - total elapsed time is displayed when the task is in the finished/failed state. - the currently calculated elapsed time is displayed when the task is in other states. |
status | Current status of the task, valid values: - pending: The task is waiting to be executed in the queue. - staged: The task is cached, not in the queue yet. - processing: The task is being executed. - finished: The task has been completed. - failed: The task execution failed. - retry: The task is waiting in the queue to be retried. |
task_result | Showing task result, please check Midjourney Task Result for more information. |
meta | Task metadata, which does not change after the task is created. |
Meta
Parameter | Description |
---|---|
created_at | The time the task was created, represented as a timestamp in seconds |
started_at | The time the task was started, represented as a timestamp in seconds |
created_at | Task creation time |
started_at | The time when the task started execution |
process_mode | The mode of the bot processing this task |
task_request | User's original request information - please ignore |
task_param | Please ignore all parameters and values inside task_param |
Task_result
Showing task result, please check Midjourney Task Result for more information.
Example Response
{
"task_id": "fa53c448-0092-49e8-8538-c9353945e714",
"process_time": 48.2175553,
"status": "finished",
"task_result": {
"discord_url": "https://cdn.discordapp.com/example",
"image_url": "https://img.midjourneyapi.xyz/example",
"image_id": "a26849cc-76d6-4642-9a77-873ea014d1b0",
"result_message_id": "1141319184609976440",
"credit": 7,
"message": "",
"error_messages": [],
"service_unavailable": false,
"need_retry": false,
"warn_notify": false
},
"meta": {
"account_id": "",
"task_type": "imagine",
"origin_task_id": "",
"multi_bots": false,
"created_at": 1692182109,
"started_at": 1692182150,
"process_mode": "fast",
"frozen_credit": 7,
"task_request": {
"prompt": "a cute cat",
"process_mode": "fast",
},
"task_input": {
"prompt": "a cute cat",
"index": "",
"zoom_ratio": "2",
"aspect_ratio": "1:1",
"direction": ""
}
}
}
Multi Fetch
Example Request
import requests endpoint = "https://api.goapi.xyz/mj/v2/multi_fetch" data = { "task_ids": ["c0295660-4710-4b09-8fc4-73ed09b114ec", "0cbaf671-d3bf-482c-ad25-db147180a251"] } response = requests.post(endpoint, json=data) print(response.status_code) print(response.json())
Example Response
{
"code": 200,
"data": {
"87d78899-85d9-4be9-a714-8b7379f7ce44": {
"task_id": "87d78899-85d9-4be9-a714-8b7379f7ce44",
"status": "processing",
"process_time": 0,
"retry_count": 0,
"meta": {
"account_id": "333",
"task_type": "imagine",
"origin_task_id": "",
"bot_hash": "",
"bot_id": 435,
"process_mode": "relax",
"quota_frozen": 9,
"frozen_credit": 0,
"created_at": 1702364556,
"started_at": 1702364557,
"ended_at": 0,
"task_request": {
"aspect_ratio": "4:3",
"auto_upload": false,
"process_mode": "relax",
"prompt": "a cat",
"skip_prompt_check": false,
"webhook_endpoint": "https://webhook.site/99f42b2b-be05-499b-8887-dd30764ab15b",
"webhook_secret": "hello"
},
"task_param": {
"prompt": "a cat --relax",
"index": "",
"zoom_ratio": "2",
"aspect_ratio": "4:3",
"direction": ""
}
},
"task_result": {
"discord_image_url": "",
"image_url": "",
"permanent_url": "",
"image_id": "",
"seed": "",
"result_message_id": "",
"quota_used": 0,
"credit": 0,
"message": "",
"error_messages": [],
"need_retry": true,
"actions": [
"reroll",
"upscale1",
"upscale2",
"upscale3",
"upscale4",
"variation1",
"variation2",
"variation3",
"variation4"
]
}
},
"87d78899-85d9-4be9-a714-8b7379f7ce45": null
},
"message": "success"
}
Cancel
Example Request
import requests import json url = "https://api.midjourneyapi.xyz/mj/v2/cancel" payload = json.dumps({ "task_ids": [ "" ] }) headers = { 'X-API-Key': 'your_api_key', 'Content-Type': 'application/json' } response = requests.request("POST", url, headers=headers, data=payload) print(response.text)