Goal
Build the same governed media workflows in your application’s backend language.Prerequisites
- A server-side StackShift API key and the scopes required by the workflow.
- The asset-space ID selected for the acting account. An empty space ID selects the owner’s space.
Workflow
1
Install the SDK for your application language.
2
Create a backend client and select the asset space.
3
Use the language examples in the feature guides for processing, publication and delivery.
4
Keep revisions, idempotency keys and temporary playback credentials attached to the operation they identify.
Install the SDK
Initialize and select an asset space
These examples run on your backend. STACKSHIFT_API_KEY and STACKSHIFT_ASSET_SPACE_ID are application environment variables read by the examples; the selected space is sent as X-Asset-Space-ID. Changing this header does not grant membership or bypass collection permissions. Keep account keys out of browser bundles. JavaScript applies assetSpaceId to its Assets requests. Go DAM(spaceID)/Video(spaceID), Python dam.for_space(space_id)/video.for_space(space_id), and PHP dam(spaceId) return scoped media clients. They do not mutate other clients or the scope of existing upload/library calls. Use the scoped clients consistently within the DAM/video workflow.Method reference
The table lists equivalent operations. Go calls take context.Context first. Payload field names match the JSON API in every language. All clients unwrap the success/data envelope. Go uses typed schema, publication, gallery and rendering responses; other object responses are map[string]any, and captions return []map[string]any. Python returns dictionaries/lists, PHP associative arrays, and JavaScript uses the exported SDK types. For paginated lists, JavaScript publications accepts an options object and galleries accepts a cursor string. Go Publications/Galleries accept url.Values, Python publications/galleries accept a query dictionary, and PHP publications/galleries accept an associative query array. Preview helpers use the authorized preview route; they do not publish content.Revisions and idempotency
Update and transition methods accept the last returned revision and send a quoted If-Match header. Read the returned object after each edit or transition and use its new revision. If a request conflicts with another edit, fetch and reconcile the latest state before retrying. Do not automatically replay approval against a different snapshot. processModel/ProcessModel/process_model and renderProduct/RenderProduct/render_product accept an idempotency key. Reuse the key for retries of the same operation. For rendering, estimate the exact version/checksum/recipe/outputs, obtain acceptance of those units, and pass that maximum to submission. A new user decision or changed input is a different operation. Python and PHP accept JSON-shaped inputs. Go inputs use map[string]any; retain JSON booleans/numbers/lists rather than turning them into strings. An empty list and false/0 can carry an intentional policy or rendering value and are transmitted unchanged.Video sessions and CMS responses
Create playback sessions with the account-authorized video client. RenewSession/renew_session/renewSession and Events/events use only the playback credential and the /playback path on the configured API origin; they do not send the account key or asset-space header. Keep renewal tied to the authorized viewer and asset and propagate access denials instead of retrying with an account key. Authorize the viewer and the application’s saved publication/gallery ID before calling a resolver. Return the unwrapped delivery object from your backend with Cache-Control: private, no-store. Picker callbacks return {token}; video callbacks return the playback grant; gallery/publication callbacks return the corresponding delivery object. See each integration guide for its exact callback contract.Handle errors without losing the current media
Management failures propagate to the caller. In JavaScript inspect StackShiftAPIError; in Go use errors.As with *stackshift.APIError; in Python catch StackShiftAPIError from stackshift.client; in PHP catch RuntimeException. Preserve a previous valid publication while replacement processing runs. Do not retry authentication failures or revision conflicts blindly. Reconcile the current authorization or revision first. Poll the returned job/package/render-set state after acceptance: a successful submission response identifies queued work, not completed media. Configure the application’s HTTP timeout and cancellation policy; Go accepts a custom HTTPClient and every operation takes a context.HTTP errors and safe retries
Handle the SDK exception/error before reading a response object. Preserve the HTTP status and machine-readable error code when your application transport exposes them. Return safe user-facing text from your backend and keep credentials and signed URLs out of diagnostics.Expected result
Your backend uses the selected language SDK for the same authorized media lifecycle, and browser embeds receive only bounded capabilities or delivery grants.
Common failures
Related guides
Library, spaces, collections and sharing
Find and organize media, switch Assets spaces, invite collaborators with explicit permissions, and handle access changes safely.
Typed metadata and bucket governance
Create and publish metadata schemas, bind exact revisions to buckets, validate asset fields, and migrate existing delivery into governance.
Publications, review and usage rights
Select immutable renditions, capture metadata and rights, submit editorial review, publish by channel, and withdraw delivery.
Embed the headless asset picker
Add JavaScript or React media selection using expiring capabilities, save stable references, and resolve approved media from your backend.
Native video processing and secure playback
Version-pinned video packages, scan and review gates, replacement behavior, playback sessions, API routes, and failure recovery.
Upload, validate and publish 3D models
Prepare supported GLB and supplied USDZ files, inspect validation reports, add posters, review the model and launch authorized device AR.
Product rendering: images, spins and turntables
Use model-preview controls, estimate rendering units, request proofs or final media, and publish approved immutable outputs.
Create and embed media galleries
Arrange published images, video, spins and models with locale, alternate text, approved fallbacks and stable published revisions.