TTAPI Docs
  • TT API Document
  • API Capabilities
    • 🔥Midjourney API
    • 🔗Account
    • ⭕Status Code
  • FAQ
    • Midjourney
      • Account
      • API
      • Hold Account
Powered by GitBook
On this page
  • Mode
  • Generate[ /imagine ]
  • Action[ U1~U4 V1~V4... ]
  • Seeds[ --seed ]
  • Blend [ /blend ]
  • Describe[ /describe ]
  • Inpaint[ Vary(region) ]
  • Fetch Job
  • Action Used In action endpoint
  • Async callback return json structure
  • Return body enumeration details
  1. API Capabilities

Midjourney API

TT API's Midjourney API is the most stable and cost-effective Midjourney API

Last updated 1 year ago

Mode

The Midjourney service of TT API supports three modes, fast, relax and turbo.

  • Fast mode response time is within 90 seconds, the overall success rate is over 98%

  • Relax mode response generally within 10 minutes, depending on the official response, the overall success rate is over 90%

  • Turbo mode response time is within 60 seconds

The max job in progressing is 10, get more job in progress please

'Imagine action' with Midjourney 6.0 will be 1.5 times quota than the normal consumption. --cref operation must be used with the --v 6.0 model

Generate[ /imagine ]

POST https://api.ttapi.io/midjourney/v1/imagine

The imagine endpoint generates up to 4 images from a text prompt.

Headers

Name
Type
Description

TT-API-KEY*

String

Your API Key in TT API used for request authorization

Content-Type

String

application-json

Request Body

Name
Type
Description

prompt*

String

Prompt use to generate image. exp:a cat --ar 1:1

hookUrl

String

mode

String

timeout

int

Request timeout, unit: seconds. If not filled in, the default timeout is 300 seconds

getUImages

boolean

Whether to obtain four small pictures. The optional values are true and false. Default is false. Note: This operation does not actually means U operation on the generated task.

Example Request

import requests

endpoint = "https://api.ttapi.io/midjourney/v1/imagine"

headers = {
    "TT-API-KEY": your_key
}

data = {
    "prompt": "a cute cat",
    "model": "fast",
    "hookUrl": ""
}

response = requests.post(endpoint, headers=headers, json=data)

print(response.status_code)
print(response.json())
<?php

$url = 'https://api.ttapi.io/midjourney/v1/imagine';

$data = array(
    'prompt' => 'a cat --ar 1:1',
    'model' => 'fast',
    'hookUrl' => ''
);

$ch = curl_init($url);

$dataString = json_encode($data);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $dataString);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'TT-API-KEY: your_key'
);

$result = curl_exec($ch);

$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

curl_close($ch);

echo $httpCode;

const axios = require('axios');

let config = {
  method: 'post',
  url: 'https://api.ttapi.io/midjourney/v1/imagine',
  headers: { 
    'TT-API-KEY': 'your_key'
  },
  data : {
    "prompt": "a cute cat",
    "model": "fast",
    "hookUrl": ""
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.status));
})
.catch(function (error) {
  console.log(error);
});

Example Response

{
  "status": "SUCCESS",
  "message": "",
  "data": {
    "jobId": "afa774a3-1aee-5aba-4510-14818d6875e4"
  }
}
{
  "status": "FAILED",
  "message": "banned prompt words :sexy",
  "data": {}
}

Action[ U1~U4 V1~V4... ]

POST https://api.ttapi.io/midjourney/v1/action

Headers

Name
Type
Description

TT-API-KEY*

String

Your API Key in TT API used for request authorization

Content-Type

String

application-json

Request Body

Name
Type
Description

jobId*

String

The jobId in prev request

action*

String

variation1 means V1

hookUrl

String

timeout

int

Request timeout, unit: seconds. If not filled in, the default timeout is 300 seconds

Example Request

import requests

endpoint = "https://api.ttapi.io/midjourney/v1/action"

headers = {
    "TT-API-KEY": your_key
}

data = {
    "jobId": "afa774a3-1aee-5aba-4510-14818d6875e4",
    "action": "upsample1",
    "hookUrl": ""
}

response = requests.post(endpoint, headers=headers, json=data)

print(response.status_code)
print(response.json())
<?php

