Skip to main content

Overview

Midjourney is one of the most popular AI image generation tools currently available. Ace Data Cloud provides a comprehensive Midjourney API that supports image generation, editing, description, video, and other features.

API Endpoints

EndpointFunction
POST /midjourney/imagineGenerate images (main endpoint)
POST /midjourney/editsEdit images
POST /midjourney/describeImage description
POST /midjourney/videosImage-to-video
POST /midjourney/seedGet Seed value
POST /midjourney/translatePrompt translation
POST /midjourney/tasksQuery task status

Basic Image Generation

import requests

response = requests.post(
    "https://api.acedata.cloud/midjourney/imagine",
    headers={
        "Authorization": "Bearer YOUR_API_TOKEN",
        "Content-Type": "application/json",
    },
    json={
        "prompt": "A serene Japanese garden with cherry blossoms, ultra detailed --ar 16:9",
        "action": "generate",
        "mode": "fast",
    },
)
result = response.json()
print(result)

Image Editing

Upscale

response = requests.post(
    "https://api.acedata.cloud/midjourney/imagine",
    headers={
        "Authorization": "Bearer YOUR_API_TOKEN",
        "Content-Type": "application/json",
    },
    json={
        "action": "upscale",
        "image_id": "your-image-id",
    },
)

Variation

response = requests.post(
    "https://api.acedata.cloud/midjourney/imagine",
    headers={
        "Authorization": "Bearer YOUR_API_TOKEN",
        "Content-Type": "application/json",
    },
    json={
        "action": "variation",
        "image_id": "your-image-id",
    },
)

Image Description

Generate text description from an image:
response = requests.post(
    "https://api.acedata.cloud/midjourney/describe",
    headers={
        "Authorization": "Bearer YOUR_API_TOKEN",
        "Content-Type": "application/json",
    },
    json={
        "image_url": "https://example.com/your-image.jpg",
    },
)

Prompt Tips

  • Use --ar 16:9 to control aspect ratio
  • Use --q 2 to increase quality
  • Use --style raw for a more realistic effect
  • Set translation: true to automatically translate Chinese prompts into English

Asynchronous Callback

Image generation takes time; it is recommended to use a callback URL:
response = requests.post(
    "https://api.acedata.cloud/midjourney/imagine",
    headers={
        "Authorization": "Bearer YOUR_API_TOKEN",
        "Content-Type": "application/json",
    },
    json={
        "prompt": "A futuristic cityscape at night",
        "callback_url": "https://your-server.com/webhook",
    },
)

Summary

The Midjourney API provided by Ace Data Cloud offers full capabilities for image generation and editing. From simple text-to-image generation to complex editing operations, all can be achieved through standard REST APIs. Visit platform.acedata.cloud to register and experience it.