Integrating MidjAPI into your app is easy.
Please note:
Job Type | Version | Possible Actions |
---|---|---|
imagineCreate an image | Any | ⋅ variations ⋅ upscale |
upscaleCreate an upscaled version of an image | 5.2 | ⋅ vary_strong ⋅ vary_subtle ⋅ zoomout_2 ⋅ zoomout_1_5 |
5.1, 5.0, niji_5 | ⋅ variations ⋅ zoomout_2 ⋅ zoomout_1_5 |
|
variationsCreate 4 new images | Any | ⋅ variations ⋅ upscale |
vary_subtleCreate 4 new similar variations | Any | ⋅ variations ⋅ upscale |
vary_strongCreate 4 new different variations | Any | ⋅ variations ⋅ upscale |
zoomout_2Zoom Out x2 an image | Any | ⋅ variations ⋅ upscale |
zoomout_1_5Zoom Out x1.5 an image | Any | ⋅ variations ⋅ upscale |
Use the /imagine
endpoint to submit an image to the generation queue on Midjourney.
POST
application/json
https://api.midjapi.com/v1/imagine
Parameter | Description | Required |
---|---|---|
The user's email address for authentication. | ||
token | The user's API token for authentication. | |
prompt | The text prompt for generating the image. | |
ar | Aspect ratio for the images. Format value: `1:1` (default), `16:9` etc. |
|
v | The version of the image generation algorithm. Possible values: 5.2 (default), 5.1, 5.0, and niji_5. |
|
callback_url | The URL for the API callback upon image generation completion. |
curl -X POST \ 'https://api.midjapi.com/v1/imagine' \ -H 'Content-Type: application/json' \ -d '{ "token": "{{YOUR TOKEN}}", "email": "{{YOUR EMAIL}}", "prompt": "{{IMAGE PROMPT}}", "ar": "{{IMAGE ASPECT RATIO}}", "v": "{{MJ VERSION}}", "callback_url": "{{IMAGE DATA CALLBACK URL}}" }'
{ "success": "A new job has been created", "queue_items": [ { "job_id": {{NEW JOB ID}}, "prompt": "{{FULL PROMPT}}", "job_type": "imagine" } ], "credits_used": {{CREDIT COST FOR ACTION}}, "new_credit_balance": "{{YOUR NEW CREDIT BALANCE}}" }
{ "job_id": "{{NEW JOB ID}}", "parent_job_id": "0", "job_type": "imagine", "mj_version": "{{MJ VERSION}}", "prompt": "{{FULL PROMPT}}", "images": [ { "variation_num": 1, "image_url": "{{IMAGE 1 URL}}" }, { "variation_num": 2, "image_url": "{{IMAGE 2 URL}}" }, { "variation_num": 3, "image_url": "{{IMAGE 3 URL}}" }, { "variation_num": 4, "image_url": "{{IMAGE 4 URL}}" } ], "is_public": 0, "date_created": "{{DATE TIME CREATED, Y-m-d H:i:s FORMAT}}", "date_completed": "{{DATE TIME FINISHED, Y-m-d H:i:s FORMAT}}", "credit_balance": "{{YOUR NEW CREDIT BALANCE}}", "action_options": "{{ARRAY WITH POSSIBLE ACTIONS}}" }
Error | Error Code | Description |
---|---|---|
Invalid request method (use POST) | invalid_request_method | The request method is not POST |
Invalid callback URL | invalid_callback_url | The callback URL provided is not valid |
Authentication failed | authentication_failed | The user authentication failed |
Not enough credits | not_enough_credits | The user does not have enough credits |
Please enter prompt | prompt_is_empty | The prompt field is empty |
Invalid Aspect Ratio. | invalid_aspect_ratio | The provided aspect ratio is not valid or not formatted correctly. |
Your prompt has been forbidden by MidJoruney's moderation bot | prompt_forbidden | The prompt has been forbidden by the moderation bot |
You already have an imagine job with the exact same description running | exact_job_running | An imagine job with the exact same description is already running |
Use the /status
endpoint to check the status of a completed job on Midjourney.
POST
application/json
https://api.midjapi.com/v1/status
Parameter | Description | Required |
---|---|---|
The user's email address for authentication. | ||
token | The user's API token for authentication. | |
job_id | The ID of the job to check the status for. |
curl -X POST \ 'https://api.midjapi.com/v1/status' \ -H 'Content-Type: application/json' \ -d '{ "token": "{{YOUR TOKEN}}", "email": "{{YOUR EMAIL}}", "job_id": "{{JOB ID}}" }'
{ "success": "Job #{{JOB ID}} is completed.", "data": { "job_id": "{{JOB ID}}", "parent_job_id": "0", "job_type": "imagine", "mj_version": "{{MJ VERSION}}", "prompt": "{{FULL PROMPT}}", "images": [ { "variation_num": 1, "image_url": "{{IMAGE 1 URL}}" }, { "variation_num": 2, "image_url": "{{IMAGE 2 URL}}" }, { "variation_num": 3, "image_url": "{{IMAGE 3 URL}}" }, { "variation_num": 4, "image_url": "{{IMAGE 4 URL}}" } ], "is_public": 0, "date_created": "{{DATE TIME CREATED, Y-m-d H:i:s FORMAT}}", "date_completed": "{{DATE TIME FINISHED, Y-m-d H:i:s FORMAT}}", "callback_url": "{{IMAGE DATA CALLBACK URL}}", "action_options": "{{ARRAY WITH POSSIBLE ACTIONS}}" } }
Error | Error Code | Description |
---|---|---|
Invalid request method (use POST) | invalid_request_method | The request method is not POST |
Authentication failed | authentication_failed | The user authentication failed |
Job #job_id not found | job_not_found | The job with the provided ID was not found |
Job #job_id is not completed yet | job_uncompleted | The job with the provided ID is not yet completed |
Image for job #job_id not found | image_not_found | The image for the job with the provided ID was not found |
Use the /action
endpoint to perform an action on a completed job on Midjourney, such as creating variations or upscaling the image.
POST
application/json
https://api.midjapi.com/v1/action
Parameter | Description | Required |
---|---|---|
The user's email address for authentication. | ||
token | The user's API token for authentication. | |
job_id | The ID of the job to perform the action on. | |
action | The action to perform on the job. Possible values depend on the job type. | |
variation_num | The variation number to perform the action on. Only applicable for "variations" and "upscale" actions. | |
callback_url | The URL for the API callback upon action completion. |
curl -X POST \ 'https://api.midjapi.com/v1/action' \ -H 'Content-Type: application/json' \ -d '{ "token": "{{YOUR TOKEN}}", "email": "{{YOUR EMAIL}}", "job_id": "{{JOB ID}}", "action": "{{ACTION}}", "variation_num": "{{VARIATION NUMBER}}", "callback_url": "{{ACTION DATA CALLBACK URL}}" }'
{ "success": "{{ACTION DESCRIPTION}}", "queue_items": [ { "job_id": {{NEW JOB ID}}, "prompt": "{{FULL PROMPT}}", "job_type": "{{JOB TYPE}}" } ], "credits_used": {{CREDIT COST FOR ACTION}}, "new_credit_balance": "{{YOUR NEW CREDIT BALANCE}}", "action_options": "{{ARRAY WITH POSSIBLE ACTIONS}}" }
{
"error": "Job #{{NEW JOB ID}} is not completed yet.",
"error_code": "job_uncompleted"
}
{ "job_id": "{{NEW JOB ID}}", "parent_job_id": "{{PARENT JOB ID}}", "job_type": "{{JOB TYPE}}", "mj_version": "{{MJ VERSION}}", "prompt": "{{FULL PROMPT}}", "images": [ { "variation_num": {{VARIATION ID}}, "image_url": "{{IMAGE URL}}" } ], "is_public": 0, "date_created": "{{DATE TIME CREATED, Y-m-d H:i:s FORMAT}}", "date_completed": "{{DATE TIME FINISHED, Y-m-d H:i:s FORMAT}}", "credit_balance": "{{YOUR NEW CREDIT BALANCE}}", "action_options": "{{ARRAY WITH POSSIBLE ACTIONS}}" }
Error | Error Code | Description |
---|---|---|
Invalid request method (use POST) | invalid_request_method | The request method is not POST |
Invalid callback URL | invalid_callback_url | The callback URL provided is not valid |
Authentication failed | authentication_failed | The user authentication failed |
Job #job_id not found | job_not_found | The job with the provided ID was not found |
Job #job_id is not completed yet | job_uncompleted | The job with the provided ID is not yet completed |
Invalid action (action) for the specified job type (job_type) | invalid_action | The action provided is not valid for the specified job type |
Variation_num must be between 1 and 4 for variations and upscale actions | invalid_variation_num | The variation number provided is not between 1 and 4 for variations and upscale actions |
Not enough credits | not_enough_credits | The user does not have enough credits |
Use the /list
endpoint to retrieve a list of jobs for a user on Midjourney.
POST
application/json
https://api.midjapi.com/v1/list
Parameter | Description | Required |
---|---|---|
The user's email address for authentication. | ||
token | The user's API token for authentication. | |
page | The page number of the job list to retrieve. Default is 1. |
curl -X POST \ 'https://api.midjapi.com/v1/list' \ -H 'Content-Type: application/json' \ -d '{ "token": "{{YOUR TOKEN}}", "email": "{{YOUR EMAIL}}", "page": {{PAGE NUMBER}} }'
{ "jobs": [ { "job_id": "{{JOB ID}}", "prompt": "{{FULL PROMPT}}", "job_type": "{{JOB TYPE}}", "status": "{{JOB STATUS}}", "date_created": "{{DATE TIME CREATED, Y-m-d H:i:s FORMAT}}", "date_completed": "{{DATE TIME FINISHED, Y-m-d H:i:s FORMAT}}" }, ... ], "current_page": {{CURRENT PAGE NUMBER}}, "total_pages": {{TOTAL NUMBER OF PAGES}} }
Error | Error Code | Description |
---|---|---|
Invalid request method (use POST) | invalid_request_method | The request method is not POST |
Authentication failed | authentication_failed | The user authentication failed |
Use the /credits
endpoint to get the current credit balance of a user on Midjourney.
POST
application/json
https://api.midjapi.com/v1/credits
Parameter | Description | Required |
---|---|---|
The user's email address for authentication. | ||
token | The user's API token for authentication. |
curl -X POST \ 'https://api.midjapi.com/v1/credits' \ -H 'Content-Type: application/json' \ -d '{ "token": "{{YOUR TOKEN}}", "email": "{{YOUR EMAIL}}" }'
{
"credits": "{{USER CREDIT BALANCE}}"
}
Error | Error Code | Description |
---|---|---|
Invalid request method (use POST) | invalid_request_method | The request method is not POST |
Authentication failed | authentication_failed | The user authentication failed |