$url = 'https://api.ttapi.io/midjourney/v1/action';

$data = array(
    'jobId' => 'afa774a3-1aee-5aba-4510-14818d6875e4',
    'action' => 'upsample1',
    'hookUrl' => ''
);

$ch = curl_init($url);

$dataString = json_encode($data);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $dataString);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'TT-API-KEY: your_key'
);

$result = curl_exec($ch);

$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

curl_close($ch);

echo $httpCode;
const axios = require('axios');

let config = {
  method: 'post',
  url: 'https://api.ttapi.io/midjourney/v1/action',
  headers: { 
    'TT-API-KEY': 'your_key'
  },
  data : {
    "jobId": "afa774a3-1aee-5aba-4510-14818d6875e4",
    "action": "upsample1",
    "hookUrl": ""
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.status));
})
.catch(function (error) {
  console.log(error);
});

Example Response

{
  "status": "SUCCESS",
  "message": "",
  "data": {
    "jobId": "afa774a3-1aee-5aba-4510-14818d6875e4"
  }
}

Seeds[ --seed ]

POST https://api.ttapi.io/midjourney/v1/seed

Headers

Name
Type
Description

TT-API-KEY

String

Your API Key in TT API used for request authorization

Content-Type

String

application-json

Request Body

Name
Type
Description

jobId*

String

The jobId in prev request

hookUrl

String

timeout

int

Request timeout, unit: seconds. If not filled in, the default timeout is 300 seconds

Example Request

import requests

endpoint = "https://api.ttapi.io/midjourney/v1/seed"

headers = {
    "TT-API-KEY": your_key
}

data = {
    "jobId": "afa774a3-1aee-5aba-4510-14818d6875e4",
    "hookUrl": ""
}

response = requests.post(endpoint, headers=headers, json=data)

print(response.status_code)
print(response.json())
<?php

$url = 'https://api.ttapi.io/midjourney/v1/seed';

$data = array(
    'jobId' => 'afa774a3-1aee-5aba-4510-14818d6875e4',
    'hookUrl' => ''
);

$ch = curl_init($url);

$dataString = json_encode($data);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $dataString);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'TT-API-KEY: your_key'
);

$result = curl_exec($ch);

$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

curl_close($ch);

echo $httpCode;
const axios = require('axios');

let config = {
  method: 'post',
  url: 'https://api.ttapi.io/midjourney/v1/seed',
  headers: { 
    'TT-API-KEY': 'your_key'
  },
  data : {
    "jobId": "afa774a3-1aee-5aba-4510-14818d6875e4",
    "hookUrl": ""
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.status));
})
.catch(function (error) {
  console.log(error);
});

Example Response

{
  "status": "SUCCESS",
  "message": "",
  "data": {
    "jobId": "afa774a3-1aee-5aba-4510-14818d6875e4"
  }
}

Blend [ /blend ]

POST https://api.ttapi.io/midjourney/v1/blend

Upload 2-5 images and combine them into a new image based on the concept and aesthetic of each image.

Headers

Name
Type
Description

TT-API-KEY

String

Your API Key in TT API used for request authorization

Content-Type

String

application-json

Request Body

Name
Type
Description

imgBase64Array*

Array

Base64 array of images that will be used to generate mixed images

Array length is 2-5

Eg: [

"data:image/png;base64,xxx1", "data:image/png;base64,xxx2"

]

hookUrl

String

timeout

int

Request timeout, unit: seconds. If not filled in, the default timeout is 300 seconds

dimensions

String

Scale of generated image, including PORTRAIT

, SQUARE, LANDSCAPE. If not filled in, SQUARE is used by default.

PORTRAIT corresponds to the ratio 2:3

SQUARE corresponding ratio 1:1

LANDSCAPE corresponds to a ratio of 3:2

mode

String

Example Request

import requests

endpoint = "https://api.ttapi.io/midjourney/v1/blend"

headers = {
    "TT-API-KEY": your_key
}

data = {
    "imgBase64Array": ["data:image/png;base64,xxx1","data:image/png;base64,xxx2"],
    "dimensions": "SQUARE",
    "model": "fast",
    "hookUrl": ""
}

response = requests.post(endpoint, headers=headers, json=data)

print(response.status_code)
print(response.json())
<?php

