Retrieve job status and results

Table of contents

  1. Request Headers
  2. Query Parameters
  3. Responses
  4. Examples
  5. Try It

Important
We will be officially sunsetting v1. Starting from March 1, 2024 all calls will be routed to v2 endpoints. Although this change will be transparent to our customers we strongly advise you to update your code to use the v2 endpoints as they provide many more options.

Use this endpoint to retrieve status and results of

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 30 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/v1/jobs/?jobid=jobid

Request Headers
Authorization: Bearer {API token}
Query Parameters
Responses
  • 200 OK

    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 from attachments field. Field content contains message generated by Midjourney reflecting current generation parameters and progress. Optional array embeds 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"
        ],
        "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
    }
    
    Model
    {
        jobid: string,
        parentJobId?: string,
        verb: 'imagine' | 'button' | 'blend' | 'describe',
        status: 'created' | 'started' | 'moderated' | 'progress' | 
                'completed' | 'failed' | 'cancelled',
        created: Date,
        updated?: Date,
        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)' | 'Redo Upscale (2x)' | 'Redo Upscale (4x)' |
                'Make Variations' | 'Remaster',
        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)' | 'Redo Upscale (2x)' | 'Redo Upscale (4x)' |
                        'Make Variations' | 'Remaster',
                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)' | 'Redo Upscale (2x)' | 'Redo Upscale (4x)' |
            'Make Variations' | 'Remaster'
        ]
        channel: string,
        server: string,
        maxJobs: number,
        messageId?: string,
        content?: string,
        timestamp?: Date,
        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
                }
            }
        ], 
        code: 200
    }
    
  • 400 Bad Request

    {
        "error": "Query param jobid not provided",
        "code": 400
    }
    
  • 401 Unauthorized

    {
        "error": "Unauthorized",
        "code": 401
    }
    
  • 404 Not Found

    {
        "error": "Unable to locate job <jobid>",
        "code": 404
    }
    
Examples
  • curl https://api.useapi.net/v1/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/v1/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/v1/jobs/?jobid={jobid}"
    headers = {
        "Content-Type": "application/json", 
        "Authorization" : f"Bearer {token}"
    }
    response = requests.get(apiUrl, headers=headers)
    print(response, response.json())
    
Try It