---
title: "Deploy a new Wasm module"
method: POST
path: "/functions"
tags: ["lifecycle"]
---

# Deploy a new Wasm module

`POST /functions`

## Headers

- `X-TensorWasm-Tenant` integer

## Request body

- CreateFunctionRequest — Body of `POST /functions`. Mirrors the `tensor_wasm_api::routes::CreateFunctionRequest` Rust struct.
  - `name` string, required — Tenant-supplied display name (free-form, non-empty).
  - `wasm_b64` string, required — Base64-encoded Wasm module bytes (standard alphabet, padded). Decoded value must validate as a complete Wasm module via `wasmparser::validate`.

## Response `200`

Function deployed

- CreateFunctionResponse
  - `id` string, uuid, required — Server-assigned function identifier (UUIDv4).

## Other responses

- `400` — Validation failure
- `401` — Missing or unrecognised bearer token
- `403` — Bearer token is not scoped to the requested tenant
- `413` — Request body exceeded the 64 MiB cap enforced by axum's `DefaultBodyLimit::max`. Often rendered as a bare 413 with no body when the limit is hit during streaming.
- `429` — Per-token QPS + burst exceeded. The `Retry-After` header carries the wait in integer seconds (RFC 9110 §10.2.3).

---

[API](https://skmtc.dev/craton-co/apis/tensorwasm-http-api.md) · [All operations](https://skmtc.dev/craton-co/apis/tensorwasm-http-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/craton-co/tensorwasm-http-api/revisions/d363e13d8640/schema)
