Midjourney接口文档
Midjourney API ドキュメント
Section titled “Midjourney API ドキュメント”Midjourney 画像フォーマット(Midjourney Proxy/Midjourney Proxy Plus)
Section titled “Midjourney 画像フォーマット(Midjourney Proxy/Midjourney Proxy Plus)”:memo: 概要
Section titled “:memo: 概要”Midjourney は、自然言語による指示をもとに画像の生成・編集・加工ができる強力な画像生成モデルです。さまざまな API を使うことで、多様な画像生成・処理タスクを実現できます。
:arrows_counterclockwise: フロー図
Section titled “:arrows_counterclockwise: フロー図”
フローの説明
Section titled “フローの説明”- 初期タスク
- Imagine: テキストから画像を生成
- Blend: 複数画像のブレンド
- Describe: 画像の説明文生成
- Swap Face: 顔の入れ替え
- 画像処理
- U1-U4: 拡大操作
- V1-V4: バリエーション生成
- Pan: 画像の移動
- Zoom: 画像の拡大縮小
- 特殊フロー
- Action + Modal: ポップアップ確認が必要な操作
- Action 直接実行: ポップアップ不要の操作
- タスク管理
- タスク詳細の取得
- 画像 Seed の取得
- Discord へのアップロード
:bulb: リクエスト例
Section titled “:bulb: リクエスト例”Imagine タスクの送信 :check_mark_button:
Section titled “Imagine タスクの送信 :check_mark_button:”curl --location --request POST 'https://api.4allapi.com/mj/submit/imagine' \--header 'Authorization: Bearer $API_KEY' \--header 'Accept: application/json' \--header 'Content-Type: application/json' \--data-raw '{ "botType": "MID_JOURNEY", "prompt": "Cat", "base64Array": [], "accountFilter": { "channelId": "", "instanceId": "", "modes": [], "remark": "", "remix": true, "remixAutoConsidered": true }, "notifyHook": "", "state": ""}'レスポンス例:
{ "code": 1, "description": "提交成功", "properties": {}, "result": 1320098173412546}Blend タスクの送信 :check_mark_button:
Section titled “Blend タスクの送信 :check_mark_button:”curl --location --request POST 'https://api.4allapi.com/mj/submit/blend' \--header 'Authorization: Bearer $API_KEY' \--header 'Accept: application/json' \--header 'Content-Type: application/json' \--data-raw '{ "botType": "MID_JOURNEY", "base64Array": [ "data:image/png;base64,xxx1", "data:image/png;base64,xxx2" ], "dimensions": "SQUARE", "accountFilter": { "channelId": "", "instanceId": "", "modes": [], "remark": "", "remix": true, "remixAutoConsidered": true }, "notifyHook": "", "state": ""}'レスポンス例:
{ "code": 1, "description": "提交成功", "properties": {}, "result": 1320098173412546}Describe タスクの送信 :check_mark_button:
Section titled “Describe タスクの送信 :check_mark_button:”curl --location --request POST 'https://api.4allapi.com/mj/submit/describe' \--header 'Authorization: Bearer $API_KEY' \--header 'Accept: application/json' \--header 'Content-Type: application/json' \--data-raw '{ "botType": "MID_JOURNEY", "base64": "data:image/png;base64,xxx", "accountFilter": { "channelId": "", "instanceId": "", "modes": [], "remark": "", "remix": true, "remixAutoConsidered": true }, "notifyHook": "", "state": ""}'レスポンス例:
{ "code": 1, "description": "提交成功", "properties": {}, "result": 1320098173412546}Modal の送信 :check_mark_button:
Section titled “Modal の送信 :check_mark_button:”curl --location --request POST 'https://api.4allapi.com/mj/submit/modal' \--header 'Authorization: Bearer $API_KEY' \--header 'Accept: application/json' \--header 'Content-Type: application/json' \--data-raw '{ "maskBase64": "", "prompt": "", "taskId": "14001934816969359"}'レスポンス例:
{ "code": 1, "description": "提交成功", "properties": {}, "result": 1320098173412546}swap_face タスクの送信 :check_mark_button:
Section titled “swap_face タスクの送信 :check_mark_button:”curl --location --request POST 'https://api.4allapi.com/mj/insight-face/swap' \--header 'Authorization: Bearer $API_KEY' \--header 'Accept: application/json' \--header 'Content-Type: application/json' \--data-raw '{ "sourceBase64": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBwgHBgkIBwgKCgkLDRYPDQwMDRsUFRAWIB0iIiAdHx8kKDQsJCYxJx8fLT0tMTU3Ojo6Iys/RDnYdriP1wsS81kwU8OVs/R3xu8s6bX7+zYnOH8coSqpmRSBjqerjcBlr2OB/lbAf/2Q==", "targetBase64": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBwgHBgkIBwgKCgkLDRYPDQwMDRsUFRAWIB0iIiAdHx8kKDQsJCYxJx8fLT0tMTU3Ojo6Iys/RD849k="}'レスポンス例:
{ "code": 0, "description": "string", "result": "string"}Action の実行 :check_mark_button:
Section titled “Action の実行 :check_mark_button:”curl --location --request POST 'https://api.4allapi.com/mj/submit/action' \--header 'Authorization: Bearer $API_KEY' \--header 'Accept: application/json' \--header 'Content-Type: application/json' \--data-raw '{ "chooseSameChannel": true, "customId": "MJ::JOB::upsample::1::82c51c9d-bc33-4c07-a471-36c3dcb1a6f0", "taskId": "1728781324658687", "accountFilter": { "channelId": "", "instanceId": "", "modes": [], "remark": "", "remix": true, "remixAutoConsidered": true }, "notifyHook": "", "state": ""}'レスポンス例:
{ "code": 1, "description": "提交成功", "properties": {}, "result": 1320098173412546}ファイルを discord にアップロード :check_mark_button:
Section titled “ファイルを discord にアップロード :check_mark_button:”curl --location --request POST 'https://api.4allapi.com/mj/submit/upload-discord-images' \--header 'Authorization: Bearer $API_KEY' \--header 'Accept: application/json' \--header 'Content-Type: application/json' \--data-raw '{ "base64Array": [], "filter": { "channelId": "", "instanceId": "", "remark": "" }}'レスポンス例:
{ "code": 0, "description": "string", "result": [ "string" ]}ID リストに基づいてタスクを照会 :check_mark_button:
Section titled “ID リストに基づいてタスクを照会 :check_mark_button:”curl --location --request POST 'https://api.4allapi.com/mj/task/list-by-condition' \--header 'Accept: application/json' \--header 'Authorization: Bearer $API_KEY' \--header 'Content-Type: application/json' \--data-raw '{ "ids": []}'レスポンス例:
[ { "action": "IMAGINE", "buttons": [ { "customId": "string", "emoji": "string", "label": "string", "style": 0, "type": 0 } ], "description": "string", "failReason": "string", "finishTime": 0, "id": "string", "imageUrl": "string", "progress": "string", "prompt": "string", "promptEn": "string", "properties": {}, "startTime": 0, "state": "string", "status": "NOT_START", "submitTime": 0 }]指定 ID でタスクを取得 :check_mark_button:
Section titled “指定 ID でタスクを取得 :check_mark_button:”curl --location --request GET 'https://api.4allapi.com/mj/task/{id}/fetch' \--header 'Accept: application/json' \--header 'Authorization: Bearer $API_KEY' \--header 'Content-Type: application/json'レスポンス例:
{ "action": "IMAGINE", "buttons": [ { "customId": "string", "emoji": "string", "label": "string", "style": 0, "type": 0 } ], "description": "string", "failReason": "string", "finishTime": 0, "id": "string", "imageUrl": "string", "progress": "string", "prompt": "string", "promptEn": "string", "properties": {}, "startTime": 0, "state": "string", "status": "NOT_START", "submitTime": 0}タスク画像の seed を取得 :check_mark_button:
Section titled “タスク画像の seed を取得 :check_mark_button:”curl --location --request GET 'https://api.4allapi.com/mj/task/{id}/image-seed' \--header 'Accept: application/json' \--header 'Authorization: Bearer $API_KEY' \--header 'Content-Type: application/json'レスポンス例:
{ "code": 0, "description": "string", "result": "string"}:postbox: リクエスト
Section titled “:postbox: リクエスト”エンドポイント
Section titled “エンドポイント”Imagine タスクの送信
Section titled “Imagine タスクの送信”POST /mj/submit/imagineテキストプロンプトに基づいて画像を生成します。
Blend タスクの送信
Section titled “Blend タスクの送信”POST /mj/submit/blend複数の入力画像をブレンドして新しい画像を生成します。
Describe タスクの送信
Section titled “Describe タスクの送信”POST /mj/submit/describe入力画像からテキスト説明を生成します。
Modal の送信
Section titled “Modal の送信”POST /mj/submit/modal画像生成の詳細を調整するためのモーダル情報を送信します。
swap_face タスクの送信
Section titled “swap_face タスクの送信”POST /mj/insight-face/swap元画像と対象画像を使って顔を入れ替えます。
Action の実行
Section titled “Action の実行”POST /mj/submit/action生成済み画像に対して、拡大や調整などの後続操作を行います。
ファイルを discord にアップロード
Section titled “ファイルを discord にアップロード”POST /mj/submit/upload-discord-images画像を discord にアップロードします。
ID リストに基づいてタスクを照会
Section titled “ID リストに基づいてタスクを照会”POST /mj/task/list-by-condition指定したタスク ID の一覧に基づいて、タスク詳細を取得します。
指定 ID でタスクを取得
Section titled “指定 ID でタスクを取得”GET /mj/task/{id}/fetchタスク ID に基づいてタスク詳細を取得します。
タスク画像の seed を取得
Section titled “タスク画像の seed を取得”GET /mj/task/{id}/image-seed指定タスクで生成された画像の seed 値を取得します。
リクエストヘッダーに以下を含めて API キー認証を行います。
Authorization: Bearer $API_KEYここでの $API_KEY は、あなたの API キーです。
リクエストボディのパラメータ
Section titled “リクエストボディのパラメータ”Imagine タスクの送信
Section titled “Imagine タスクの送信”botType
Section titled “botType”- 種類: 列挙型文字列
- 必須: いいえ
- デフォルト値: MID_JOURNEY
- 選択肢:
MID_JOURNEY: Midjourney モデルNIJI_JOURNEY: Niji Journey モデル
- 説明: 使用する bot の種類を選択します
prompt
Section titled “prompt”- 種類: 文字列
- 必須: はい
- 説明: 画像生成用のテキストプロンプト
- 補足:
- 明確で具体的な説明を使用してください
- アートスタイルや構図などの詳細も含められます
- 英語と中国語の入力に対応しています
base64Array
Section titled “base64Array”- 種類: 文字列配列
- 必須: いいえ
- 説明: 参考画像の base64 エンコード配列
- 形式: 各要素は MIME タイプのプレフィックスを含む完全な base64 画像文字列である必要があります
accountFilter
Section titled “accountFilter”- 種類: オブジェクト
- 必須: いいえ
- 属性:
channelId: チャンネル IDinstanceId: アカウントインスタンス IDmodes: アカウントモード配列。選択肢は RELAX、FAST、TURBOremark: 備考に含まれる内容remix: アカウントが remix をサポートしているかremixAutoConsidered: remix の自動送信設定
notifyHook
Section titled “notifyHook”- 種類: 文字列
- 必須: いいえ
- 説明: タスク完了後のコールバック URL。空の場合はグローバル notifyHook を使用します
- 種類: 文字列
- 必須: いいえ
- 説明: カスタム状態パラメータ。リクエスト追跡に使用できます
Blend タスクの送信
Section titled “Blend タスクの送信”base64Array
Section titled “base64Array”- 種類: 文字列配列
- 必須: はい
- 説明: ブレンドする画像の base64 エンコード配列
- 形式: 2〜5 枚の画像の base64 文字列を含める必要があります
dimensions
Section titled “dimensions”- 種類: 列挙型文字列
- 必須: いいえ
- 選択肢:
PORTRAIT: 2:3 比率SQUARE: 1:1 比率LANDSCAPE: 3:2 比率
- 説明: 出力画像の縦横比設定
Describe タスクの送信
Section titled “Describe タスクの送信”base64
Section titled “base64”- 種類: 文字列
- 必須: はい
- 説明: 説明対象の画像の base64 エンコード
- 形式: MIME タイプのプレフィックスを含む完全な base64 文字列
Modal タスクの送信
Section titled “Modal タスクの送信”maskBase64
Section titled “maskBase64”- 種類: 文字列
- 必須: いいえ
- 説明: 部分再描画用マスク画像の base64 エンコード
prompt
Section titled “prompt”- 種類: 文字列
- 必須: いいえ
- 説明: 再描画領域のテキストプロンプト
taskId
Section titled “taskId”- 種類: 文字列
- 必須: はい
- 説明: 元のタスクの ID
Swap Face タスクの送信
Section titled “Swap Face タスクの送信”sourceBase64
Section titled “sourceBase64”- 種類: 文字列
- 必須: はい
- 説明: 顔の元画像の base64 エンコード
- 要件: 画像にははっきりとした顔が含まれている必要があります
targetBase64
Section titled “targetBase64”- 種類: 文字列
- 必須: はい
- 説明: 対象画像の base64 エンコード
- 要件: 置き換える顔が含まれている必要があります
Action の実行
Section titled “Action の実行”chooseSameChannel
Section titled “chooseSameChannel”- 種類: 真偽値
- 必須: いいえ
- デフォルト値: false
- 説明: 同一チャンネルのアカウントを選択するかどうか
customId
Section titled “customId”- 種類: 文字列
- 必須: はい
- 説明: アクション識別子
- 形式:
"MJ::JOB::upsample::1::xxx"のような特定形式の文字列
taskId
Section titled “taskId”- 種類: 文字列
- 必須: はい
- 説明: アクションを実行するタスク ID
Discord へのファイルアップロード
Section titled “Discord へのファイルアップロード”base64Array
Section titled “base64Array”- 種類: 文字列配列
- 必須: はい
- 説明: アップロードする画像の base64 エンコード配列
filter
Section titled “filter”- 種類: オブジェクト
- 必須: いいえ
- 属性:
channelId: 対象チャンネル IDinstanceId: アカウントインスタンス IDremark: 備考情報
ID リストに基づいてタスクを照会
Section titled “ID リストに基づいてタスクを照会”- 種類: 文字列配列
- 必須: はい
- 説明: 照会したいタスク ID の一覧
共通レスポンス形式
Section titled “共通レスポンス形式”すべての API は、似た形式のレスポンスを返します。
- 種類: 整数
- 説明: ステータスコード
| ステータスコード | 説明 |
|---|---|
| 1 | 送信成功 |
| 22 | タスクをキュー待機中 |
| 21 | パラメータエラー |
| 23 | システムエラー |
| 24 | アカウント利用不可 |
| 25 | 残高不足 |
description
Section titled “description”- 種類: 文字列
- 説明: レスポンスの説明情報
properties
Section titled “properties”- 種類: オブジェクト
- 説明: 拡張属性
result
Section titled “result”- 種類: 文字列または配列
- 説明: 返却結果。タスク ID またはその他のデータが入る場合があります
:inbox_tray: レスポンス
Section titled “:inbox_tray: レスポンス”成功レスポンス
Section titled “成功レスポンス”action
Section titled “action”- 種類: 列挙型文字列
- 説明: タスク種別
| 文字列値 | 説明 |
|---|---|
IMAGINE | 画像を生成 |
UPSCALE | 画像を拡大 |
VARIATION | バリエーション生成 |
ZOOM | 画像をズーム |
PAN | 画像を移動 |
DESCRIBE | 画像を説明 |
BLEND | 画像をブレンド |
SHORTEN | プロンプトを短縮 |
SWAP_FACE | 顔を置換 |
buttons
Section titled “buttons”- 種類: オブジェクト配列
- 説明: 実行可能な操作ボタン
| 配列に含まれる属性 | 説明 |
|---|---|
customId | アクション識別子 |
emoji | ボタンアイコン |
label | ボタンテキスト |
style | スタイル(2=Primary, 3=Green) |
type | システム内部で使用される型 |
description
Section titled “description”- 種類: 文字列
- 説明: タスクの説明情報
failReason
Section titled “failReason”- 種類: 文字列
- 説明: タスク失敗の理由
finishTime
Section titled “finishTime”- 種類: 整数
- 説明: タスク完了時刻のタイムスタンプ
- 種類: 文字列
- 説明: タスクの一意識別子
imageUrl
Section titled “imageUrl”- 種類: 文字列
- 説明: 生成画像の URL
progress
Section titled “progress”- 種類: 文字列
- 説明: タスクの進捗情報
prompt
Section titled “prompt”- 種類: 文字列
- 説明: 元のプロンプト
promptEn
Section titled “promptEn”- 種類: 文字列
- 説明: 英語のプロンプト
status
Section titled “status”- 種類: 列挙型文字列
- 説明: タスク状態
| 文字列値 | 説明 |
|---|---|
NOT_START | 未開始 |
SUBMITTED | 送信済み |
MODAL | モーダル操作中 |
IN_PROGRESS | 進行中 |
FAILURE | 失敗 |
SUCCESS | 成功 |
CANCEL | キャンセル済み |
submitTime
Section titled “submitTime”- 種類: 整数
- 説明: タスク送信時刻のタイムスタンプ
startTime
Section titled “startTime”- 種類: 整数
- 説明: タスク実行開始時刻のタイムスタンプ
エラーレスポンス
Section titled “エラーレスポンス”リクエストに問題がある場合、API はエラーレスポンスを返します。
HTTP ステータスコード
Section titled “HTTP ステータスコード”400 Bad Request: リクエストパラメータが無効401 Unauthorized: API キーが無効、または未指定403 Forbidden: 権限不足404 Not Found: リソースが存在しない429 Too Many Requests: リクエスト頻度超過500 Internal Server Error: サーバー内部エラー
エラーレスポンス形式
Section titled “エラーレスポンス形式”{ "code": <错误码>, "description": "错误描述信息", "result": null}