⌘K

Spark Asset Get Intl

spark_asset_get_intl

Query an international asset and return its status and download URL once it is ready.

API Notes

spark_asset_get_intl creates a platform task through the unified generation API; model parameters belong in input[0].params

spark_asset_get_intl returns type: "text" content with a JSON-encoded text string; parse it to read Result

spark_asset_get_intl uses international asset resources; use the international models for subsequent operations and do not assume domestic and international IDs are interchangeable

spark_asset_get_intl uses the Id returned by asset creation; the wrapper completes successfully after the asset reaches Active and fails if it reaches Failed

spark_asset_get_intl returns the download address in the parsed Result.URL; output[].content[].url is an empty string

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

Customer-facing model ID

Value: spark_asset_get_intl


input array required

Provide one object containing params; all parameters below belong in input[0].params


Id string required

Parse the task result from spark_asset_create_intl and use Result.Id, not the platform task ID returned during creation


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.

A create response with status: "completed" only indicates that creation completed. Use the returned id to query the same platform task, and parse results when the task query returns completed with output

Task query statusAction
in_progressContinue querying the same task_id
completedParse the result’s text
failedRead error.code and error.message

Response Format

The success example on the right shows relevant fields only; actual results may include additional metadata. text remains a JSON-encoded string and must not be read as an already parsed object

FieldTypeDescription
idstringPlatform task ID used for task queries
output[].content[].typestringtext
output[].content[].textstringJSON-encoded string; parse to access Result
output[].content[].urlstringEmpty string, not an asset download URL
usage.coststringCost in USD, currently 0
errorobjectError details when a task fails
metadataobjectTask timing and other metadata, when returned

Parse the result

const content = task.output.flatMap(item => item.content ?? [])
  .find(item => item.type === "text");
const result = JSON.parse(content.text).Result;
const assetId = result.Id;
const status = result.Status;
const downloadURL = result.URL;
Result fieldDescription
IdAsset ID
GroupIdAsset group ID
NameAsset name
AssetTypeMedia type
StatusActive indicates readiness
URLSigned download URL with an expiration time, not a permanent link
ProjectNameProject name
CreateTime, UpdateTimeCreation and update times, when returned

Result.URL is not materialized into platform image storage. Download promptly and do not treat it as a permanent address. If it expires, submit a new asset-query request to obtain the currently returned URL

Complete Workflow

Create group → Create asset → Query asset

Use a platform task_id to query its task, the group’s Result.Id as GroupId, and the asset’s Result.Id as the asset query’s Id; these identifiers are not interchangeable

Pricing

This asset model is currently free, with usage.cost: "0" in successful responses. Group creation, asset creation, and asset queries are all free; subsequent image or video generation has separate pricing

Error Handling

Read error.code and error.message for failed tasks. Check parameters, URL accessibility, and asset or group IDs; the wrapper does not guarantee the underlying API’s specific error code. Use the same international asset models throughout the default-project workflow

Illustrative failure for an invalid asset ID, showing relevant fields only:

{
  "id": "task_id",
  "created_at": 1791511200000,
  "status": "failed",
  "model": "spark_asset_get_intl",
  "error": {
    "code": "RUNTIME_CREATE_PROVIDER_FAILED",
    "message": "provider async create failed: http_status=400"
  }
}