# Optical Fiber API
> Optical-fibre photonics maths as an API, computed locally and deterministically. The numerical-aperture endpoint computes a step-index fibre's numerical aperture NA = √(n1² − n2²) from the core and cladding refractive indices, the acceptance angle θa = arcsin(NA) — the half-angle of the cone of light the fibre can capture — the full acceptance cone and the relative index difference Δ = (n1 − n2)/n1. The v-number endpoint computes the normalized frequency V = 2π·a·NA/λ from the core radius, the numerical aperture (or the indices) and the wavelength, classifies the fibre as single-mode when V is below the 2.405 cutoff or multimode above it, and gives the cutoff wavelength for single-mode operation. The modes endpoint estimates the number of guided modes — about V²/2 for a step-index fibre and V²/4 for a graded-index one — and confirms single-mode operation below the cutoff. Core radius and wavelength are in metres (1310 nm = 1.31×10⁻⁶ m) and refractive indices are dimensionless. Everything is computed locally and deterministically, so it is instant and private. Ideal for telecom, photonics, datacenter, sensor and laser app developers, fibre-link and waveguide-design tools, and optics education. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is optical-fibre guiding; for thin lenses and mirrors use a lens API and for refraction at a surface a Snell 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/fiber-api/..."
```

## Pricing
- **Free** (Free) — 2,900 calls/Mo, 2 req/s
- **Starter** ($10/Mo) — 38,000 calls/Mo, 6 req/s
- **Pro** ($25/Mo) — 252,000 calls/Mo, 15 req/s
- **Mega** ($77/Mo) — 1,730,000 calls/Mo, 40 req/s

## Endpoints

### Fiber

#### `GET /v1/modes` — Mode count

**Parameters:**
- `v_number` (query, optional, string) — V-number Example: `5.234`
- `profile` (query, optional, string) — step or graded Example: `step`
- `core_radius` (query, optional, string) — Core radius (m)
- `wavelength` (query, optional, string) — Wavelength (m)
- `numerical_aperture` (query, optional, string) — NA

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/fiber-api/v1/modes?v_number=5.234&profile=step"
```

**Response:**
```json
{
    "data": {
        "note": "Guided modes: step-index M ≈ V²/2, graded-index M ≈ V²/4 (large-V approximation). Below V = 2.405 only the single fundamental mode propagates.",
        "inputs": {
            "profile": "step",
            "v_number": 5.234
        },
        "single_mode": false,
        "raw_mode_estimate": 13.6974,
        "approximate_mode_count": 13
    },
    "meta": {
        "timestamp": "2026-06-05T11:30:30.632Z",
        "request_id": "bd6a8d0b-c1fe-4027-825e-b6219b4ce53a"
    },
    "status": "ok",
    "message": "Mode count",
    "success": true
}
```

#### `GET /v1/numerical-aperture` — Numerical aperture

**Parameters:**
- `core_index` (query, required, string) — Core index n1 Example: `1.48`
- `cladding_index` (query, required, string) — Cladding index n2 Example: `1.46`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/fiber-api/v1/numerical-aperture?core_index=1.48&cladding_index=1.46"
```

**Response:**
```json
{
    "data": {
        "note": "NA = √(n1² − n2²); the acceptance angle θa = arcsin(NA) is the half-angle of the cone of light the fibre captures (in air). Δ = (n1 − n2)/n1.",
        "inputs": {
            "core_index": 1.48,
            "cladding_index": 1.46
        },
        "numerical_aperture": 0.242487,
        "acceptance_cone_deg": 28.066757,
        "acceptance_angle_deg": 14.033378,
        "relative_index_difference": 0.01351351
    },
    "meta": {
        "timestamp": "2026-06-05T11:30:30.740Z",
        "request_id": "02b72b81-24f3-4bc8-9976-67662f216e38"
    },
    "status": "ok",
    "message": "Numerical aperture",
    "success": true
}
```

#### `GET /v1/v-number` — V-number

**Parameters:**
- `core_radius` (query, required, string) — Core radius (m) Example: `0.0000045`
- `wavelength` (query, required, string) — Wavelength (m) Example: `0.00000131`
- `numerical_aperture` (query, optional, string) — NA Example: `0.2425`
- `core_index` (query, optional, string) — Or core index n1
- `cladding_index` (query, optional, string) — and cladding index n2

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/fiber-api/v1/v-number?core_radius=0.0000045&wavelength=0.00000131&numerical_aperture=0.2425"
```

**Response:**
```json
{
    "data": {
        "note": "V = 2π·a·NA/λ (normalized frequency). A fibre is single-mode when V < 2.405; above the cutoff wavelength it supports only the fundamental mode.",
        "inputs": {
            "wavelength_m": 1.31e-6,
            "core_radius_m": 4.5e-6,
            "numerical_aperture": 0.2425
        },
        "v_number": 5.233989,
        "mode_regime": "multimode",
        "single_mode": false,
        "cutoff_wavelength_m": 2.850946e-6
    },
    "meta": {
        "timestamp": "2026-06-05T11:30:30.816Z",
        "request_id": "6b4fced6-933c-4f3c-b52a-ab25b79f5bd7"
    },
    "status": "ok",
    "message": "V-number",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "Core radius and wavelength in metres (e.g. 1310 nm = 1.31e-6 m), indices dimensionless. Single-mode cutoff V = 2.405.",
        "service": "fiber-api",
        "formulae": {
            "modes": "step M ≈ V²/2 ; graded M ≈ V²/4",
            "v_number": "V = 2π·a·NA/λ",
            "numerical_aperture": "NA = √(n1² − n2²)"
        },
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/modes": "Approximate guided-mode count for a step- or graded-index fibre.",
            "GET /v1/v-number": "V-number, single/multimode classification and cutoff wavelength.",
            "GET /v1/numerical-aperture": "NA, acceptance angle and index difference from core and cladding indices."
        },
        "description": "Optical-fibre calculator: numerical aperture and acceptance angle, the V-number (normalized frequency) with single-mode cutoff, and the number of guided modes."
    },
    "meta": {
        "timestamp": "2026-06-05T11:30:30.924Z",
        "request_id": "ff34e0d9-2690-46f9-bed5-52c8e949e326"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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