Documentation
Cancel Job

Cancel Job

POST
https://api.mymidjourney.ai/api/v1/midjourney/button

The API simulates a Cancel Job button click on the Midjourney channel. This button only available when a generation is working in progress (progress < 100)

cancel job button

POST /api/v1/midjourney/button

Sample Request

{
  "messageId": "e57fb09d-25f0-49f7-8f0f-2e902ffe9fdd",
  "button": "Cancel Job"
}

Request Body

NameTypeRequired
messageIdstringtrue
buttonstringtrue
refstringfalse
webhookOverridestringfalse

messageId

Use the messageId returned from your previous generation process.

button

The button name should be Cancel Job

ref (optional)

You can optionally pass ref in your command - which can be used useful when using webhooks

webhookOverride (optional)

You can optionally pass webhookOverride that will route a response to a webhook of your choosing. Please note that using a webhook is completely optional. You are welcome to use the GET Message endpoint to retrieve responses. The webhook event payload is same as the Message endpoint response.

Sample Response

{
  "success": true,
  "createdAt": "2023-08-01T14:03:01.817Z"
}

Response Body

NameTypeDescription
successbooleana boolean value for the generation job creation status
createdAtstringtimestamp of the task creation
errorstringerror message if any

Examples

const axios = require("axios")
 
const config = {
  method: "post",
  url: "https://api.mymidjourney.ai/api/v1/midjourney/button",
  headers: {
    "Content-Type": "application/json",
    Authorization: "Bearer <your-token>",
  },
  data: {
    messageId: "e57fb09d-25f0-49f7-8f0f-2e902ffe9fdd",
    button: "Cancel Job",
  },
}
 
axios(config)
  .then(function (response) {
    console.log(JSON.stringify(response.data))
  })
  .catch(function (error) {
    console.log(error)
  })