Midjourney Imagine
Midjourney Imagine submits text-to-image tasks. Save the task ID, then query it for progress and results.
API Path
| Methodology | Path | Returns by |
|---|---|---|
POST | /mj/submit/imagine | Returns the result of task and continues to require inquiries. |
Example request
bash
curl https://moonnexai.com/mj/submit/imagine \
-H "Authorization: Bearer <MOONNEXAI_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A futuristic city at sunrise --ar 16:9",
"notifyHook": "https://example.com/moonnexai/webhook"
}'Common field
| field | Annotations |
|---|---|
prompt | Midjourney protocol and parameters. |
notifyHook | task status callback address. |
state | The business side custom pass field, which is based on API Reference. |
task Processing
| Phase | Treatment |
|---|---|
| Successful submission | Save task ID, prompt, user ID and business orders. |
| Task in progress | Show queued or generating status and let the user refresh. |
| task complete | Reads the final picture URL and saves the original query result. |
| task failed | Displays failed information, maintains the re-submittal portal. |
Access Recommendations
- Saves the task ID submitted in response as the primary key for subsequent queries.
- The user can display the state of queue, execution, completion, failure, etc.
- Retain a task-query entry point even when callbacks are configured, so users can refresh results.