curl --request GET \
--url https://api.ephone.ai/midjourney/task/{task_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.ephone.ai/midjourney/task/{task_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.ephone.ai/midjourney/task/{task_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.ephone.ai/midjourney/task/{task_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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": "success",
"speed": "fast",
"prompt": "a red bicycle leaning on a brick wall, morning light --ar 3:2 --v 8.2",
"images": [
"https://.../1.png",
"https://.../2.png",
"https://.../3.png",
"https://.../4.png"
],
"seed": 3277589003,
"actions": [
"upscale",
"variation",
"remix",
"zoom",
"pan",
"inpaint",
"video",
"reroll"
],
"created_at": 1792154579,
"finished_at": 1792154629,
"usage": {
"type": "call",
"multiplier": 1
}
}{
"error": {
"code": "unauthorized",
"message": "Invalid API key"
}
}{
"error": {
"code": "task_not_found",
"message": "Task not found"
}
}Get Task
Fetch a task’s status and result with the task_id returned on submission.
curl --request GET \
--url https://api.ephone.ai/midjourney/task/{task_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.ephone.ai/midjourney/task/{task_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.ephone.ai/midjourney/task/{task_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.ephone.ai/midjourney/task/{task_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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": "success",
"speed": "fast",
"prompt": "a red bicycle leaning on a brick wall, morning light --ar 3:2 --v 8.2",
"images": [
"https://.../1.png",
"https://.../2.png",
"https://.../3.png",
"https://.../4.png"
],
"seed": 3277589003,
"actions": [
"upscale",
"variation",
"remix",
"zoom",
"pan",
"inpaint",
"video",
"reroll"
],
"created_at": 1792154579,
"finished_at": 1792154629,
"usage": {
"type": "call",
"multiplier": 1
}
}{
"error": {
"code": "unauthorized",
"message": "Invalid API key"
}
}{
"error": {
"code": "task_not_found",
"message": "Task not found"
}
}| status | Meaning |
|---|---|
submitted | Submitted, waiting in the queue |
in_progress | Generating |
success | Done; outputs are in images / videos / descriptions, and usage.multiplier is this task’s spec multiplier. Query with X-Billing-Detail: true and the X-Billing-Amount response header shows what this task actually cost |
failure | Failed; see fail_reason. The charge is refunded |
notify_hook on submission, the same content as the fetch result is POSTed there when the task ends. Notifications can be lost on the network, so fetch the task if one doesn’t arrive in time.Authorizations
Send your API key in the Authorization: Bearer YOUR_API_KEY header.
Headers
Pass true to get the X-Billing-Currency and X-Billing-Amount response headers (what this task actually cost) once the task has finished; the response body does not change. If you also send it when submitting the task, later queries return them without the header, and the callback request sent when the task finishes carries them as request headers too.
Path Parameters
The task ID returned when you submitted the task.
Response
OK
Task ID.
Action name, e.g. imagine, upscale.
Task status, see the table above.
submitted, in_progress, success, failure Created at (Unix seconds).
The speed tier chosen on submit: relax, fast or turbo, which is also the tier you are billed for. Describe has no speed, so it is omitted.
The prompt that was submitted.
Image URLs in index order (the first one is index: 1). An image that failed content review is an empty string.
Video URLs (video endpoints) in index order.
Image descriptions (describe).
Seed.
Operations you can run next on this task, e.g. ["upscale", "variation", "reroll"]. Pass one as action to POST /midjourney/action together with task_id; per-image operations also take index, reroll doesn't.
Failure reason.
Finished at (Unix seconds).
Usage, returned only on success, e.g. {"type": "call", "multiplier": 2}. multiplier is the spec multiplier on the unit price of the selected speed tier in the price table: 2 for HD, 0.5 for a V7 draft; videos depend on resolution and count. Account discounts are not included; see the X-Billing-Amount response header (query with X-Billing-Detail: true) for what the task actually cost.
Was this page helpful?