Welcome to Midjourney API

The Midjourney API enables you to generate high-quality AI images using the power of Midjourney’s advanced AI models. Whether you’re building an app, automating workflows, or creating content, our API provides simple and reliable access to AI image generation.

Authentication

All API requests require authentication using a Bearer token. Get your API key from the API Key Management Page.
Keep your API key secure and never share it publicly. If compromised, reset it immediately.

API Base URL

https://api.kie.ai

Authentication Header

Authorization: Bearer YOUR_API_KEY

Quick Start Guide

Step 1: Generate Your First Image

Start with a simple text-to-image generation request:
curl -X POST "https://api.kie.ai/api/v1/mj/generate" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "taskType": "mj_txt2img",
    "prompt": "A majestic mountain landscape at sunset with snow-capped peaks",
    "speed": "relaxed",
    "aspectRatio": "16:9",
    "version": "7"
  }'

Step 2: Check Task Status

Use the returned task ID to check the generation status:
curl -X GET "https://api.kie.ai/api/v1/mj/record-info?taskId=YOUR_TASK_ID" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response Format

Successful Response:
{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "mj_task_abcdef123456"
  }
}
Task Status Response:
{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "mj_task_abcdef123456",
    "successFlag": 1,
    "resultInfoJson": {
      "resultUrls": [
        {"resultUrl": "https://example.com/image1.jpg"},
        {"resultUrl": "https://example.com/image2.jpg"},
        {"resultUrl": "https://example.com/image3.jpg"},
        {"resultUrl": "https://example.com/image4.jpg"}
      ]
    }
  }
}

Generation Types

Generate images from text descriptions:
{
  "taskType": "mj_txt2img",
  "prompt": "A futuristic cityscape with flying cars and neon lights",
  "aspectRatio": "16:9",
  "version": "7"
}

Generation Speeds

Choose the right speed for your needs:

Relaxed

Free tier optionSlower generation but cost-effective for non-urgent tasks

Fast

Balanced optionStandard generation speed for most use cases

Turbo

Premium speedFastest generation for time-critical applications

Key Parameters

prompt
string
required
Text description of the desired image. Be specific and descriptive for best results.Tips for better prompts:
  • Include style descriptors (e.g., “photorealistic”, “watercolor”, “digital art”)
  • Specify composition details (e.g., “close-up”, “wide angle”, “bird’s eye view”)
  • Add lighting information (e.g., “golden hour”, “dramatic lighting”, “soft natural light”)
aspectRatio
string
Output image aspect ratio. Choose from:
  • 1:1 - Square (social media)
  • 16:9 - Widescreen (wallpapers, presentations)
  • 9:16 - Portrait (mobile wallpapers)
  • 4:3 - Standard (traditional displays)
  • And 7 other ratios
version
string
Midjourney model version:
  • 7 - Latest model (recommended)
  • 6.1, 6 - Previous versions
  • niji6 - Anime/illustration focused
stylization
integer
Artistic style intensity (0-1000):
  • Low values (0-100): More realistic
  • High values (500-1000): More artistic/stylized

Async Processing with Callbacks

For production applications, use callbacks instead of polling:
{
  "taskType": "mj_txt2img",
  "prompt": "A serene zen garden with cherry blossoms",
  "callBackUrl": "https://your-app.com/webhook/mj-callback",
  "aspectRatio": "16:9"
}
The system will POST results to your callback URL when generation completes.

Learn More About Callbacks

Complete guide to implementing and handling Midjourney API callbacks

Best Practices

Status Codes

200
Success
Task created successfully or request completed
400
Bad Request
Invalid request parameters or malformed JSON
401
Unauthorized
Missing or invalid API key
402
Insufficient Credits
Account doesn’t have enough credits for the operation
429
Rate Limited
Too many requests - implement backoff strategy
500
Server Error
Internal server error - contact support if persistent

Next Steps

Support

Need help? Our technical support team is here to assist you.

Ready to start generating amazing AI images? Get your API key and begin creating today!