Imagine
POST
https://api.imaginepro.ai/api/v1/midjourney/imagine
The core API to generate your image.
POST /api/v1/midjourney/imagine
Sample Request
{
"prompt": "A little cat running on the grass"
}
Request Body
Name | Type | Required |
---|---|---|
prompt | string | true |
ref | string | false |
webhookOverride | string | false |
prompt
You can also include an image URL in the prompt
attribute, same like you using Midjourney in Discord. For example:
{
"prompt": "https://cdn.discordapp.com/attachments/123/123/123.png A little cat running on the grass"
}
This will perform image to image generation. You can also include flags such as the --v 5 parameter.
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
Name | Type | Description |
---|---|---|
success | boolean | a boolean value for the generation job creation status |
messageId | string | the messageId for querying the progress later |
createdAt | string | timestamp of the task creation |
error | string | error 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: "A little cat running on the grass",
},
}
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data))
})
.catch(function (error) {
console.log(error)
})