Skip to main content
Live. This area is documented as current, user-reliable behavior.

Goal

Upload a file from a trusted backend, persist its ID and revision, and use the returned delivery URL only after the asset is ready.

Prerequisites

  • A StackShift API key stored in STACKSHIFT_API_KEY or your server secret manager
  • Node.js, Python, Go, or PHP installed for the matching official SDK

Workflow

1
Install one official SDK and construct its client. The default control-plane and CDN URLs are already configured.
2
Upload with a stable bucket/key and explicit visibility. Use private visibility unless the file is intended for unauthenticated delivery.
3
Persist id, revision, checksum_sha256, and the state fields from the response.
4
If the response is still processing, poll assets.get or subscribe to an asset webhook before rendering the URL.
5
Pass the current revision to replace, patch, tag, or delete calls; refresh the asset after a 412 conflict.

Install and configure

TypeScript

The JavaScript client uses camelCase options and maps them to the Assets API’s snake_case wire fields. asset.url is optional: it is populated only for a public, ready asset with a current version.

NestJS

Wrap the SDK in a service and accept files through NestJS Multer interceptors. For larger browser uploads, create signed upload URLs instead of buffering through the NestJS process.

React, Next.js, and TanStack Start

Browser apps should never receive the StackShift API key. Create a signed upload URL on a server route, then upload the browser File directly to StackShift Assets.
Server route
Browser client

Python

The Python client returns dictionaries and raises StackShiftAPIError for non-2xx responses. Use asset["revision"] for later mutation calls.

Go

The Go client returns typed assets. Mutating methods take the current revision explicitly so an older process cannot overwrite a newer change.

Expected result

Your backend can upload, persist, and safely deliver an asset without exposing the API key or serving a pending/quarantined object.

StackShift Assets

A grounded guide to Assets storage, uploads, delivery, imports, BYOB and S2, transformations, OCR, media processing, AI jobs, and DAM controls.

Direct browser uploads

Upload browser files directly with short-lived sessions, per-part checksums, progress callbacks, retries, resume, and cancellation.

Image optimization

Use the current transform grammar, named presets, and signed dynamic transforms for predictable image delivery.

AI DAM and versioning

Use configured asset AI jobs, moderation, transcripts, derived images, collections, saved searches, and branching versions with explicit readiness and spend controls.