API Notes
spark_asset_create requires a GroupId obtained from spark_asset_create_group. Omitting GroupId will result in error MissingParameter.GroupId
ProjectName must match an existing project. Passing a non-existent project name will result in error NotFound.ProjectName. Omit this parameter to use the default project
Authentication
authorization string required
All APIs require authentication via Bearer Token.
Get API Key:
Visit API Key Management Page to get your API Key.
Usage:
Add to request header:
Authorization: Bearer YOUR_API_KEY
Parameters
model string required
Model ID to use for the request
Value: spark_asset_create
Name string required
Asset name
Max length: 64 characters
URL string required
URL of the media file to upload
AssetType string required
Media type of the asset
Options: Image, Video, Audio
GroupId string required
Asset group ID the asset belongs to. Obtain this from spark_asset_create_group
ProjectName string
Project name. Omit this parameter to use the default project
Default: default
Polling
Since result generation takes time, you need to poll the task status after creating the task.
The initial response only returns information such as the task ID and initial status. The final result must be obtained by polling the task status endpoint using the task ID.
See the examples on the right for polling requests and responses.
Response Format
error object
Error information, only present when status is failed
code
stringError code
message
stringDetailed error message
output array
Asset creation results, only present when status is completed
content
arrayList of result content
type
stringContent type
Value:
texturl
stringEmpty string for this API
text
stringJSON-encoded string. Parse it to obtain
Result.Id(created asset ID) andResponseMetadata
usage object
Usage statistics, only present when status is completed
cost
stringTotal cost in USD
discount
numberDiscount amount
metadata object
Metadata information