- Get Started
- Endpoints
- Song(Suno+Udio)
- Kling
- Hailuo
- Flux
- AI Hug
- LLM
- Midjourney
- Faceswap
- TTS
- Trellis
- Luma Dream Machine
- WanX
- Skyreels
- Hunyuan Video
- Mmaudio
- DiffRhythm
- Tools
- PiAPI Account Management
- Resources
- Legacy Documentation
Imagine
POST
https://api.piapi.ai/api/v1/task
/imagine
command from the offical Midjourney.Request
Header Params
x-api-key
string
required
Body Params application/json
model
enum<string>
required
Allowed value:
midjourney
task_type
enum<string>
required
Allowed value:
imagine
input
object
required
prompt
string
required
aspect_ratio
string
optional
Default:
1:1
process_mode
enum<string>
optional
Allowed values:
relaxfastturbo
skip_prompt_check
boolean
optional
Default:
false
config
object
optional
webhook_config
object
optional
service_mode
enum<string>
optional
the user chose on the workspace setting of your account.
public
means this task will be processed under PAYG mode.private
means this task will be processed under HYA mode.Allowed values:
publicprivate
Example
{
"model": "midjourney",
"task_type": "imagine",
"input": {
"prompt": "sint culpa voluptate",
"aspect_ratio": "1:1",
"process_mode": "turbo",
"skip_prompt_check": false
}
}
Request samples
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.piapi.ai/api/v1/task' \
--header 'x-api-key;' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "midjourney",
"task_type": "imagine",
"input": {
"prompt": "sint culpa voluptate",
"aspect_ratio": "1:1",
"process_mode": "turbo",
"skip_prompt_check": false
}
}'
Responses
🟢200Success
application/json
Body
code
integer
required
data
object
required
task_id
string
required
model
string
required
task_type
string
required
status
enum<string>
required
Allowed values:
CompletedProcessingPendingFailedStaged
input
object
required
output
object
required
meta
object
required
detail
null
required
logs
array [object]
required
error
object
required
message
string
required
Example
{
"code": 200,
"data": {
"task_id": "39631ce-xxxx-xxxx-xxxx-6de760cd2053",
"model": "midjourney",
"task_type": "imagine",
"status": "pending",
"config": {
"service_mode": "public",
"webhook_config": {
"endpoint": "",
"secret": ""
}
},
"input": {},
"output": {
"image_url": "",
"image_urls": null,
"temporary_image_urls": null,
"discord_image_url": "",
"actions": [],
"progress": 0,
"intermediate_image_urls": null
},
"meta": {},
"detail": null,
"logs": [],
"error": {
"code": 0,
"raw_message": "",
"message": "",
"detail": null
}
},
"message": "success"
}
Modified at 2025-01-29 10:34:17