Retrieve the seed.

Table of contents

  1. Request Headers
  2. Request Body
  3. Responses
  4. Model
  5. Examples
  6. Try It

Retrieve the seed for for the following completed jobs:

https://api.useapi.net/v2/jobs/seed

Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
Request Body
{
    "jobid": "jobid",
    "discord": "Discord token",
    "replyUrl": "Place your call back URL here",
    "replyRef": "Place your reference id here"
}
  • jobid is required, jobid of successfully completed (status set to completed) jobs/imagine, jobs/button or jobs/blend job.

  • discord is optional, if provided will override discord value of referenced above jobid, see Setup Midjourney for details. If the channel corresponding to the jobid mentioned above has an account configured under account/midjourney, the current account’s discord value will be used if it is not explicitly provided. This ensures that even jobs executed some time ago can still be successfully executed by this endpoint, even after possible changes to the account’s discord value.

  • replyUrl is optional, if not provided value from account will be used.
    Place here your callback URL. API will call the provided replyUrl once job completed or failed.
    Maximum length 1024 characters.
    We recommend using sites like webhook.site to test callback URL functionality.

  • replyRef is optional, place here your reference id which will be stored and returned along with this job response / result.
    Maximum length 1024 characters.

Responses
  • 200 OK

    {
        "jobid": "<jobid>",
        "verb": "seed",
        "status": "completed",
        "created": "2023-09-09T20:19:57.073Z",
        "updated": "2023-09-09T20:19:58.536Z",
        "parentJobId": "<jobid>",
        "seed": {
            "content": "**<prompt>**\n**Job ID**: <Job ID>n**seed** <seed>",
            "value": 123456789
        },    
        "discord": "<ABC…secured…xyz>",
        "channel": "<Discord channel id>",
        "replyUrl": "https://webhook.site/abc",
        "replyRef": "<your optional reference id>",
        "content": "<Discord message content>",
        "messageId": "<Discord message id>",
        "timestamp": "2023-09-09T20:19:57.926000+00:00",
        "code": 200
    }
    

    If the seed was already retrieved for the provided jobid API will return the original job along with the seed as shown below.

    {
        "jobid": "<jobid>",
        "verb": "imagine|button|blend",
        "status": "completed",
        "created": "2023-09-09T02:04:49.667Z",
        "updated": "2023-09-09T02:04:53.490Z",
        "content": "**Steampunk cat --s 750 --v 5.2** - <@Discord user id> (Waiting to start)",
        "seed": {
            "content": "**<prompt>**\n**Job ID**: <Job ID>n**seed** <seed>",
            "value": 123456789
        }, 
        "prompt": "Steampunk cat",
        "discord": "<ABC…secured…xyz>",
        "channel": "<Discord channel id>",
        "server": "<Discord server id>",
        "maxJobs": 3,
        "replyUrl": "https://webhook.site/abc",
        "replyRef": "<your optional reference id>",
        "messageId": "<Discord message id>",
        "timestamp": "2023-09-09T02:04:51.926000+00:00",
        "code": 200
    }
    
  • 400 Bad Request

    {
        "error": 
          "<jobid> is missing"
          "<replyRef | replyUrl> is too long"
          "Parent job must be completed"
          "Job of type <verb> not supported"
          "<discord | channel> is missing"
        "code": 400
    }
    
  • 401 Unauthorized

    {
        "error": "Unauthorized",
        "code": 401
    }
    
  • 402 Payment Required

    {
        "error": "Account has no subscription or subscription expired",
        "code": 402
    }
    
  • 404 Not Found

    {
        "error": "Unable to locate parent job <jobid>",
        "code": 404
    }
    
  • 596 Pending mod message

    API detected Midjourney pending moderation message. All API calls will be halted and returned 569 response status code until you clear this field by posting to account/midjourney/channel/reset. We will also send you an email when this error ocurred. The best course of action is to log into your Discord account and acknowledge the Midjourney moderation message to prevent a potential ban on your Midjourney account.

    {
        "jobid": "<jobid>",
        "verb": "seed",
        "parentJobId": "<jobid>",
        "status": "failed",
        "created": "2023-09-09T02:04:49.667Z",
        "updated": "2023-09-09T02:04:53.490Z",
        "discord": "<ABC…secured…xyz>",
        "channel": "<Discord channel id>",
        "replyUrl": "https://webhook.site/abc",
        "replyRef": "<your optional reference id>",
        "messageId": "<Discord message id>",
        "timestamp": "2023-09-09T02:04:51.926000+00:00",
        "error": "Pending mod message",
        "errorDetails": "You have a pending moderation message. Please acknowledge it before using the bot further.",
        "code": 596
    }
    
    {
        "error": "Your Discord account has received a pending moderation message from Midjourney. Please address this issue and reset the /account pendingModMessage before making any new API calls.",
        "code": 596
    }
    
Model
{ // TypeScript, all fields are optional
  jobid: string, // Use returned jobid value to retrieve job status and results
  parentJobId: string,
  verb: 'seed' | 'imagine' | 'button' | 'blend',
  status: 'completed' | 'failed',
  seed: { 
    value: number, // Parsed seed number
    content: string // Original content message returned by Midjourney for a seed request
  },
  created: string, // YYYY-MM-DDTHH:mm:ss.sssZ, IS0 8601, UTC
  updated: string, // YYYY-MM-DDTHH:mm:ss.sssZ, IS0 8601, UTC
  discord: string, // Provided for debugging purposes only, contains the first 3 and the last 3 characters of the original value
  channel: string,
  replyUrl: string,
  replyRef: string,
  messageId: string,
  content: string, // Contains message generated by Midjourney reflecting current generation parameters and progress
  timestamp: string,
  error: string,
  errorDetails: string,
  executingJobs: string[],
  code: number
}
Examples
  • curl -H "Accept: application/json" \
         -H "Content-Type: application/json" \
         -H "Authorization: Bearer …" \
         -X POST https://api.useapi.net/v2/jobs/seed \
         -d '{"jobid": "…"}'
    
  • const apiUrl = "https://api.useapi.net/v2/jobs/seed"; 
    const token = "API token";
    const jobid = "Completed jobs/imagine, jobs/button or jobs/blend jobid";      
    const data = { 
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${token}`,
        'Content-Type': 'application/json' }
    };
    data.body = JSON.stringify({ jobid });
    const response = await fetch(apiUrl, data);
    const result = await response.json();
    console.log("response", {response, result});
    
  • import requests
    apiUrl = "https://api.useapi.net/v2/jobs/seed" 
    token = "API token"
    jobid = "Completed jobs/imagine, jobs/button or jobs/blend jobid"
    headers = {
        "Content-Type": "application/json", 
        "Authorization" : f"Bearer {token}"
    }
    body = {
        "jobid": f"{jobid}", 
    }
    response = requests.post(apiUrl, headers=headers, json=body)
    print(response, response.json())
    
Try It