Retrieve job status and results
December 2023 (October 7, 2024)
Table of contents
Use this endpoint to retrieve status and results of
- jobs/imagine
- jobs/button
- jobs/blend
- jobs/describe
- jobs/info
- jobs/relax
- jobs/fast
- jobs/turbo
- jobs/variability
- jobs/remix
- jobs/seed_async
- jobs/seed
If you specified optional parameter replyUrl
you technically do not need to use this endpoint to retrieve results since API will call provided replyUrl
once job generation completed.
Important API periodically polls (checks) Discord every 15 to 60 seconds (depending on the load) and updates all currently executed jobs statuses and results. Polling interval is used for safety reasons, aiming to prevent any potential issues with Discord and Midjourney, such as bans or excessive requests.
Jobs lifespan guaranteed to be at least 31 days, after that they will be expired and may be recycled.
https://api.useapi.net/v2/jobs/?jobid=
jobid
Request Headers
Authorization: Bearer {API token}
API token
is required, see Setup useapi.net for details.
Query Parameter
jobid
is required, use the value returned by the following jobs:
You can also retrieve results for the jobs listed below, even though they will return the final result with the original call:
Responses
-
If field
status
value is created, started or progress wait in a loop for at least 10..30 seconds and retry again. When completed retrieve generated image fromattachments
field. Fieldcontent
contains message generated by Midjourney reflecting current generation parameters and progress. Optional arrayembeds
contains additional information.{ "jobid": "<jobid>", "verb": "imagine", "status": "completed", "created": "2023-09-09T02:04:49.667Z", "updated": "2023-09-09T02:19:20.256Z", "prompt": "Steampunk cat", "children": [ { "button": "U1", "jobid": "<jobid>", "messageId": "<Discord message id>" }, { "button": "U2", "jobid": "<jobid>", "messageId": "<Discord message id>" }, { "messageId": "<Discord message id>", "button": "U3", "jobid": "<jobid>" } ], "buttons": [ "U1", "U2", "U3", "U4", "🔄", "V1", "V2", "V3", "V4" ], "discord": "<ABC…secured…xyz>", "channel": "<Discord channel id>", "server": "<Discord server id>", "maxJobs": 3, "messageId": "<Discord message id>", "content": "**Steampunk cat --s 750 --v 5.2** - <@Discord user id> (fast)", "timestamp": "2023-09-09T02:05:24.991000+00:00", "attachments": [ { "url": "<generated image url>", "proxy_url": "<generated proxy image url>", "width": 2048, "height": 2048, "content_type": "<generated image type>", "id": "<Discord image id>", "filename": "<generated image name>", "size": 7204115 } ], "code": 200 }
-
{ "error": "Query param jobid not provided", "code": 400 }
-
{ "error": "Unauthorized", "code": 401 }
-
{ "error": "Account has no subscription or subscription expired", "code": 402 }
-
{ "error": "Unable to locate job <jobid>", "code": 404 }
-
{ "error": "Job has expired", "code": 410 }
Model
{ // TypeScript, all fields are optional
jobid: string,
parentJobId: string,
verb: 'imagine' | 'button' | 'blend' | 'describe' |
'info' | 'relax' | 'fast' | 'turbo' | 'variability' | 'remix' | 'seed' | 'seed_async',
status: 'created' | 'started' | 'moderated' | 'progress' |
'completed' | 'failed' | 'cancelled',
seed: {
value: number, // Parsed seed number
content: string, // Original content message returned by Midjourney for a seed request
attachments: { // Seed images
id: string,
content_type: string,
filename: string,
url: string,
proxy_url: string,
size: number,
width: number,
height: number
}[]
},
created: string, // YYYY-MM-DDTHH:mm:ss.sssZ, IS0 8601, UTC
updated: string, // YYYY-MM-DDTHH:mm:ss.sssZ, IS0 8601, UTC
prompt: string,
blendUrls: string[],
blendDimensions: 'Portrait' | 'Square' | 'Landscape',
describeUrl: string,
button: 'U1' | 'U2' | 'U3' | 'U4' | 'V1' | 'V2' | 'V3' | 'V4' |
'⬅️' | '➡️' | '⬆️' | '⬇️' | '🔄' |
'Vary (Strong)' | 'Vary (Subtle)' | 'Zoom Out 1.5x' | 'Zoom Out 2x' | 'Make Square' |
'Upscale (2x)' | 'Upscale (4x)' | 'Upscale (Subtle)' | 'Upscale (Creative)' |
'Redo Upscale (2x)' | 'Redo Upscale (4x)' | 'Redo Upscale (Subtle)' | 'Redo Upscale (Creative)' |
'Make Variations' | 'Remaster' | 'Custom Zoom',
children: {
messageId: string,
button: 'U1' | 'U2' | 'U3' | 'U4' | 'V1' | 'V2' | 'V3' | 'V4' |
'⬅️' | '➡️' | '⬆️' | '⬇️' | '🔄' |
'Vary (Strong)' | 'Vary (Subtle)' | 'Zoom Out 1.5x' | 'Zoom Out 2x' | 'Make Square' |
'Upscale (2x)' | 'Upscale (4x)' | 'Upscale (Subtle)' | 'Upscale (Creative)' |
'Redo Upscale (2x)' | 'Redo Upscale (4x)' | 'Redo Upscale (Subtle)' | 'Redo Upscale (Creative)' |
'Make Variations' | 'Remaster' | 'Custom Zoom',
jobid: string
}[],
buttons:
[
'U1' | 'U2' | 'U3' | 'U4' | 'V1' | 'V2' | 'V3' | 'V4' |
'⬅️' | '➡️' | '⬆️' | '⬇️' | '🔄' |
'Vary (Strong)' | 'Vary (Subtle)' | 'Zoom Out 1.5x' | 'Zoom Out 2x' | 'Make Square'
'Upscale (2x)' | 'Upscale (4x)' | 'Upscale (Subtle)' | 'Upscale (Creative)' |
'Redo Upscale (2x)' | 'Redo Upscale (4x)' | 'Redo Upscale (Subtle)' | 'Redo Upscale (Creative)' |
'Make Variations' | 'Remaster' | 'Custom Zoom'
],
discord: string, // Provided for debugging purposes only, contains the first 3 and the last 3 characters of the original value
channel: string,
server: string,
maxJobs: number,
messageId: string,
content: string, // Contains message generated by Midjourney reflecting current generation parameters and progress
timestamp: string,
attachments: {
id: string,
content_type: string,
filename: string,
url: string,
proxy_url: string,
size: number,
width: number,
height: number
}[],
embeds: {
type: string,
description: string,
image: {
url: string,
proxy_url: string,
width: number,
height: number
}
}[],
error: string,
errorDetails: string,
replyUrl: string,
replyRef: string,
code: 200
}
Examples
-
curl https://api.useapi.net/v2/jobs/?jobid=… \ -H "Accept: application/json" \ -H "Authorization: Bearer …"
-
const token = "API token"; const jobid = "jobid returned by jobs/imagine or jobs/button"; const apiUrl = `https://api.useapi.net/v2/jobs/?jobid=${jobid}`; const response = await fetch(apiUrl, { headers: { "Authorization": `Bearer ${token}`, }, }); const result = await response.json(); console.log("response", {response, result});
-
import requests token = "API token" jobid = "jobid returned by jobs/imagine or jobs/button" apiUrl = f"https://api.useapi.net/v2/jobs/?jobid={jobid}" headers = { "Content-Type": "application/json", "Authorization" : f"Bearer {token}" } response = requests.get(apiUrl, headers=headers) print(response, response.json())