⌘K

Spark Asset Create

spark_asset_create

Spark Asset Create is a SeaArt asset management API for creating individual media assets (images, videos, audio) and uploading them to the asset library.

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 string

Error code

message string

Detailed error message


output array

Asset creation results, only present when status is completed

content array

List of result content

type string

Content type

Value: text

url string

Empty string for this API

text string

JSON-encoded string. Parse it to obtain Result.Id (created asset ID) and ResponseMetadata


usage object

Usage statistics, only present when status is completed

cost string

Total cost in USD

discount number

Discount amount


metadata object

Metadata information