Reference
API documentation
All endpoints are static JSON files. No authentication, no rate limiting, no SDK required. Fetch them with anything that speaks HTTP.
Endpoints
| Path | Returns | Sample |
|---|---|---|
| /constants/<SLUG>.json | One constant record. | /constants/speed-of-light-in-vacuum.json |
| /index.json | Compact array of every slug. Use for autocomplete. | /index.json |
| /all.json | Every full record in one file. | /all.json |
| /categories.json | Array of categories with counts. | /categories.json |
Base URL: https://constants.oriz.in · also available at https://cdn.jsdelivr.net/gh/oriz-org/constants-api@main
Record schema
Each /constants/<SLUG>.json file returns one record:
type Constant = {
slug: string; // e.g. "planck-constant"
name: string; // CODATA-canonical name
value: number | string; // parsed numeric value (string if too large for Number)
value_string: string; // human-readable spaced form, e.g. "6.626 070 15 e-34"
uncertainty: number | null; // null when the value is exact
uncertainty_string: string; // raw uncertainty, or "exact"
unit: string | null; // SI unit, e.g. "J Hz^-1"
exact: boolean; // true when CODATA defines an exact value
category: string; // "universal" | "electromagnetic" | "atomic-and-nuclear" | "physico-chemical" | "conversions-and-adopted" | "photometric"
source: "CODATA 2022 (NIST)";
source_url: string;
} Exact vs measured
Since the 2019 SI redefinition, seven constants have fixed exact numeric values by definition: speed of light, Planck constant, elementary charge, Boltzmann constant, Avogadro constant, caesium hyperfine frequency, and the luminous efficacy of 540 THz radiation. These records have exact: true and uncertainty: null. Everything else is a measured value carrying a finite uncertainty.
Slugs
Slugs are derived from the CODATA name: lowercased, dots stripped, non-alphanumerics collapsed to dashes. Examples:
- speed-of-light-in-vacuum — speed of light in vacuum
- planck-constant — Planck constant
- fine-structure-constant — fine-structure constant
- electron-mass — electron mass
- avogadro-constant — Avogadro constant
Get the full list via /index.json.
Errors
The only possible error is 404 — unknown slug. There is no authentication, no rate limit, and no quota, so 401/403/429 cannot occur. CORS is wide open on both origins (Cloudflare Pages and jsDelivr).
License & source
- Code (
scripts/, build tooling): MIT - Data (
constants/,*.json): NIST works are public domain in the United States
Source: 2022 CODATA recommended values, published by NIST at physics.nist.gov/cuu/Constants/. Raw ASCII listing: allascii.txt.