Midjourney /relax command

Table of contents

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

Use this endpoint to submit the Midjourney /relax command to your Discord Midjourney channel.

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

Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
Request Body
{
    "discord": "Discord token",
    "server": "Discord server id",
    "channel": "Discord channel id",
    "replyUrl": "Place your call back URL here",
    "replyRef": "Place your reference id here"
}
  • discord, server, channel are optional if only one Midjourney account configured under account/midjourney.
    You may specify the channel value alone (omitting discord and server) when you have multiple account/midjourney accounts setup at wish to use a specific account from the configured list at account/midjourney.

  • discord, server, channel are required, if you do not have account/midjourney accounts configured. See Setup Midjourney for details.

  • 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": "relax",
        "status": "completed",
        "created": "2023-09-09T02:04:52.667Z",
        "updated": "2023-09-09T02:04:53.490Z",
        "discord": "<ABC…secured…xyz>",
        "channel": "<Discord channel id>",
        "server": "<Discord server id>",
        "replyUrl": "https://webhook.site/abc",
        "replyRef": "<your optional reference id>",
        "messageId": "<Discord message id>",
        "timestamp": "2023-09-09T02:04:52.774000+00:00",
        "content": "Done! Your jobs now do not consume fast-hours, but might take a little longer. You can always switch back with `/fast`",
        "code": 200
    }
    
  • 400 Bad Request

    {
        "error": 
          "discord, server or channel value is missing"
          "replyRef or replyUrl is too long"
        "code": 412
    }
    
  • 401 Unauthorized

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

    {
        "error": "Account has no subscription or subscription expired",
        "code": 402
    }
    
  • 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": "relax",
        "status": "failed",
        "created": "2023-09-09T02:04:52.667Z",
        "updated": "2023-09-09T02:04:53.490Z",
        "discord": "<ABC…secured…xyz>",
        "channel": "<Discord channel id>",
        "server": "<Discord server 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 POST account/midjourney/<channel>/reset before making any new API calls.",
        "code": 596
    }
    
Model
{ // TypeScript, all fields are optional
  jobid: string, 
  verb: 'relax',
  status: 'completed' | 'failed',
  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,
  server: string,
  replyUrl: string,
  replyRef: string,
  messageId: string,
  content: string,
  timestamp: string,
  error: string,
  errorDetails: 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/relax \
         -d '{"discord": "…", "server": "…", "channel": "…"}'
    
  • const apiUrl = "https://api.useapi.net/v2/jobs/relax"; 
    const token = "API token";
    const discord = "Discord token";
    const server = "Discord server id";
    const channel = "Discord channel id";      
    const data = { 
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${token}`,
        'Content-Type': 'application/json' }
    };
    data.body = JSON.stringify({ 
      discord, server, channel 
    });
    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/relax" 
    token = "API token"
    discord = "Discord token"
    server = "Discord server id"
    channel = "Discord channel id"
    headers = {
        "Content-Type": "application/json", 
        "Authorization" : f"Bearer {token}"
    }
    body = {
        "discord": f"{discord}", 
        "server": f"{server}", 
        "channel": f"{channel}"
    }
    response = requests.post(apiUrl, headers=headers, json=body)
    print(response, response.json())
    
Try It