API Documentation

Integrating MidjAPI into your app is easy.

Please note:

  • All requests and code examples can easily be generated via our Postman Library (Or scroll down for our full documentation!)
  • If you're not familiar with how MidJourney works, please Read the MidJourney Quick Start Guide first. It's important to understand how it works.
  • After creating image(s) using /imagine or /action, data will return with "action_options" array that includes the actions you can perform on this Job ID in order to create continual images.

    The table below describes which actions are available based on the job_type (imagine/variations/upscale etc):
    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
  • `upscale` and `variations` require variation_num (1-4).
  • `/imagine` and `/action` will return job_id, starting with #1. This ID is unique to your account only.
  • Since generating an image with MidJourney can delay from time to time, we suggest using callback_url when using /imagine or /action. When the images are ready, we'll send the data to your Callback URL using the job_id so your platform can easily stay up-to-date with our data.

/imagineGenerate a new image
/statusGet job and image data
/actionImprove generated image
/listList your jobs
/creditsGet live credit balance

/imagine

Use the /imagine endpoint to submit an image to the generation queue on Midjourney.

Request Type: POST
Content Type: application/json

Parameters

Parameter Description Required
email 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.

Request Example

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}}"
}'
    

Response Example

{
 "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}}"
}
    

Callback Example

{
 "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 Codes

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

/status

Use the /status endpoint to check the status of a completed job on Midjourney.

Request Type: POST
Content Type: application/json

Parameters

Parameter Description Required
email 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.

Request Example

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}}"
}'
    

Response Example

{
 "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 Codes

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

/action

Use the /action endpoint to perform an action on a completed job on Midjourney, such as creating variations or upscaling the image.

Request Type: POST
Content Type: application/json

Parameters

Parameter Description Required
email 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.

Request Example

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}}"
}'
    

Response Example - Job Completed

{
 "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}}"
}
    

Response Example - Job Not Ready

{
    "error": "Job #{{NEW JOB ID}} is not completed yet.",
    "error_code": "job_uncompleted"
}
    

Callback Example

{
 "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 Codes

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

/list

Use the /list endpoint to retrieve a list of jobs for a user on Midjourney.

Request Type: POST
Content Type: application/json
Endpoint URL: https://api.midjapi.com/v1/list

Parameters

Parameter Description Required
email 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.

Request Example

curl -X POST \
  'https://api.midjapi.com/v1/list' \
  -H 'Content-Type: application/json' \
  -d '{
    "token": "{{YOUR TOKEN}}",
    "email": "{{YOUR EMAIL}}",
    "page": {{PAGE NUMBER}}
}'
    

Response Example

{
 "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 Codes

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

/credits

Use the /credits endpoint to get the current credit balance of a user on Midjourney.

Request Type: POST
Content Type: application/json

Parameters

Parameter Description Required
email The user's email address for authentication.
token The user's API token for authentication.

Request Example

curl -X POST \
  'https://api.midjapi.com/v1/credits' \
  -H 'Content-Type: application/json' \
  -d '{
    "token": "{{YOUR TOKEN}}",
    "email": "{{YOUR EMAIL}}"
}'
    

Response Example

{
 "credits": "{{USER CREDIT BALANCE}}"
}
    

Error Codes

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