Docs
Midjourney API Webhook

Midjourney API Webhook

Using Webhooks for Task Result Reporting (Success/Failure)

GoAPI's Midjourney API Webhooks provide a powerful way to receive notifications about event changes in real time, without the need for polling. In the context of our API, you can make use of webhooks to receive updates about task results, whether they are successful or failed.


To enable webhook notifications, include the following fields in the request body:

{
   "webhook_endpoint": "http://example.com",
   "webhook_secret": "hello",
   "notify_progress": true
}

Below is a comparison example between Imagine + Fetch Implementation vs. Imagine + Webhook Implementation A screenshot showing webhook implementation comparison


Properties

  • webhook_endpoint: This is the URL to which the webhook notifications will be posted. The payload posted to this URL mirrors that of the JSON returned by the v2 version of the fetch API. The endpoint you specify must be a properly formatted URL, beginning with http:// or https:// and it must use a standard web port, either 80 or 443.
  • webhook_secret(optional): This is a user-defined secret string that user passes to GoAPI and GoAPI passes back to the users as part of the header of the webhook POST request as the x-webhook-secret, providing a way to verify that the incoming requests are genuine.
  • notify_progress(optional): Default value is false. By setting this to true, user will receive progress update webhooks for that task, meaning user will have to deal with more status and more than one webhook events for one single task. Check Optional Param for task progress related params.

Webhook Responses
The response should return a 200 HTTP status code for successful delivery. If our service receives any other code, it will consider the event as not acknowledged and will retry. See Midjourney Task Result for a detailed explaination.

Retrying
Remember that delivery of webhooks is not always guaranteed. If a webhook is not successfully received, our service will attempt to redeliver it up to 3 times, with increasing delay intervals between attempts.

Remember that while webhooks serve as a real-time notification, you can still use our polling method to check updates if needed.

Always ensure to secure your webhook endpoint and verify incoming requests using the x-webhook-secret header for enhanced security and authenticity of incoming data.


The following APIs are compatible with these two fields:

  • MJ API V2
    • Imagine
    • Upscale
    • Variation
    • Outpaint
    • Pan
    • Describe
    • Blend
    • Reroll
    • Seed