# Geometry API
> Calculate the geometry of common shapes. Get the area of 2D shapes (circle, square, rectangle, triangle — by base/height or three sides via Heron, trapezoid, parallelogram, rhombus, ellipse, regular polygon), the perimeter or circumference, and for 3D shapes the volume and surface area (sphere, cube, box, cylinder, cone, square pyramid). Pass a shape and its dimensions and get back the exact result plus the formula used. Pure local math — no key, no third-party service, instant and deterministic. Live. 6 endpoints. Built for CAD and engineering tools, education and e-learning, construction and material estimation, and any app that needs reliable shape math. Distinct from a generic expression evaluator or unit converter.

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

## Pricing
- **Free** (Free) — 1,340 calls/Mo, 2 req/s
- **Starter** ($5/Mo) — 20,000 calls/Mo, 8 req/s
- **Pro** ($25/Mo) — 166,000 calls/Mo, 20 req/s
- **Mega** ($61/Mo) — 850,000 calls/Mo, 50 req/s

## Endpoints

### Geometry

#### `GET /v1/area` — Area of a 2D shape

**Parameters:**
- `shape` (query, required, string) — circle|square|rectangle|triangle|trapezoid|parallelogram|rhombus|ellipse|regular_polygon Example: `circle`
- `radius` (query, optional, string) — e.g. for circle Example: `5`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/geometry-api/v1/area?shape=circle&radius=5"
```

**Response:**
```json
{
    "data": {
        "area": 78.5398,
        "shape": "circle",
        "formula": "π·r²"
    },
    "meta": {
        "timestamp": "2026-06-02T16:51:55.844Z",
        "request_id": "1000a333-93ba-44ee-a8ea-ecdb328de105"
    },
    "status": "ok",
    "message": "Area of a 2D shape",
    "success": true
}
```

#### `GET /v1/perimeter` — Perimeter / circumference

**Parameters:**
- `shape` (query, required, string) — circle|square|rectangle|triangle|regular_polygon|ellipse Example: `rectangle`
- `width` (query, optional, string) — e.g. for rectangle Example: `4`
- `height` (query, optional, string) — e.g. for rectangle Example: `3`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/geometry-api/v1/perimeter?shape=rectangle&width=4&height=3"
```

**Response:**
```json
{
    "data": {
        "shape": "rectangle",
        "formula": "2·(w+h)",
        "perimeter": 14
    },
    "meta": {
        "timestamp": "2026-06-02T16:51:55.984Z",
        "request_id": "e244f67f-3d6f-4a5e-a2e4-f6725bf360aa"
    },
    "status": "ok",
    "message": "Perimeter / circumference",
    "success": true
}
```

#### `GET /v1/surface-area` — Surface area of a 3D shape

**Parameters:**
- `shape` (query, required, string) — sphere|cube|box|cylinder|cone Example: `cylinder`
- `radius` (query, optional, string) — e.g. for cylinder Example: `2`
- `height` (query, optional, string) — e.g. for cylinder Example: `10`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/geometry-api/v1/surface-area?shape=cylinder&radius=2&height=10"
```

**Response:**
```json
{
    "data": {
        "shape": "cylinder",
        "formula": "2·π·r·(r+h)",
        "surface_area": 150.7964
    },
    "meta": {
        "timestamp": "2026-06-02T16:51:56.079Z",
        "request_id": "78e88502-e275-457f-bf44-3a0ace6b245c"
    },
    "status": "ok",
    "message": "Surface area of a 3D shape",
    "success": true
}
```

#### `GET /v1/volume` — Volume of a 3D shape

**Parameters:**
- `shape` (query, required, string) — sphere|cube|box|cylinder|cone|pyramid Example: `sphere`
- `radius` (query, optional, string) — e.g. for sphere Example: `3`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/geometry-api/v1/volume?shape=sphere&radius=3"
```

**Response:**
```json
{
    "data": {
        "shape": "sphere",
        "volume": 113.0973,
        "formula": "4⁄3·π·r³"
    },
    "meta": {
        "timestamp": "2026-06-02T16:51:56.182Z",
        "request_id": "dcde6f38-a07a-499a-b8f8-e2707fd92f86"
    },
    "status": "ok",
    "message": "Volume of a 3D shape",
    "success": true
}
```

### Reference

#### `GET /v1/shapes` — Supported shapes per operation

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

**Response:**
```json
{
    "data": {
        "area": [
            "circle",
            "square",
            "rectangle",
            "triangle",
            "trapezoid",
            "parallelogram",
            "rhombus",
            "ellipse",
            "regular_polygon"
        ],
        "volume": [
            "sphere",
            "cube",
            "box",
            "cylinder",
            "cone",
            "pyramid"
        ],
        "perimeter": [
            "circle",
            "square",
            "rectangle",
            "triangle",
            "regular_polygon",
            "ellipse"
        ],
        "surface_area": [
            "sphere",
            "cube",
            "box",
            "cylinder",
            "cone"
        ]
    },
    "meta": {
        "timestamp": "2026-06-02T16:51:56.282Z",
        "request_id": "d64ea49e-2956-4474-b2a0-0f92f9371528"
    },
    "status": "ok",
    "message": "Supported shapes",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "auth": "none upstream; this gateway requires x-api-key",
        "name": "Geometry API",
        "note": "Compute area (/v1/area), perimeter/circumference (/v1/perimeter), volume (/v1/volume) and surface area (/v1/surface-area) of common shapes. Pass ?shape= and its dimensions (e.g. shape=circle&radius=5, shape=rectangle&width=4&height=3, shape=triangle&a=3&b=4&c=5, shape=cylinder&radius=2&height=10). /v1/shapes lists supported shapes per operation. Returns the value and the formula used. Instant, exact.",
        "source": "Local geometric formulas — no key, no upstream",
        "endpoints": 6
    },
    "meta": {
        "timestamp": "2026-06-02T16:51:56.392Z",
        "request_id": "94ae1dd7-ac30-49f6-8b97-043d06dbaef6"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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