$url = 'https://api.ttapi.io/midjourney/v1/blend';

$data = array(
    "imgBase64Array" => ["data:image/png;base64,xxx1","data:image/png;base64,xxx2"],
    "dimensions" => "SQUARE",
    "model" => "fast",
    "hookUrl" => ""
);

$ch = curl_init($url);

$dataString = json_encode($data);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $dataString);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'TT-API-KEY: your_key'
);

$result = curl_exec($ch);

$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

curl_close($ch);

echo $httpCode;
const axios = require('axios');

let config = {
  method: 'post',
  url: 'https://api.ttapi.io/midjourney/v1/blend',
  headers: { 
    'TT-API-KEY': 'your_key'
  },
  data : {
    "imgBase64Array" => ["data:image/png;base64,xxx1","data:image/png;base64,xxx2"],
    "dimensions" => "SQUARE",
    "model" => "fast",
    "hookUrl" => ""
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.status));
})
.catch(function (error) {
  console.log(error);
});

Example Response

{
  "status": "SUCCESS",
  "message": "",
  "data": {
    "jobId": "afa774a3-1aee-5aba-4510-14818d6875e4"
  }
}

Describe[ /describe ]

POST https://api.ttapi.io/midjourney/v1/describe

Upload an image and generate four prompts based on the image.

Headers

Name
Type
Description

TT-API-KEY

String

Your API Key in TT API used for request authorization

Content-Type

String

application-json

Request Body

Name
Type
Description

base64*

String

base64 encoding of image

Eg: data:image/png;base64,xxx1

hookUrl

String

timeout

int

Request timeout, unit: seconds. If not filled in, the default timeout is 300 seconds

mode

String

Example Request

import requests

endpoint = "https://api.ttapi.io/midjourney/v1/describe"

headers = {
    "TT-API-KEY": your_key
}

data = {
    "base64": "data:image/png;base64,xxx1",
    "model": "fast",
    "hookUrl": ""
}

response = requests.post(endpoint, headers=headers, json=data)

print(response.status_code)
print(response.json())
<?php

$url = 'https://api.ttapi.io/midjourney/v1/describe';

$data = array(
    "base64" => "data:image/png;base64,xxx1",
    "model" => "fast",
    "hookUrl" => ""
);

$ch = curl_init($url);

$dataString = json_encode($data);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $dataString);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'TT-API-KEY: your_key'
);

$result = curl_exec($ch);

$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

curl_close($ch);

echo $httpCode;
const axios = require('axios');

let config = {
  method: 'post',
  url: 'https://api.ttapi.io/midjourney/v1/describe',
  headers: { 
    'TT-API-KEY': 'your_key'
  },
  data : {
    "base64" => "data:image/png;base64,xxx1",
    "model" => "fast",
    "hookUrl" => ""
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.status));
})
.catch(function (error) {
  console.log(error);
});

Example Response

{
  "status": "SUCCESS",
  "message": "",
  "data": {
    "jobId": "afa774a3-1aee-5aba-4510-14818d6875e4"
  }
}

Inpaint[ Vary(region) ]

POST https://api.ttapi.io/midjourney/v1/inpaint

Partial modifies of the image.

Headers

Name
Type
Description

TT-API-KEY

String

Your API Key in TT API used for request authorization

Content-Type

String

application-json

Request Body

Name
Type
Description

Jobid*

String

The jobId in prev request

mask*

String

base64 encoding of image

Eg: UklGRrw0AABXRUJQVlA4WAoAAAAgAAAA...

prompt

String

Drawing prompt for selected areas

timeout

int

Request timeout, unit: seconds. If not filled in, the default timeout is 300 seconds

hookUrl

String

Example Request

import requests

endpoint = "https://api.ttapi.io/midjourney/v1/inpaint"

headers = {
    "TT-API-KEY": your_key
}

data = {
    "jobId": "afa774a3-1aee-5aba-4510-14818d6875e4",
    "prompt": "white background",
    "mask": "UklGRrw0AABXRUJQVlA4WAoAAAAgAAAA..."
    "hookUrl": ""
}

response = requests.post(endpoint, headers=headers, json=data)

print(response.status_code)
print(response.json())
<?php

$url = 'https://api.ttapi.io/midjourney/v1/inpaint';

