FastCBAM / API Reference / Overview

REST API Overview

FastCBAM exposes one deterministic calculation engine over REST. Every endpoint maps 1:1 to a sector engine or utility, cites its regulatory anchor, and replays byte-for-byte across Rust, WASM, and the hosted API.

Base URL

All endpoints are served over HTTPS under a single versioned prefix. Plain HTTP is redirected to HTTPS.

base-url
https://api.fastcbam.com/v1

The same engine is also available self-hosted as a Rust crate and in-browser as a WASM module. Identical inputs produce identical outputs on every surface.

Authentication

Pass your access token in the Authorization request header. Tokens are issued from your dashboard.

first-request.sh
curl -s -X POST https://api.fastcbam.com/v1/cn-codes/stats \
  -H "Authorization: Bearer $FASTCBAM_TOKEN"

Confirm the header name is Authorization and that the value uses the Bearer scheme.

Conventions

RuleDetail
Decimals are stringsAll decimal values travel as JSON strings, never numbers — this preserves byte-equivalence between the API, MCP, and the Rust core. Example: { "mass_t": "1250.5" }.
MethodsCalculation endpoints and authenticated utility endpoints are POST. Open health/hash/source endpoints are GET.
AnchorsEvery result carries the regulatory citation it was derived from — Annex equation, CN code, factor snapshot version.
DeterminismIdentical inputs yield byte-identical outputs. Results are reproducible across releases for a pinned factor snapshot.
TimestampsISO 8601 in UTC, e.g. 2026-06-22T10:30:00.000Z.

Error handling

Every response is a JSON envelope. Success carries the result under data; failure carries a human-readable error message and a machine-readable code.

envelope.json
// success
{ "ok": true, "data": { /* result */ } }

// error
{ "ok": false, "error": "<message>", "code": "<CODE>" }
CodeMeaning
BAD_REQUESTThe request body failed to parse against the endpoint's schema. Fix field names or types and retry.
<ENGINE>_ERRORThe body parsed but the engine rejected the inputs (e.g. a zero divisor or out-of-scope material). Each endpoint documents its own engine error code, such as CEMENT_CLINKER_ERROR.

Endpoint catalogue

The current surface. Each maps to one sector engine or utility. Click through for request and response schemas with worked examples.

Sector calculators

Utilities