API v1

Upload assets

Register an asset, wait until it is active, then reference it with asset:// in generation requests.

View Markdown
On this page

An asset is an image, video or audio file registered with the platform. Register it once and reference it in as many generation requests as you like.

When to use assets

An image, video or audio input of a generation request comes from one of three sources: an HTTPS link, a base64 data URI or a registered asset. Registering pays off when you use the same file again and again; for a single use, put the link in the request. The rules of each source are on Generate a video.

Register an asset

Send the public HTTPS address, the media type and the model to POST /v1/assets. Registration needs an Idempotency-Key, and the API key needs service.use permission.

IDEMPOTENCY_KEY=${IDEMPOTENCY_KEY:-$(uuidgen)}
printf '%s\n' "Save IDEMPOTENCY_KEY for retries: ${IDEMPOTENCY_KEY}" >&2
curl --request POST "${CHENVOYA_BASE_URL}/v1/assets" \
  --header "Authorization: Bearer ${CHENVOYA_API_KEY}" \
  --header "Idempotency-Key: ${IDEMPOTENCY_KEY}" \
  --header 'Content-Type: application/json' \
  --data '{
  "url": "https://images.example.test/reference.png",
  "media_type": "image",
  "model": "dreamina-seedance-2-0-260128",
  "name": "reference"
}'

After acceptance the platform downloads and checks the file in the background; the Location response header is the path to read.

Response202
{
  "asset_id": "ast-11111111111111111111111111111111",
  "status": "processing"
}

Read the status

Read GET /v1/assets/{asset_id} until the status is no longer processing:

StatusMeaning
processingBeing downloaded and checked; it cannot be referenced yet.
activeReady to reference; size and digest are returned, with the dimensions of images and videos and the duration of audio and video.
unavailableCannot be used; failure_reason says why.
curl --request GET "${CHENVOYA_BASE_URL}/v1/assets/${ASSET_ID}" \
  --header "Authorization: Bearer ${CHENVOYA_API_KEY}"

Reference an asset

Write asset:// and the asset ID in the url of an image_url, video_url or audio_url item. An asset registered for one model can also be used by requests for other compatible models.

  • Referencing an asset that is still processing returns 409 asset_not_ready; once it is active, retry with the same Idempotency-Key.
  • An asset of another team, an unknown one and a deleted one all return asset_not_found.
  • One request cannot mix asset:// references with HTTPS links or base64 data.

Addresses and allowances

  • The source must be a public HTTPS address of at most 2048 bytes without user information; an unsafe destination returns 400 source_url_not_allowed.
  • When your team's storage allowance is used up the answer is 429 asset_storage_quota_exceeded; when intake capacity is limited it is 429 asset_intake_rate_limit_exceeded: retry later.

Next steps