# Prism Optics API
> Optical-prism geometry as an API, computed locally and deterministically. The deviation endpoint computes the minimum deviation angle of a light ray passing through a prism of apex angle A and refractive index n, δ_min = 2·arcsin(n·sin(A/2)) − A, together with the symmetric angle of incidence and the internal refraction angle A/2 on each face — an equilateral prism (A = 60°) of crown glass (n = 1.5) deviates light by about 37.2°. The refractive-index endpoint inverts the spectrometer formula n = sin((A + δ_min)/2) / sin(A/2), the standard way a refractive index is measured from a prism’s apex angle and its measured minimum deviation. The dispersion endpoint computes the angular dispersion between two wavelengths from their refractive indices and the apex angle, and, given the three Fraunhofer indices n_F, n_C and n_D, the dispersive power ω = (n_F − n_C)/(n_D − 1) and the Abbe number V = 1/ω that quantify how strongly a glass spreads colours — crown glass has ω ≈ 0.017 and V ≈ 59. All angles are in degrees. Everything is computed locally and deterministically, so it is instant and private. Ideal for optics, spectroscopy, refractometry, photonics and physics-education app developers, lens-and-prism design tools, and lab software. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is prism geometry; for a single flat-surface refraction use a Snell’s-law API and for thin lenses a lens 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/prism-api/..."
```

## Pricing
- **Free** (Free) — 4,400 calls/Mo, 2 req/s
- **Starter** ($5/Mo) — 43,500 calls/Mo, 6 req/s
- **Pro** ($14/Mo) — 207,000 calls/Mo, 15 req/s
- **Mega** ($43/Mo) — 1,245,000 calls/Mo, 40 req/s

## Endpoints

### Prism

#### `GET /v1/deviation` — Minimum deviation

**Parameters:**
- `apex_angle` (query, required, string) — Prism apex angle A (degrees) Example: `60`
- `n` (query, required, string) — Refractive index Example: `1.5`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/prism-api/v1/deviation?apex_angle=60&n=1.5"
```

**Response:**
```json
{
    "data": {
        "note": "At minimum deviation the ray passes symmetrically: δ_min = 2·arcsin(n·sin(A/2)) − A, with equal incidence i and exit angles and internal refraction A/2 on each face. An equilateral prism (A=60°) of n=1.5 gives δ_min ≈ 37.18°.",
        "inputs": {
            "n": 1.5,
            "apex_angle": 60
        },
        "incidence_angle": 48.590378,
        "minimum_deviation": 37.180756,
        "internal_refraction_angle": 30
    },
    "meta": {
        "timestamp": "2026-06-05T19:50:31.781Z",
        "request_id": "72df7eb6-0db2-4a2b-a169-397999494266"
    },
    "status": "ok",
    "message": "Minimum deviation",
    "success": true
}
```

#### `GET /v1/dispersion` — Dispersion & dispersive power

**Parameters:**
- `apex_angle` (query, optional, string) — Apex angle A (degrees) Example: `60`
- `n_blue` (query, optional, string) — Index for blue line Example: `1.53`
- `n_red` (query, optional, string) — Index for red line Example: `1.51`
- `n_f` (query, optional, string) — Fraunhofer F index Example: `1.5293`
- `n_c` (query, optional, string) — Fraunhofer C index Example: `1.5204`
- `n_d` (query, optional, string) — Fraunhofer D index Example: `1.5230`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/prism-api/v1/dispersion?apex_angle=60&n_blue=1.53&n_red=1.51&n_f=1.5293&n_c=1.5204&n_d=1.5230"
```

**Response:**
```json
{
    "data": {
        "note": "Angular dispersion = δ_blue − δ_red (each from the minimum-deviation formula). Dispersive power ω = (n_F − n_C)/(n_D − 1); Abbe number V = 1/ω. Crown glass: ω ≈ 0.017, V ≈ 59.",
        "inputs": {
            "n_c": 1.5204,
            "n_d": 1.523,
            "n_f": 1.5293,
            "n_red": 1.51,
            "n_blue": 1.53,
            "apex_angle": 60
        },
        "abbe_number": 58.764045,
        "deviation_red": 38.05074,
        "deviation_blue": 39.813984,
        "dispersive_power": 0.01701721,
        "angular_dispersion": 1.763244
    },
    "meta": {
        "timestamp": "2026-06-05T19:50:31.877Z",
        "request_id": "8ed0b530-1994-4ce1-b3b7-555da3591a99"
    },
    "status": "ok",
    "message": "Dispersion and dispersive power",
    "success": true
}
```

#### `GET /v1/refractive-index` — Index from deviation

**Parameters:**
- `apex_angle` (query, required, string) — Prism apex angle A (degrees) Example: `60`
- `minimum_deviation` (query, required, string) — Measured δ_min (degrees) Example: `37.18`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/prism-api/v1/refractive-index?apex_angle=60&minimum_deviation=37.18"
```

**Response:**
```json
{
    "data": {
        "n": 1.499991,
        "note": "Prism spectrometer formula: n = sin((A + δ_min)/2) / sin(A/2). This is how a refractive index is measured from the apex angle and the minimum deviation.",
        "inputs": {
            "apex_angle": 60,
            "minimum_deviation": 37.18
        }
    },
    "meta": {
        "timestamp": "2026-06-05T19:50:31.980Z",
        "request_id": "2d02bba6-85e5-42cb-8304-0800cac96f1d"
    },
    "status": "ok",
    "message": "Refractive index from deviation",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "Angles in degrees. n = sin((A+δ_min)/2)/sin(A/2). This is geometric prism optics; for a single flat-surface refraction use a Snell's-law API and for thin lenses a lens API.",
        "service": "prism-api",
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/deviation": "Minimum deviation for a prism of apex angle A and index n.",
            "GET /v1/dispersion": "Angular dispersion between two lines and/or dispersive power and Abbe number.",
            "GET /v1/refractive-index": "Refractive index from apex angle and minimum deviation."
        },
        "description": "Optical prism calculator: minimum deviation, refractive index from measured deviation (spectrometer formula), and dispersion / dispersive power."
    },
    "meta": {
        "timestamp": "2026-06-05T19:50:32.083Z",
        "request_id": "9416ac00-7814-428f-8e63-bdf238ed3329"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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