Create or update Midjourney account information
December 2023
Table of contents
For your convenience, you can specify your Midjourney configuration values under your account so that you no longer need to provide them with every API call. If you specify multiple Midjourney accounts, the API will automatically perform load balancing by randomly selecting an account with available capacity before making calls to Discord / Midjourney.
https://api.useapi.net/v2/account/midjourney/
channel
Request Headers
Authorization: Bearer {API token}
API token
is required, see Setup useapi.net for details.
Request Body
{
"discord": "Discord token",
"server": "Discord server id",
"channel": "Discord channel id",
"maxJobs": 1-15,
}
-
discord
,server
,channel
are required. Please see Setup Midjourney for details. -
channel
value specified in the request body must match the channel value specified in the URL path https://api.useapi.net/v2/account/midjourney/channel
. -
maxJobs
is required. This value should be the same or less than your Midjourney subscription plan Maximum Concurrent Jobs. Currently, it should be 3 or less for Basic and Standard plans and 15 or less for Pro and Mega plans.
Important Specifying a higher number than supported by your Midjourney subscription will prevent API from functioning properly.
Responses
-
{ "error": "Required param discord is missing or empty" "Required param server is missing or empty" "Required param server (<server>) is not valid Discord server id" "Required param channel is missing or empty" "Required param channel (<channel>) is not valid Discord channel id" "Required param channel (<channel>) not matching to /midjourney/channel (/midjourney/<channel>)" "Required param maxJobs is missing or empty" "Required param maxJobs <maxJobs> can't be more that <maxConcurrentJobs>" "Channel <channel> configuration has same discord value" "Channel <channel> configuration has same server value" "code": 400 }
-
{ "error": "Unauthorized", "code": 401 }
Model
{ // TypeScript, all fields are optional
discord: string,
server: string,
channel: string,
maxJobs: number,
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/account/midjourney/<channel> \ -d '{"discord": "…", "server": "…", "channel": "…", "maxJobs": …}'
-
const channel = "Discord channel id"; const apiUrl = `https://api.useapi.net/v2/account/midjourney/${channel}`; const token = "API token"; const discord = "Discord token"; const server = "Discord server id"; const maxJobs = 3; const data = { method: 'POST', headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' } }; data.body = JSON.stringify({ discord, server, channel, maxJobs }); const response = await fetch(apiUrl, data); const result = await response.json(); console.log("response", {response, result});
-
import requests channel = "Discord channel id" apiUrl = f"https://api.useapi.net/v2/account/midjourney/{channel}" token = "API token" discord = "Discord token" server = "Discord server id" maxJobs = 3 headers = { "Content-Type": "application/json", "Authorization" : f"Bearer {token}" } body = { "discord": f"{discord}", "server": f"{server}", "channel": f"{channel}", "maxJobs": maxJobs } response = requests.post(apiUrl, headers=headers, json=body) print(response, response.json())