$data = array(
    "jobId" => "afa774a3-1aee-5aba-4510-14818d6875e4",
    "prompt" => "white background",
    "mask"   => "UklGRrw0AABXRUJQVlA4WAoAAAAgAAAA..."
    "hookUrl" => ""
);

$ch = curl_init($url);

$dataString = json_encode($data);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $dataString);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'TT-API-KEY: your_key'
);

$result = curl_exec($ch);

$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

curl_close($ch);

echo $httpCode;
const axios = require('axios');

let config = {
  method: 'post',
  url: 'https://api.ttapi.io/midjourney/v1/inpaint',
  headers: { 
    'TT-API-KEY': 'your_key'
  },
  data : {
     "jobId" => "afa774a3-1aee-5aba-4510-14818d6875e4",
    "prompt" => "white background",
    "mask"   => "UklGRrw0AABXRUJQVlA4WAoAAAAgAAAA..."
    "hookUrl" => ""
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.status));
})
.catch(function (error) {
  console.log(error);
});

Example Response

{
  "status": "SUCCESS",
  "message": "",
  "data": {
    "jobId": "afa774a3-1aee-5aba-4510-14818d6875e4"
  }
}

Fetch Job

GET https://api.ttapi.io/midjourney/v1/fetch

to fetch the job result

Headers

Name
Type
Description

TT-API-KEY

String

Your API Key in TT API used for request authorization

Request Body

Name
Type
Description

jobId*

String

f5850038-90a3-8a97-0476-107ea4b8dac4

Action Used In action endpoint

Async callback return json structure

{
    "status": "SUCCESS",
    "jobId": "f5850038-90a3-8a97-0476-107ea4b8dac4",
    "message": "success",
    "data": {
        "actions": "imagine",
        "jobId": "f5850038-90a3-8a97-0476-107ea4b8dac4",
        "progress": "100",
        "prompt": "Soccer star Max Kruse and Jan-Peter Jachtmann victims of €528,695 poker scam, German soccer star Max Kruse and WSOP Main Event finalist Jan-Peter Jachtmann are among the players who have been swindled out of €528,695., poker, realistic --ar 1280:720",
        "discordImage": "https://cdn.discordapp.com/attachments/1107938555931656214/1176340921227423844/voyagel_Soccer_star_Max_Kruse_and_Jan-Peter_Jachtmann_victims_o_c513a87b-eed3-4a3b-ab97-6be4dbc3ea99.png?ex=656e83da&is=655c0eda&hm=6e06a1dec3c6c1be209799884681969878eabb81ce81f8db22d54480379fcd9b&",
        "cdnImage": "http://127.0.0.1/8080/pics/452020f2-6793-4525-a1b5-472cac439610.png",
        "hookUrl": "",
        "components": [
            "upsample1",
            "upsample2",
            "upsample3",
            "upsample4",
            "variation1",
            "variation2",
            "variation3",
            "variation4"
        ],
        "seed":"",
        "images":[
            "https://cdnb.ttapi.io/2024-04-02/27024084bcd54b1c38d085d11d8dc841037a2262ebeda29b3f67b741441f6736.png",
            "https://cdnb.ttapi.io/2024-04-02/e15e39f6eb39191fdf3f176f8c979b6e57254114a8bfea826e30f23850d0d485.png",
            "https://cdnb.ttapi.io/2024-04-02/4b7910497a0d79d0155cd8b33eea313425cf2b809efef4b6ba3960aa1c2bd484.png",
            "https://cdnb.ttapi.io/2024-04-02/98b162a1da713eef23c3cfd5f166aee8e4ee09f8cf1f7bbc24bf72990eb80adf.png"
        ]
    }
}
{
    "status": "PENDING_QUEUE",
    "jobId": "f5850038-90a3-8a97-0476-107ea4b8dac4",
    "message": "",
    "data": []
}
{
    "status": "ON_QUEUE",
    "jobId": "f5850038-90a3-8a97-0476-107ea4b8dac4",
    "message": "",
    "data": {
        "actions": "imagine",
        "jobId": "f5850038-90a3-8a97-0476-107ea4b8dac4",
        "progress": "100",
        "prompt": "Soccer star Max Kruse and Jan-Peter Jachtmann victims of €528,695 poker scam, German soccer star Max Kruse and WSOP Main Event finalist Jan-Peter Jachtmann are among the players who have been swindled out of €528,695., poker, realistic --ar 1280:720",
        "discordImage": "https://cdn.discordapp.com/attachments/1107938555931656214/1176340921227423844/voyagel_Soccer_star_Max_Kruse_and_Jan-Peter_Jachtmann_victims_o_c513a87b-eed3-4a3b-ab97-6be4dbc3ea99.png?ex=656e83da&is=655c0eda&hm=6e06a1dec3c6c1be209799884681969878eabb81ce81f8db22d54480379fcd9b&",
        "cdnImage": "http://127.0.0.1/8080/pics/452020f2-6793-4525-a1b5-472cac439610.png",
        "hookUrl": "",
        "components": [],
        "seed":null,
        "images":null
    }
}
{
    "status": "FAILED",
    "jobId": "f5850038-90a3-8a97-0476-107ea4b8dac4",
    "message": "failed",
    "data": []
}

