# Range Remap API
> Map numbers between ranges. The scale endpoint linearly maps a value from an input range [in_min, in_max] onto an output range [out_min, out_max] — the classic map() you reach for with sensor readings, sliders and knobs, gauges and progress bars, and data-visualisation axes. It also returns the 0–1 position t, so with the default 0–1 output range it normalizes a value, and with a 0–1 input range it interpolates (lerp); output ranges may be reversed (out_min greater than out_max) to invert direction, and an optional clamp keeps the result inside the output range instead of extrapolating. The clamp endpoint constrains a value to a minimum and maximum and can additionally snap it to the nearest step. Everything is exact local maths, instant and deterministic. Ideal for IoT and embedded (Arduino-style map), audio and DSP, graphics and game development, dashboards and charts, and UI controls. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This maps scalar values — for interpolating vectors use a vector API and for animation easing curves use an easing 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/remap-api/..."
```

## Pricing
- **Free** (Free) — 4,635 calls/Mo, 2 req/s
- **Starter** ($6/Mo) — 14,150 calls/Mo, 8 req/s
- **Pro** ($26/Mo) — 192,500 calls/Mo, 20 req/s
- **Mega** ($64/Mo) — 1,005,000 calls/Mo, 50 req/s

## Endpoints

### Remap

#### `GET /v1/clamp` — Clamp and snap a value

**Parameters:**
- `value` (query, required, string) — The value Example: `7.3`
- `min` (query, required, string) — Minimum Example: `0`
- `max` (query, required, string) — Maximum Example: `10`
- `step` (query, optional, string) — Snap to the nearest multiple of step Example: `5`
- `round` (query, optional, string) — Round to N decimals

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/remap-api/v1/clamp?value=7.3&min=0&max=10&step=5"
```

**Response:**
```json
{
    "data": {
        "max": 10,
        "min": 0,
        "value": 7.3,
        "changed": true,
        "clamped": 5,
        "snapped": true,
        "was_out_of_range": false
    },
    "meta": {
        "timestamp": "2026-06-03T17:42:20.281Z",
        "request_id": "8afa764f-0d2e-4ca6-a3f7-c6aca24d00eb"
    },
    "status": "ok",
    "message": "Clamp and snap a value",
    "success": true
}
```

#### `GET /v1/scale` — Map a value between ranges

**Parameters:**
- `value` (query, required, string) — The input value Example: `512`
- `in_min` (query, required, string) — Input range start Example: `0`
- `in_max` (query, required, string) — Input range end Example: `1023`
- `out_min` (query, optional, string) — Output range start (default 0) Example: `0`
- `out_max` (query, optional, string) — Output range end (default 1) Example: `5`
- `clamp` (query, optional, string) — Keep result within the output range (default false)
- `round` (query, optional, string) — Round to N decimals Example: `3`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/remap-api/v1/scale?value=512&in_min=0&in_max=1023&out_min=0&out_max=5&round=3"
```

**Response:**
```json
{
    "data": {
        "t": 0.5,
        "value": 512,
        "in_max": 1023,
        "in_min": 0,
        "mapped": 2.502,
        "clamped": false,
        "out_max": 5,
        "out_min": 0,
        "out_of_range": false
    },
    "meta": {
        "timestamp": "2026-06-03T17:42:20.365Z",
        "request_id": "c46accbc-056e-49b0-9438-28d65b20672e"
    },
    "status": "ok",
    "message": "Map a value between ranges",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "name": "Range Remap API",
        "notes": "Mapped value = out_min + (value − in_min) ÷ (in_max − in_min) × (out_max − out_min). Output ranges may be reversed (out_min > out_max) to invert. Without clamp, values outside the input range extrapolate. This maps scalars — for vector interpolation use a vector API and for animation easing curves use an easing API. Nothing is stored.",
        "version": "v1",
        "endpoints": [
            {
                "path": "/v1/scale",
                "params": {
                    "clamp": "keep the result within the output range (default false)",
                    "round": "round to N decimals",
                    "value": "the input value (required)",
                    "in_max": "input range end (required)",
                    "in_min": "input range start (required)",
                    "out_max": "output range end (default 1)",
                    "out_min": "output range start (default 0)"
                },
                "returns": "the mapped value and its 0–1 position t"
            },
            {
                "path": "/v1/clamp",
                "params": {
                    "max": "maximum (required)",
                    "min": "minimum (required)",
                    "step": "optional — snap to the nearest multiple of step",
                    "round": "round to N decimals",
                    "value": "the value (required)"
                },
                "retu
…(truncated, see openapi.json for full schema)
```


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