Goal
Produce repeatable media derivatives whose cache identity includes the canonical definition, source bytes, overlay bytes, and processor revision.Prerequisites
- An asset in the same account
- An
assets:processtoken for transforms - A clean, ready source before durable materialization
Workflow
1
Build a version 2 definition with the source media kind, ordered operations, and one output.
2
Store it as a named preset when multiple assets use it; set
eager=true to materialize after the clean scan gate.3
POST the definition or preset to the asset transforms route. Supply exactly one, never both.
4
Poll the returned Assets job until it completes, then list derivatives and use only an
available output.Definition contract and bounds
versionis exactly2;media_kindisimageorvideo; operation order is significant.- A definition contains 1–24 operations. Output kinds are image, video, audio, or thumbnail.
- Final images are limited to 4096×4096 and 16,777,216 pixels. DPR is 0.5–4; blur sigma is greater than 0 and at most 100; output quality is 1–100 and defaults to 82 for image/thumbnail outputs.
- Background is
transparentor normalized 6/8-digit hex. Rotation is finite and normalized modulo 360. - Video FPS is 1–60. Trim end must exceed start. Trim and thumbnail timestamps are checked against probed source duration during processing.
- Image formats are JPEG, PNG, WebP, and AVIF; video is MP4; extracted audio is MP3, AAC, or WAV; thumbnails are JPEG, PNG, or WebP.
Timestamp thumbnail example
Presets, eager processing, and v1 compatibility
POST /assets/transformationscontinues to accept the legacy width/height/crop/format/quality fields and signed v1 specs.- For v2, send
name,definition, andeager. Stored presets exposedefinition_version,media_kind, normalized definition/spec,eager, andrevision. POST /assets/{assetID}/transformsaccepts{definition}or{preset}and returns an Assets job. If no idempotency key is supplied, the service derives one from asset ID, source checksum, and normalized spec.- For CLI
transform-run, the JSON passed to--fileis the complete request body: wrap a v2 definition as{ "definition": { ... } }, or use{ "preset": "name" }. GET /assets/{assetID}/derivativesreturns persisted output kind, MIME type, size, transform hash, dependency checksum, processor revision, and availability state.- The service invokes libvips/FFmpeg/ffprobe through context-bound argument arrays, strips metadata, normalizes color, and marks output deliverable only after durable persistence and replication.
Expected result
Identical source and transform dependencies collapse onto the same durable output, while any source, overlay, definition, or processor change produces a new identity.
Common failures
Related guides
Media Workflows visual builder and API
Author editable templates or blank typed DAGs that coordinate asset gates, native StackShift services, bounded Stackie reasoning, and approved external integrations.
Assets REST API reference
The routes, wire fields, response states, and concurrency rules shared by every official Assets SDK.
Video, scanning, and governance
Process video asynchronously, deliver HLS and posters, expose scan gates, quarantine unsafe assets, and enforce account policies.