curl --request POST \
--url https://api.ephone.ai/midjourney/imagine \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "a lighthouse on a rocky coast at dawn --ar 16:9 --v 7"
}
'import requests
url = "https://api.ephone.ai/midjourney/imagine"
payload = { "prompt": "a lighthouse on a rocky coast at dawn --ar 16:9 --v 7" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({prompt: 'a lighthouse on a rocky coast at dawn --ar 16:9 --v 7'})
};
fetch('https://api.ephone.ai/midjourney/imagine', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ephone.ai/midjourney/imagine"
payload := strings.NewReader("{\n \"prompt\": \"a lighthouse on a rocky coast at dawn --ar 16:9 --v 7\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"task_id": "mj-6f1c2b0e9a7d4e2fb1c3d5e7f9a1b2c3",
"action": "imagine",
"status": "submitted",
"created_at": 1792000000
}{
"error": {
"code": "invalid_request",
"message": "index must be between 1 and 4"
}
}{
"error": {
"code": "unauthorized",
"message": "Invalid API key"
}
}{
"error": {
"code": "insufficient_quota",
"message": "Insufficient balance"
}
}{
"error": {
"code": "queue_full",
"message": "Queue is full, please try again later"
}
}{
"error": {
"code": "upstream_error",
"message": "The service is temporarily unavailable, please retry"
}
}Imagine
Midjourney text-to-image, four images per task. V8.2 by default; V8.1, V8, V7 and Niji 7 / 6 are also supported: add a parameter such as --v 7 at the end of the prompt. Image prompts and all Midjourney parameters work as usual.
curl --request POST \
--url https://api.ephone.ai/midjourney/imagine \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "a lighthouse on a rocky coast at dawn --ar 16:9 --v 7"
}
'import requests
url = "https://api.ephone.ai/midjourney/imagine"
payload = { "prompt": "a lighthouse on a rocky coast at dawn --ar 16:9 --v 7" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({prompt: 'a lighthouse on a rocky coast at dawn --ar 16:9 --v 7'})
};
fetch('https://api.ephone.ai/midjourney/imagine', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ephone.ai/midjourney/imagine"
payload := strings.NewReader("{\n \"prompt\": \"a lighthouse on a rocky coast at dawn --ar 16:9 --v 7\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"task_id": "mj-6f1c2b0e9a7d4e2fb1c3d5e7f9a1b2c3",
"action": "imagine",
"status": "submitted",
"created_at": 1792000000
}{
"error": {
"code": "invalid_request",
"message": "index must be between 1 and 4"
}
}{
"error": {
"code": "unauthorized",
"message": "Invalid API key"
}
}{
"error": {
"code": "insufficient_quota",
"message": "Insufficient balance"
}
}{
"error": {
"code": "queue_full",
"message": "Queue is full, please try again later"
}
}{
"error": {
"code": "upstream_error",
"message": "The service is temporarily unavailable, please retry"
}
}POST /v1/task/submit with model set to midjourney-imagine and the parameters inside input. Both behave and bill the same.notify_hook when submitting. When the task succeeds, actions in the result lists what you can do next through Image Actions.Authorizations
Send your API key in the Authorization: Bearer YOUR_API_KEY header.
Body
Prompt: Describe the image; Midjourney parameters are allowed, e.g. a cat in the rain --ar 16:9 --v 7. Optional when images are given.
6000Image Prompts: Up to 5 images used as image prompts. An image URL (publicly reachable) or a base64 data URI, up to 20 MB each.
5Speed: relax is cheapest but queues longer; turbo is fastest at 2x price. You can also write --relax / --fast / --turbo in the prompt; this field wins. Defaults to fast.
relax, fast, turbo Notify hook: when the task ends, the same content as the fetch result is POSTed to this URL (a public http / https URL). Omit it to poll instead.
Was this page helpful?