Starting from December 1, 2023, the cdn image link returned by discord will expire after 24 hours.

Return body enumeration details

name
value

status

PENDING_QUEUE

ON_QUEUE

SUCCESS FAILED

progess

Completeness : 0-100

components

discordImage

Discord cdn image url

images

CDN address of TTAPI, four small pictures generated by the imagine command. This field is only valid with the imagine command, and the address will never be invalid.

Send a request to the address for task completion or failed notification. If not set you need to request to get response

The task mode for generating images, including . If not filled in, the fast mode will be used by default.

If hookUrl is not null, it will be callback to your setting hookUrl

This endpoint contains used in TT Api. Eg: U1~U4, V1~V4 ...

Eg:upsample1 means U1

Send a request to the address for task completion or failed notification. If not set you need to request to get response

If hookUrl is not null, it will be callback to your setting hookUrl

Get the seeds form midjourney image, refer to the for usage

Send a request to the address for task completion or failed notification. If not set you need to request to get response

Send a request to the address for task completion or failed notification. If not set you need to request to get response

The task mode for generating images, including . If not filled in, the fast mode will be used by default.

Send a request to the address for task completion or failed notification. If not set you need to request to get response

The task mode for generating images, including . If not filled in, the fast mode will be used by default.

Send a request to the address for task completion or failed notification. If not set you need to request to get response

the result same as

For specific usage of related operations, you can read in detail.

name
description
exp in midjourney

upsample1

Button UI - U4

Same as upsample2, upsample3, upsample4

variation1

Button V1 - V4

Same as variation2, variation3, variation4

high_variation

Button Vary (Strong) Make drastic changes to your image

low_variation

Button Vary (Subtle) Make small changes to the image

upscale2

Button Upscale(2x)

Image magnification 2 times, only exists in v5 mode

upscale4

Button Upscale(4x)

Image magnification 4 times, only exists in v5 mode

zoom_out_2

Button Zoom Out 2x

The Zoom Out option expands the canvas of the enlarged image without changing the original image, filling the new space based on the prompt and the initial image.

zoom_out_1_5

Button Zoom Out 1.5x

The Zoom Out option expands the canvas of the enlarged image without changing the original image, filling the new space based on the prompt and the initial image.

pan_left

Button ⬅️➡️⬆️⬇️ Same as pan_right, pan_up, pan_down

upscale_creative

Button Upscale(Creative) Only exists in v6 mode

upscale_subtle

Button Upscale(Subtle)

Only exists in v6 mode

🔥
contact us
midjourney's docs
Midjourney’s official doc
a json response
method
a json response
hookUrl result
fetch endpoint
Action you need
For more please refer to
fetch endpoint
fetch endpoint
fetch endpoint
fetch endpoint
fetch endpoint
Support Next Actions
fast, relax and turbo
fast, relax and turbo
fast, relax and turbo
upsample
variation
high_variation
low_variation
upscale2
upscale4
zoom_out_2
zoom_out_1_5
pan
upscale_creative.png
upscale_subtle.png
upsample
variation
high_variation
low_variation
upscale2
upscale4
zoom_out_2
zoom_out_1_5
pan
upscale_creative.png
upscale_subtle.png