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.
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.
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
| Rule | Detail |
|---|---|
| Decimals are strings | All 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" }. |
| Methods | Calculation endpoints and authenticated utility endpoints are POST. Open health/hash/source endpoints are GET. |
| Anchors | Every result carries the regulatory citation it was derived from — Annex equation, CN code, factor snapshot version. |
| Determinism | Identical inputs yield byte-identical outputs. Results are reproducible across releases for a pinned factor snapshot. |
| Timestamps | ISO 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.
// success
{ "ok": true, "data": { /* result */ } }
// error
{ "ok": false, "error": "<message>", "code": "<CODE>" }
| Code | Meaning |
|---|---|
BAD_REQUEST | The request body failed to parse against the endpoint's schema. Fix field names or types and retry. |
<ENGINE>_ERROR | The 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
/v1/cement/clinker
POST/v1/cement/cement
POST/v1/iron-steel/eaf
POST/v1/iron-steel/alloy-steel
POST/v1/aluminium/smelting
POST/v1/hydrogen/smr
POST/v1/hydrogen/electrolysis
POST/v1/hydrogen/chlor-alkali
POST/v1/fertilisers/ammonia
POST/v1/fertilisers/nitric-acid
POST/v1/fertilisers/urea
POST/v1/fertilisers/npk
POST/v1/ferroalloys/tier1-co2
POST/v1/ferroalloys/tier1-ch4
POST/v1/ferroalloys/tier2-co2