# Color Temperature API
> Turn physical light into RGB colours — entirely locally. The kelvin endpoint converts a colour temperature in Kelvin into the RGB colour of a black body at that temperature: warm candle and incandescent tones below 3000 K, neutral and daylight whites around 5000–6500 K, and cool bluish light above, using Tanner Helland's widely-used approximation and returning hex, an rgb() string and a plain-English description (candlelight, warm white, neutral, daylight, cool). The wavelength endpoint converts a wavelength of visible light in nanometres (380–780 nm) into the approximate RGB colour the human eye perceives, with the natural intensity fall-off at the violet and red edges of the spectrum, and names the band (violet, blue, cyan, green, yellow, orange, red). Everything is computed locally and deterministically, so it is instant and private. Ideal for lighting and smart-bulb apps, photography and white-balance tools, data-visualisation of temperature or spectra, theming and UI accents, and science and education. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. These are perceptual approximations, not colorimetric CIE conversions; for hex/RGB/HSL conversion and palettes use a colour API.

## 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/colortemp-api/..."
```

## Pricing
- **Free** (Free) — 3,535 calls/Mo, 2 req/s
- **Starter** ($5/Mo) — 13,050 calls/Mo, 8 req/s
- **Pro** ($25/Mo) — 181,500 calls/Mo, 20 req/s
- **Mega** ($63/Mo) — 950,000 calls/Mo, 50 req/s

## Endpoints

### Color Temp

#### `GET /v1/kelvin` — Kelvin to RGB

**Parameters:**
- `kelvin` (query, required, string) — Colour temperature in K (1000–40000) Example: `2700`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/colortemp-api/v1/kelvin?kelvin=2700"
```

**Response:**
```json
{
    "data": {
        "css": "rgb(255, 167, 87)",
        "hex": "#ffa757",
        "rgb": {
            "b": 87,
            "g": 167,
            "r": 255
        },
        "kelvin": 2700,
        "description": "warm white (incandescent)"
    },
    "meta": {
        "timestamp": "2026-06-03T09:25:00.119Z",
        "request_id": "9da7d942-55ba-44a4-a787-6f2039507e5d"
    },
    "status": "ok",
    "message": "Kelvin to RGB",
    "success": true
}
```

#### `GET /v1/wavelength` — Wavelength to RGB

**Parameters:**
- `nm` (query, required, string) — Wavelength in nanometres (380–780) Example: `650`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/colortemp-api/v1/wavelength?nm=650"
```

**Response:**
```json
{
    "data": {
        "nm": 650,
        "css": "rgb(255, 0, 0)",
        "hex": "#ff0000",
        "rgb": {
            "b": 0,
            "g": 0,
            "r": 255
        },
        "band": "red",
        "visible": true
    },
    "meta": {
        "timestamp": "2026-06-03T09:25:00.228Z",
        "request_id": "8ec61c49-83d2-4626-9f7b-7966ff5921b8"
    },
    "status": "ok",
    "message": "Wavelength to RGB",
    "success": true
}
```

### Meta

#### `GET /v1/meta` — Spec

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

**Response:**
```json
{
    "data": {
        "name": "Color Temperature API",
        "notes": "Kelvin uses the Tanner Helland black-body approximation; wavelength uses the Dan Bruton visible-spectrum approximation — both are perceptual approximations, not colorimetric (CIE) conversions. For format conversion (hex/RGB/HSL) and palettes use a colour API. Nothing is stored.",
        "version": "v1",
        "endpoints": [
            {
                "path": "/v1/kelvin",
                "params": {
                    "kelvin": "colour temperature in K (1000–40000)"
                },
                "returns": "the RGB/hex colour and a description (warm/neutral/cool)"
            },
            {
                "path": "/v1/wavelength",
                "params": {
                    "nm": "wavelength in nanometres (380–780)"
                },
                "returns": "the approximate RGB/hex colour and the spectral band"
            },
            {
                "path": "/v1/meta",
                "params": [],
                "returns": "this document"
            }
        ],
        "description": "Turn physical light into RGB colours. The kelvin endpoint converts a colour temperature in Kelvin into the RGB colour of a black body at that temperature — warm candle and incandescent tones below 3000 K, neutral and daylight whites around 5000–6500 K, and cool bluish light above — using Tanner Helland's well-known approximation, with a plain-English description. The wavelength
…(truncated, see openapi.json for full schema)
```


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