v1

latestOpenAPI 3.1.0Apache-2.02026-07-13153158.0 KB
snapshot

Capture a deployed function into a signed snapshot blob

Captures the deployed Wasm module bytes of the named function into a zstd-compressed, HMAC-SHA256-signed snapshot blob and returns it base64-encoded. The blob round-trips through POST /snapshot/restore.

Authorization: protected stack (bearer auth + tenant scope). The handler runs authorize_tenant against the bearer token's scope (an out-of-scope token gets 403 tenant_scope_denied before any lookup) and then a per-resource owner check against the function's tenant_id (a wildcard-scoped caller from another tenant cannot snapshot tenant A's function).

Signing uses TENSOR_WASM_API_SNAPSHOT_HMAC_KEY; when it is unset the route returns 503 snapshot_signing_not_configured rather than emitting an unsigned blob.

NOTE: this captures the function's deployed module bytes — the working save/restore-of-bytes layer with end-to-end HMAC signing. Capturing a live running instance's linear / GPU memory needs an executor capture hook that does not exist yet; requesting that capability surfaces 501 not_implemented. See crates/tensor-wasm-api/src/routes.rs.

post/snapshot/save

Headers

X-TensorWasm-Tenantinteger

Tenant scope (u64). Defaults to 0 if absent. Mandatory when the gateway runs with TENSOR_WASM_API_REQUIRE_TENANT=1.

Request body

function_idstring uuid required

Server-assigned function identifier (UUIDv4).

Response

Snapshot captured and signed; blob returned base64.

function_idstring uuid required

Server-assigned function identifier (UUIDv4).

snapshot_b64string required

Base64-encoded signed snapshot blob (standard alphabet, padded). The exact bytes to hand back to POST /snapshot/restore; the HMAC trailer is part of these bytes.

signedboolean required

Whether the blob carries an HMAC signature. Always true on this path — the route is only reachable with a key configured.