# Physical Constants API
> The NIST CODATA 2022 fundamental physical constants as an API — 355 quantities used throughout physics and engineering. Look up any constant by name or slug (e.g. speed of light in vacuum → 299792458 m/s, exact; Planck constant, elementary charge, Avogadro constant, Boltzmann constant, Newtonian constant of gravitation), search by keyword, or list them all. Each record carries the recommended value, the standard uncertainty, the SI unit and whether the value is exact (by definition since the 2019 SI redefinition). Ideal for scientific calculators, physics/engineering software, education and lab tooling.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/constants-api/..."
```

## Pricing
- **Free** (Free) — 12,000 calls/Mo, 2 req/s
- **Starter** ($3/Mo) — 100,000 calls/Mo, 8 req/s
- **Pro** ($9/Mo) — 500,000 calls/Mo, 20 req/s
- **Mega** ($24/Mo) — 2,500,000 calls/Mo, 50 req/s

## Endpoints

### Constants

#### `GET /v1/constant` — A single physical constant by name or slug

**Parameters:**
- `name` (query, optional, string) — Constant name, e.g. speed of light in vacuum Example: `speed of light in vacuum`
- `slug` (query, optional, string) — Slug, e.g. elementary-charge

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/constants-api/v1/constant?name=speed+of+light+in+vacuum"
```

**Response:**
```json
{
    "data": {
        "name": "speed of light in vacuum",
        "slug": "speed-of-light-in-vacuum",
        "unit": "m s^-1",
        "exact": true,
        "value": 299792458,
        "value_str": "299 792 458",
        "uncertainty": 0
    },
    "meta": {
        "timestamp": "2026-05-31T05:48:03.942Z",
        "request_id": "12bbb0d6-2b1d-48fb-b4b8-659b25dd663a"
    },
    "status": "ok",
    "message": "Constant retrieved",
    "success": true
}
```

#### `GET /v1/list` — All constants (paginated)

**Parameters:**
- `limit` (query, optional, string) — Max results (1-400, default 50) Example: `50`
- `offset` (query, optional, string) — Pagination offset Example: `0`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/constants-api/v1/list?limit=50&offset=0"
```

**Response:**
```json
{
    "data": {
        "count": 50,
        "limit": 50,
        "total": 355,
        "offset": 0,
        "results": [
            {
                "name": "alpha particle-electron mass ratio",
                "slug": "alpha-particle-electron-mass-ratio",
                "unit": null,
                "exact": false,
                "value": 7294.29954171,
                "value_str": "7294.299 541 71",
                "uncertainty": 1.7e-7
            },
            {
                "name": "alpha particle mass",
                "slug": "alpha-particle-mass",
                "unit": "kg",
                "exact": false,
                "value": 6.644657345e-27,
                "value_str": "6.644 657 3450 e-27",
                "uncertainty": 2.1e-36
            },
            {
                "name": "alpha particle mass energy equivalent",
                "slug": "alpha-particle-mass-energy-equivalent",
                "unit": "J",
                "exact": false,
                "value": 5.9719201997e-10,
                "value_str": "5.971 920 1997 e-10",
                "uncertainty": 1.9e-19
            },
            {
                "name": "alpha particle mass energy equivalent in MeV",
                "slug": "alpha-particle-mass-energy-equivalent-in-mev",
                "unit": "MeV",
                "exact": false,
                "value": 3727.3794118,
                "value_str": "3727.379 4118",
                "uncertainty": 1.2e-6
            },
      
…(truncated, see openapi.json for full schema)
```

#### `GET /v1/search` — Search constants by name

**Parameters:**
- `q` (query, required, string) — Keyword, e.g. mass Example: `mass`
- `limit` (query, optional, string) — Results per page (1-100, default 20) Example: `20`
- `offset` (query, optional, string) — Pagination offset Example: `0`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/constants-api/v1/search?q=mass&limit=20&offset=0"
```

**Response:**
```json
{
    "data": {
        "count": 20,
        "limit": 20,
        "query": "mass",
        "total": 114,
        "offset": 0,
        "results": [
            {
                "name": "alpha particle-electron mass ratio",
                "slug": "alpha-particle-electron-mass-ratio",
                "unit": null,
                "exact": false,
                "value": 7294.29954171,
                "value_str": "7294.299 541 71",
                "uncertainty": 1.7e-7
            },
            {
                "name": "alpha particle mass",
                "slug": "alpha-particle-mass",
                "unit": "kg",
                "exact": false,
                "value": 6.644657345e-27,
                "value_str": "6.644 657 3450 e-27",
                "uncertainty": 2.1e-36
            },
            {
                "name": "alpha particle mass energy equivalent",
                "slug": "alpha-particle-mass-energy-equivalent",
                "unit": "J",
                "exact": false,
                "value": 5.9719201997e-10,
                "value_str": "5.971 920 1997 e-10",
                "uncertainty": 1.9e-19
            },
            {
                "name": "alpha particle mass energy equivalent in MeV",
                "slug": "alpha-particle-mass-energy-equivalent-in-mev",
                "unit": "MeV",
                "exact": false,
                "value": 3727.3794118,
                "value_str": "3727.379 4118",
                "uncertainty": 1.2
…(truncated, see openapi.json for full schema)
```

### Meta

#### `GET /v1/meta` — Totals & CODATA adjustment

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/constants-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "note": "value is the recommended numeric value; uncertainty is the standard uncertainty (0 when exact).",
        "exact": 81,
        "total": 355,
        "fields": [
            "name",
            "slug",
            "value",
            "value_str",
            "uncertainty",
            "exact",
            "unit"
        ],
        "source": "NIST — CODATA 2022 fundamental physical constants",
        "adjustment": "2022 CODATA"
    },
    "meta": {
        "timestamp": "2026-05-31T05:48:04.141Z",
        "request_id": "84a5fe00-aa54-4216-af98-7f0200d5826e"
    },
    "status": "ok",
    "message": "Meta retrieved",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/constants-api
OpenAPI spec: https://www.oanor.com/api/constants-api/openapi.json
