# Sunscreen & UV API
> Sun-safety maths as an API, computed locally and deterministically — the burn-time, SPF and reapplication numbers a sunscreen, weather or outdoor app keeps people safe with. The burntime endpoint estimates how long until sunburn from the Fitzpatrick skin type (1 very fair to 6 deeply pigmented), the UV index and the SPF: unprotected time is a skin-type base (type II around 15 minutes) scaled by 6 ÷ UV index, and protected time is that times the SPF — so fair type-II skin at UV 8 burns in about 11 minutes bare, or roughly 5½ hours under SPF 30, while very fair type-I skin in extreme UV 11 burns in 5 minutes. The spf endpoint flips it: the SPF needed = your desired minutes outdoors ÷ the unprotected time, with the reminder that real protection plateaus around SPF 30–50. The amount endpoint covers the part people get wrong — about 2 mg/cm², roughly 1 ounce (30 g, a shot glass) for a full adult body, reapplied every two hours — and totals the sunscreen for a day out. Everything is computed locally and deterministically, so it is instant and private. Ideal for sun-safety, weather, skincare and outdoor app developers, UV-alert and reminder tools, and wellness software. Pure local computation — no key, no third-party service, instant. Educational estimates, not medical advice. Live, nothing stored. 3 compute endpoints.

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

## Pricing
- **Free** (Free) — 7,160 calls/Mo, 2 req/s
- **Starter** ($4/Mo) — 56,100 calls/Mo, 6 req/s
- **Pro** ($12/Mo) — 229,200 calls/Mo, 15 req/s
- **Mega** ($37/Mo) — 1,339,000 calls/Mo, 40 req/s

## Endpoints

### Sun

#### `GET /v1/amount` — Sunscreen amount + reapply

**Parameters:**
- `hours_outdoors` (query, required, string) — Hours outdoors Example: `6`
- `coverage` (query, optional, string) — Body fraction exposed 0-1 (default 1) Example: `1`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/sunscreen-api/v1/amount?hours_outdoors=6&coverage=1"
```

#### `GET /v1/burntime` — Time to sunburn

**Parameters:**
- `skin_type` (query, required, string) — Fitzpatrick type 1-6 Example: `2`
- `uv_index` (query, required, string) — UV index (0-16) Example: `8`
- `spf` (query, optional, string) — Sunscreen SPF (default 1 = none) Example: `30`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/sunscreen-api/v1/burntime?skin_type=2&uv_index=8&spf=30"
```

#### `GET /v1/spf` — SPF needed for a duration

**Parameters:**
- `skin_type` (query, required, string) — Fitzpatrick type 1-6 Example: `3`
- `uv_index` (query, required, string) — UV index Example: `8`
- `desired_minutes` (query, required, string) — Minutes outdoors Example: `240`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/sunscreen-api/v1/spf?skin_type=3&uv_index=8&desired_minutes=240"
```

### Meta

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

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


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