# Thermocouple API
> Type-K thermocouple temperature/voltage conversion as an API, computed locally and deterministically from the official NIST ITS-90 reference functions. The voltage endpoint converts a junction temperature in °C to the thermo-electromotive force in millivolts using the NIST type-K direct polynomial (with its Gaussian correction term above 0 °C), and performs cold-junction compensation by subtracting the reference-junction EMF, so a hot junction at 200 °C against a 25 °C terminal block gives the EMF your meter actually reads; a type-K junction produces 4.096 mV at 100 °C and 41.276 mV at 1000 °C against a 0 °C reference. The temperature endpoint does the inverse: it takes the measured EMF in millivolts and the reference-junction temperature, refers the reading back to 0 °C by adding the cold-junction EMF, and returns the hot-junction temperature in °C and K — obtained by numerically inverting the same monotonic forward polynomial, so it is exactly consistent with the forward conversion. Type K (chromel–alumel) covers −270 to 1372 °C. Everything is computed locally and deterministically, so it is instant and private. Ideal for industrial-automation, process-control, data-acquisition, IoT-sensor, furnace and lab-instrument app developers, sensor-linearization and cold-junction-compensation tools, and embedded firmware. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 2 endpoints. This is the type-K thermocouple; for resistance-temperature detectors use an RTD/PT100 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/thermocouple-api/..."
```

## Pricing
- **Free** (Free) — 4,200 calls/Mo, 2 req/s
- **Starter** ($8/Mo) — 39,000 calls/Mo, 6 req/s
- **Pro** ($22/Mo) — 185,000 calls/Mo, 15 req/s
- **Mega** ($69/Mo) — 1,100,000 calls/Mo, 40 req/s

## Endpoints

### Thermocouple

#### `GET /v1/temperature` — EMF to temperature

**Parameters:**
- `emf` (query, required, string) — Measured EMF (mV) Example: `4.096`
- `reference` (query, optional, string) — Reference/cold junction (°C, default 0) Example: `25`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/thermocouple-api/v1/temperature?emf=4.096&reference=25"
```

**Response:**
```json
{
    "data": {
        "note": "Type-K NIST ITS-90, inverted numerically from the forward polynomial. The measured EMF is referred back to 0 °C by adding the cold-junction EMF before conversion.",
        "type": "K",
        "inputs": {
            "emf": 4.096,
            "reference": 25
        },
        "total_emf_mv": 5.096242,
        "temperature_c": 124.3099,
        "temperature_k": 397.4599
    },
    "meta": {
        "timestamp": "2026-06-05T19:50:30.162Z",
        "request_id": "c0ab70ef-7366-4462-a5b6-bc3480b04a66"
    },
    "status": "ok",
    "message": "EMF to temperature",
    "success": true
}
```

#### `GET /v1/voltage` — Temperature to EMF

**Parameters:**
- `temperature` (query, required, string) — Hot-junction temperature (°C) Example: `100`
- `reference` (query, optional, string) — Reference/cold junction (°C, default 0) Example: `25`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/thermocouple-api/v1/voltage?temperature=100&reference=25"
```

**Response:**
```json
{
    "data": {
        "note": "Type-K NIST ITS-90. Measured EMF = E(t_hot) − E(t_ref); with a 0 °C reference the absolute Seebeck EMF is returned. Type K reads 4.096 mV at 100 °C and 41.276 mV at 1000 °C.",
        "type": "K",
        "emf_mv": 3.095988,
        "inputs": {
            "reference": 25,
            "temperature": 100
        },
        "emf_absolute_mv": 4.09623,
        "reference_emf_mv": 1.000242
    },
    "meta": {
        "timestamp": "2026-06-05T19:50:30.264Z",
        "request_id": "bc2c6847-eeb1-490d-9f03-2c7653e59592"
    },
    "status": "ok",
    "message": "Temperature to EMF",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "Type K (chromel–alumel), NIST ITS-90 direct coefficients; voltage→temperature inverted by bisection. t in °C, E in mV. Reference (cold) junction defaults to 0 °C.",
        "range": {
            "emf_mv": [
                -6.458,
                54.886
            ],
            "temperature_c": [
                -270,
                1372
            ]
        },
        "service": "thermocouple-api",
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/voltage": "Temperature (°C) → thermo-EMF (mV), with reference-junction compensation.",
            "GET /v1/temperature": "Measured EMF (mV) → hot-junction temperature, given the reference-junction temperature."
        },
        "description": "Type-K thermocouple temperature↔EMF conversion (NIST ITS-90) with cold-junction compensation."
    },
    "meta": {
        "timestamp": "2026-06-05T19:50:30.370Z",
        "request_id": "dd525a4e-e973-4adc-9336-ddf2c1836c9d"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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