MuseSpark
MuseSpark
API referenceAsync tasks

Create a task

/api/v1/openapi/task · POST

Required access: openapi_tools with task:write. Authentication.

POST
/api/v1/openapi/task

Authorization

headerAuthorizationBearer <token>

MuseSpark API key. Tasks accept a case-insensitive Bearer prefix; compatibility extraction requires Bearer with this casing.

Header Parameters

X-Idempotency-Key?string

Stable business request identity. Sets metadata.reference_id. Reuse only for identical intent. No fixed public retention guarantee.

Request Body

application/json
  1. body
type?string

Optional; inferred from public item projection when omitted. A supplied type must match.

item_key*string

First choice identifier. Precedence: item_key > model_key > model > model_id.

Length1 <= length
model_key?string

Second choice identifier.

Length1 <= length
model?string

Third choice identifier.

Length1 <= length
model_id?string

Fourth choice identifier.

Length1 <= length
prompt?string

Copied into parameters.prompt only when that key is absent.

parameters?

Model-specific parameters. Obtain the current schema from the model page.

metadata?

Business metadata. reference_id is stripped and replaced by X-Idempotency-Key. Capacity controls are server-managed.

Response Body

Success. MuseSpark success envelope.

application/json
  1. response
code*200
Value in200
msg*"success"
Value in"success"
data*
Example Request
curl -X POST 'https://api.musespark.ai/api/v1/openapi/task' \  -H 'Content-Type: application/json' \  -d '{  "item_key": "YOUR_ITEM_KEY",  "parameters": {    "prompt": "A paper city under soft morning light"  }}'
Example Response
{  "code": 200,  "msg": "success",  "data": {    "task_id": "736fde4d-9029-4915-8189-01353d6982cb",    "status": "string"  }}