Zum Hauptinhalt springen
GET
/
v1
/
midjourney
/
{task_id}
curl --request GET \
  --url https://api.apimart.ai/v1/midjourney/task_01KV52C0TEJSYZMCG0NCS4YWKK \
  --header 'Authorization: Bearer <token>'
{
  "id": "task_01KV52C0TEJSYZMCG0NCS4YWKK",
  "status": "SUCCESS",
  "action": "IMAGINE",
  "progress": "100%",
  "grid_image_url": "https://cdn.apimart.ai/mj_xxxx.png",
  "image_urls": [
    "https://cdn.apimart.ai/mj_xxxx_0.png",
    "https://cdn.apimart.ai/mj_xxxx_1.png",
    "https://cdn.apimart.ai/mj_xxxx_2.png",
    "https://cdn.apimart.ai/mj_xxxx_3.png"
  ],
  "buttons": [
    {"customId": "MJ::JOB::upsample::1::abc123def456", "label": "U1"},
    {"customId": "MJ::JOB::variation::1::abc123def456", "label": "V1"}
  ],
  "prompt": "a beautiful sunset over mountains"
}
curl --request GET \
  --url https://api.apimart.ai/v1/midjourney/task_01KV52C0TEJSYZMCG0NCS4YWKK \
  --header 'Authorization: Bearer <token>'
{
  "id": "task_01KV52C0TEJSYZMCG0NCS4YWKK",
  "status": "SUCCESS",
  "action": "IMAGINE",
  "progress": "100%",
  "grid_image_url": "https://cdn.apimart.ai/mj_xxxx.png",
  "image_urls": [
    "https://cdn.apimart.ai/mj_xxxx_0.png",
    "https://cdn.apimart.ai/mj_xxxx_1.png",
    "https://cdn.apimart.ai/mj_xxxx_2.png",
    "https://cdn.apimart.ai/mj_xxxx_3.png"
  ],
  "buttons": [
    {"customId": "MJ::JOB::upsample::1::abc123def456", "label": "U1"},
    {"customId": "MJ::JOB::variation::1::abc123def456", "label": "V1"}
  ],
  "prompt": "a beautiful sunset over mountains"
}
Empfohlener Polling-Endpunkt:
GET /v1/tasks/{task_id}
Einheitliche Task-Status sind pending / processing / completed / failed; Ergebnisse stehen in result.images[].url. Verwenden Sie den MJ-Stil-Endpunkt, wenn Sie buttons[].customId für Folge-Aktionen benötigen:
GET /v1/midjourney/{task_id}

Statusfluss

SUBMITTED → IN_PROGRESS → SUCCESS
                        → FAILURE
                        → MODAL (siehe Inpaint)

Response-Beispiel

{
  "id": "task_01JWXXXX",
  "status": "SUCCESS",
  "action": "IMAGINE",
  "progress": "100%",
  "grid_image_url": "https://cdn.apimart.ai/mj_xxxx.png",
  "image_urls": [
    "https://cdn.apimart.ai/mj_xxxx_0.png",
    "https://cdn.apimart.ai/mj_xxxx_1.png",
    "https://cdn.apimart.ai/mj_xxxx_2.png",
    "https://cdn.apimart.ai/mj_xxxx_3.png"
  ],
  "buttons": [
    {"customId": "MJ::JOB::upsample::1::abc123def456", "label": "U1"},
    {"customId": "MJ::JOB::variation::1::abc123def456", "label": "V1"}
  ],
  "prompt": "a beautiful sunset over mountains"
}
grid_image_url ist das 2x2-Rasterbild; image_urls sind die vier zugeschnittenen Einzelbild-URLs.
Feldbenennungs-Fallstricke
  • /v1/tasks/{task_id} liefert einheitliche Status pending / processing / completed / failed.
  • /v1/midjourney/{task_id} liefert MJ-Stil-Felder wie grid_image_url, image_urls, buttons.
Zu buttons: Für die meisten Folge-Aktionen genügen index, direction oder zoom_ratio; der Dienst findet die passende customId. Schlägt das Auto-Matching fehl, übergeben Sie custom_id direkt.

Status-Übersicht

statusBedeutungEndzustand
NOT_STARTZeile erstellt, System noch nicht bestätigt (kurzzeitig)Nein
SUBMITTEDSystem akzeptiert, in der WarteschlangeNein
IN_PROGRESSSystem verarbeitetNein
MODALWartet auf /modal-Parameter (siehe Inpaint)Nein
SUCCESSFertig
FAILUREFehlgeschlagen → Auto-Erstattung (quota → 0, fail_reason enthält den Grund)

Hinweise zur Abfrage

  • Der Abfrage-Endpunkt wird nicht separat berechnet, halten Sie die Rate aber vernünftig (3–5s Polling empfohlen).
  • Ein normaler Nutzer kann nur eigene Aufgaben abfragen; fremde geben 403 zurück.
  • Aufgaben werden standardmäßig 3 Tage aufbewahrt; danach geben Abfragen 404 zurück, aber die generierten Bild- / Video-URLs bleiben erreichbar.

Fortgeschritten: Direkt mit custom_id operieren

Nachdem Sie buttons[].customId gelesen haben, können Sie es direkt an das custom_id-Feld der Folge-Aktionen übergeben und das Auto-Matching umgehen:
{
  "task_id": "task_01JWXXXX",
  "custom_id": "MJ::JOB::upsample::1::abc123def456"
}