Goal
Call Assets directly when an SDK does not cover your runtime, or use this page to understand what an SDK request sends over the wire.Prerequisites
- A StackShift API key
- A UUID asset, bucket, session, or job ID when a route requires one
Workflow
1
Send
Authorization: Bearer <api-key> to the control-plane API.2
Use the
/api/v1 base URL for account and asset management requests.3
Use snake_case JSON names such as
cache_control, max_downloads, and checksum_sha256.4
Read the
data field from the success envelope and preserve revision/ETag values for later mutations.5
Poll the returned job, migration, or text-extraction resource instead of treating
202 Accepted as completion.Authentication and response envelope
The protected Assets routes are account-scoped. The API key selects the account’s default Assets space; clients do not send a project ID or an internal asset-space ID. Use the narrowest available Assets scope for the operation:assets:read, assets:write, assets:process, assets:generate, assets:publish, or assets:admin.
Core routes
POST /api/v1/assets/uploadaccepts a multipartfileplusbucket,key,folder,visibility,cache_control, and JSONmetadata.GET /api/v1/assetslists assets. Filters includebucket,prefix,visibility,query,tag,mime_type,type,folder,checksum,status,scan_status,replication_status,moderation_status, andquarantine_status. Sorting acceptscreated_at,updated_at,size,key,original_name, ormime_typewithdirection=asc|desc.GET /api/v1/assets/{assetID}returns one asset.PUT /api/v1/assets/{assetID}/replacereplaces its bytes while preserving the logical asset ID.PATCH /api/v1/assets/{assetID}updates bucket, key, original name, cache control, or visibility.PUT /api/v1/assets/{assetID}/tagsreplaces the tag set.PATCH /api/v1/assets/{assetID}/metadatamerges supplied JSON keys into metadata.POST /api/v1/assets/{assetID}/signed-urlcreates a private download URL. The JSON fields areexpires_inand optionalmax_downloads.DELETE /api/v1/assets/{assetID}starts a revision-checked asynchronous delete.POST /api/v1/assets/{assetID}/purgerequests cache invalidation for the asset.
Account controls and DAM routes
- Buckets:
GET/POST /api/v1/assets/buckets, thenPUT/DELETE /api/v1/assets/buckets/{bucketID}with the bucket revision. Bucket fields include default visibility, cache control, versioning, retention, byte/MIME limits, CORS/allowed origins, home region, replication policy, lifecycle policy, and an optional custom domain. - Content policy:
GET/PUT /api/v1/assets/policywithallowed_mime_types,max_image_bytes,max_video_bytes,max_other_bytes, andrequire_scan. - Transformations:
POST/GET /api/v1/assets/transformationsandDELETE /api/v1/assets/transformations/{name}. The POST body accepts legacy fields or a typed v2 definition plus eager policy.POST /assets/{assetID}/transformsmaterializes a definition/preset;GET /derivativeslists persisted outputs. - Lifecycle:
POST/GET /api/v1/assets/lifecycle-rulesandDELETE /api/v1/assets/lifecycle-rules/{ruleID}. A rule hasname, optionalprefix,action=delete|expire_versions,age_days, andenabled. - Custom domains:
POST/GET /api/v1/assets/domains,POST /api/v1/assets/domains/{domainID}/verify, andDELETE /api/v1/assets/domains/{domainID}. - Operations:
GET /api/v1/assets/analytics,/summary, and/eventsexpose delivery/transform/AI usage, grouped totals, duplicate groups, and the audit stream. - Webhooks:
POST/GET/DELETE /api/v1/assets/webhooks,GET /api/v1/assets/webhooks/{webhookID}/deliveries, andPOST /api/v1/assets/webhook-deliveries/{deliveryID}/retry. The create response includes the signing secret once. - DAM organization:
GET/POST/PUT/DELETE /api/v1/assets/collectionsandGET/POST/PUT/DELETE /api/v1/assets/saved-searches; collections store asset IDs and saved searches store a filter object. - Bulk:
POST /api/v1/assets/bulkaccepts revisioned items fordelete,visibility, oradd_tagsand returns a durable job submission.
AI, versions, and branches
- AI policy/config:
GET/PUT /api/v1/assets/ai/config; the update requiresIf-Matchand acceptsenabled_actionsplusmonthly_spend_cap_micros. - AI data and actions:
GET /api/v1/assets/{assetID}/ai,POST /ai/analyze,POST /moderation,GET/POST /transcript,POST /smart-crop, andPOST /background-remove. - Net-new generation:
POST /api/v1/assets/generationsrequiresassets:generateplusIdempotency-Key, creates private images, and returns a durable job. - Version history:
GET /api/v1/assets/{assetID}/versions,POST /versions/{versionID}/restore,POST /branches, andPOST /branches/{branch}/promote. - Delivery helpers: public/current, private/current, version, branch, named-transform, signed-transform, and video paths are served by the CDN rather than the control-plane JSON API.
Connections, storage, migrations, widget capabilities, and OCR
- Connections:
POST/GET /api/v1/assets/connections,GET/PATCH/DELETE /api/v1/assets/connections/{connectionID}, andPOST /verify. Secret values are accepted only on create/update and are never returned. - S2 and storage:
GET/POST /api/v1/assets/s2-buckets,PUT /api/v1/assets/buckets/{bucketID}/storage, andPOST /api/v1/assets/buckets/{bucketID}/relocations. Storage updates require the current bucket revision. - Migrations:
POST/GET /api/v1/assets/migrations,GET /{migrationID},POST /cancel,POST /items/{itemID}/retry, and raw JSON/CSVGET /reportdownloads. - OCR:
POST/GET /api/v1/assets/{assetID}/text-extractionandPOST /api/v1/assets/text-extractions/{extractionID}/retry. - Widget authorization:
POST /api/v1/assets/upload-capabilitiesreturns one short-lived capability token. Capability-only browser traffic uses/assets/widget, outside the authenticated/api/v1management base. - See the platform operations guide for exact request fields, status codes, token scopes, SDK clients, CLI commands, events, and recovery behavior.
Workflows, automation, and MCP
- Workflow catalog and drafts:
GET /assets/workflows/catalog,GET/POST /assets/workflows,GET /assets/workflows/{workflowId},PUT /draft, andPOST /validate. - Immutable operation:
POST /publish,POST /activate,GET /versions,POST /run, and workflow-scopedGET /runs. Global run detail/cancel/retry is under/assets/workflows/runs/{runId}. - Governance:
GET /assets/workflows/approvals, approve/reject endpoints, restricted HTTP connections and credential rotation, and active-workflow inbound-hook rotation. GET /assets/automationdescribes governed tools and recent audits./assets/mcpis the stateless Streamable HTTP MCP transport; each tool enforces its declared scope.- The public signed receiver is
POST /api/v1/assets/workflow-hooks/{token}with timestamp, delivery ID, and HMAC signature headers.
Upload sessions
POST /api/v1/assets/upload-sessionscreates either a single PUT session or a chunked session. Setmode=chunked,file_name,file_size,mime_type, optionalchecksum_sha256, and optionalpart_sizefor resumable uploads.POST /api/v1/assets/upload-urlis the legacy-compatible alias for creating the same session response. The current SDK uses/upload-sessions; the alias also accepts legacy camelCase field names for older clients.- The response contains
upload_session_id,session_idfor chunked sessions, the signed PUTurl,expires_at,max_bytes, andpart_size. - PUT a single file to the signed URL. For a chunked session, PUT each part to
{upload_url}/parts/{part_number}with anX-Content-SHA256header, then callPOST /api/v1/assets/upload-sessions/{sessionID}/complete. GET /api/v1/assets/upload-sessions/{sessionID}returns the session and received parts so a client can resume.DELETEcancels the session and cleans up its temporary parts.- Send
Idempotency-Keywhen creating a session. Reusing the key with different canonical request content returns a conflict instead of creating a second session.
Concurrency and idempotency
- Asset and bucket mutations require
If-Match: "<revision>". The current response includes anETagwith the same revision. A stale or missing revision is rejected so an older dashboard cannot overwrite a newer edit. - Upload, replace, delete, bulk, and AI job mutations accept
Idempotency-Keywhere the SDK exposes one. A key with different request content returnsassets.idempotency_conflict. - List cursors are opaque and bound to their sort and direction. Keep using the returned
next_cursor; do not manufacture or decode cursors.
Asynchronous jobs and states
- AI actions, bulk actions, and physical deletion return
202 Acceptedwithjob_id,status, andstatus_url. PollGET /api/v1/assets/jobs/{jobID}and cancel withPOST /api/v1/assets/jobs/{jobID}/cancelwhen supported. - A newly uploaded asset may be
processingbefore it isready.quarantinedandfailedassets have no deliverable public URL. A delete moves throughdeletingbefore the physical replicas are removed. - AI requests can be rejected when the action is not enabled for the account, the monthly spend cap is exhausted, or the configured model has not passed the evaluation gate.
Delivery URL shapes
- Current public version:
https://cdn.stackshift.cloud/assets/{assetID}/versions/{versionID}/{filename}. - Private signed version:
https://cdn.stackshift.cloud/private/assets/{assetID}/versions/{versionID}/{filename}?token=.... - Named transform:
https://cdn.stackshift.cloud/t/{preset}/assets/{assetID}. - Signed transform:
https://cdn.stackshift.cloud/assets/{assetID}/tr/{spec}/{filename}?exp=...&sig=.... - Video output:
.../assets/{assetID}/video/{kind}/{profile}forhls,poster,thumbnail, ormp4; add the private token query parameter for a private output. - The SDK URL helpers are preferred because they use the configured CDN base URL and escape IDs, names, specs, and filenames correctly.
Common error codes
401means the API key or session is missing or invalid.404means the asset, bucket, job, or delivery target is not visible in the account.409is used for duplicate keys, idempotency conflicts, or an idempotent operation still in progress.428means a requiredIf-Matchheader is missing;412means the supplied revision is stale and does not match the current revision.422indicates a checksum mismatch. Content-policy and request validation failures use400;402can indicate an asset quota or AI spend cap has been reached.- A public delivery
404is also expected for an asset that is not ready, quarantined, deleted, or missing an available replica. Do not retry it as if it were a transient CDN failure without checking the asset state.
Expected result
You can map any Assets SDK method to its REST route and handle successful, asynchronous, conflicting, and quarantined responses correctly.
Related guides
StackShift Assets
A grounded guide to Assets storage, uploads, delivery, imports, BYOB and S2, transformations, OCR, media processing, AI jobs, and DAM controls.
Assets SDK quick start
Install the official SDKs, upload a first asset, and handle the readiness state before you publish its URL.
Deterministic image, video, and audio transforms
Define ordered v2 transforms for images, video renditions, audio extraction, and timestamp thumbnails; store eager presets or materialize durable derivatives.
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.