Documentation
Image to Image

Image to Image

POST
https://api.imaginepro.ai/api/v1/midjourney/imagine

Generate image based on the provided image. The provided image URL needs to follow the followings:

  • Image prompts go at the front of a prompt.
  • Prompts must have only one image URL and text to work.
  • An image URL must be a direct link to an online image. If you don't know where to upload your image, you can use this tool (opens in a new tab) to upload your image to our server, and copy the image URL.
  • Your file should end in .png, .gif, .webp, .jpg, or .jpeg.
  • Please make sure the image is not huge, file size less than 1MB is recommended.

POST /api/v1/midjourney/imagine

Sample Request

{
  "prompt": "https://cdn.discordapp.com/attachments/123/123/123.png A little cat running on the grass"
}

Request Body

NameTypeRequiredRestrictionsDescription
promptstringtruenoneprompt to Midjourney
refstringfalsenonenone
webhookOverridestringfalsenonenone

prompt

In order to perform image to image requests, you can follow the following syntax in your imagine prompt:

"prompt": "<your-image-url> <your-prompt>"
ref (optional)

You can optionally pass ref in your command - which can be used useful when using webhooks You might want to do this to pass some simple metadata through to your webhook.

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,
  "messageId": "your-message-id",
  "createdAt": "2023-08-01T14:03:01.817Z"
}

Response Body

NameTypeDescription
successbooleana boolean value for the generation job creation status
messageIdstringthe messageId for querying the progress later
createdAtstringtimestamp of the task creation
errorstringerror message if any

Examples

const axios = require("axios")
 
const config = {
  method: "post",
  url: "https://api.imaginepro.ai/api/v1/midjourney/imagine",
  headers: {
    "Content-Type": "application/json",
    Authorization: "Bearer <your-token>",
  },
  data: {
    prompt: "<your-image-url> A little cat running on the grass",
  },
}
 
axios(config)
  .then(function (response) {
    console.log(JSON.stringify(response.data))
  })
  .catch(function (error) {
    console.log(error)
  })