# Hammock Hang API
> Hammock-hang maths as an API, computed locally and deterministically — the suspension-force, ridgeline and strap-height numbers a camper or hammock hanger sets up by. It all comes back to the 30-degree rule. The force endpoint shows why: the tension in each suspension line is the occupant weight ÷ (2 × sin of the hang angle), so at a 30° hang each strap carries about one body weight, but flatten the hang to 15° and it jumps to roughly 1.9 times — which is what over-stresses straps, trees and your back when people pull a hammock drum-tight. The ridgeline endpoint sizes a structural ridgeline at about 83 % of the hammock length, the fixed line that reproduces that ~30° lay and the right sag on any pair of trees. The strapheight endpoint estimates how high to attach the straps from the distance between the trees and the seat height you want, since trees farther apart need higher anchor points to hold the angle. Everything is computed locally and deterministically, so it is instant and private. Ideal for camping, backpacking, outdoor-gear and hammock app developers, hang-calculator and trip-planning tools, and adventure software. Pure local computation — no key, no third-party service, instant. Weight and lengths in your own unit. 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/hammock-api/..."
```

## Pricing
- **Free** (Free) — 6,960 calls/Mo, 2 req/s
- **Starter** ($4/Mo) — 55,300 calls/Mo, 6 req/s
- **Pro** ($12/Mo) — 227,300 calls/Mo, 15 req/s
- **Mega** ($38/Mo) — 1,337,000 calls/Mo, 40 req/s

## Endpoints

### Hammock

#### `GET /v1/force` — Suspension force at an angle

**Parameters:**
- `weight` (query, required, string) — Occupant weight Example: `200`
- `hang_angle_deg` (query, optional, string) — Hang angle from horizontal (default 30) Example: `30`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/hammock-api/v1/force?weight=200&hang_angle_deg=30"
```

**Response:**
```json
{
    "data": {
        "note": "Each suspension line carries weight ÷ (2 × sin(hang angle)). The classic 30° hang puts about one body weight on each strap; flatten to 15° and it nearly doubles to ~1.9×, which is why a tight, level hang stresses straps, trees and your back. Aim for ~30°.",
        "inputs": {
            "weight": 200,
            "hang_angle_deg": 30
        },
        "force_per_side": 200,
        "total_on_each_tree": 200,
        "multiple_of_body_weight": 1
    },
    "meta": {
        "timestamp": "2026-06-06T15:30:49.038Z",
        "request_id": "ef93194a-88cb-4354-bfe3-26086f17c35d"
    },
    "status": "ok",
    "message": "Suspension force",
    "success": true
}
```

#### `GET /v1/ridgeline` — Structural ridgeline length

**Parameters:**
- `hammock_length` (query, required, string) — Hammock length Example: `132`
- `ridgeline_percent` (query, optional, string) — Ridgeline % of length (default 83) Example: `83`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/hammock-api/v1/ridgeline?hammock_length=132&ridgeline_percent=83"
```

**Response:**
```json
{
    "data": {
        "note": "A structural ridgeline fixed at about 83 % of the hammock length gives the repeatable ~30° hang and the right amount of sag every time. Shorter ridgeline = tighter/flatter; longer = deeper. Set it once and your lay is consistent on any trees.",
        "inputs": {
            "hammock_length": 132,
            "ridgeline_percent": 83
        },
        "ridgeline_length": 109.56
    },
    "meta": {
        "timestamp": "2026-06-06T15:30:49.112Z",
        "request_id": "bf375a9f-1f39-46cd-8eef-d3a4a893a7a3"
    },
    "status": "ok",
    "message": "Ridgeline length",
    "success": true
}
```

#### `GET /v1/strapheight` — Strap attach height

**Parameters:**
- `tree_distance` (query, required, string) — Distance between trees Example: `144`
- `sit_height` (query, optional, string) — Desired seat height (default 18) Example: `18`
- `hang_angle_deg` (query, optional, string) — Hang angle (default 30) Example: `30`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/hammock-api/v1/strapheight?tree_distance=144&sit_height=18&hang_angle_deg=30"
```

**Response:**
```json
{
    "data": {
        "note": "Hang straps roughly the seat height plus the sag above the ground — taller trees (farther apart) need higher straps to keep the ~30° angle. Rule of thumb: 'foot in, head up' and the centre about chair-height off the ground; fine-tune by sliding the straps.",
        "inputs": {
            "sit_height": 18,
            "tree_distance": 144,
            "hang_angle_deg": 30
        },
        "line_rise_each_side": 41.6,
        "strap_attach_height": 61.2
    },
    "meta": {
        "timestamp": "2026-06-06T15:30:49.186Z",
        "request_id": "5424ddaf-a02d-460f-b44c-674bf03f061f"
    },
    "status": "ok",
    "message": "Strap height",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "The 30° hang is the sweet spot: force per line = weight ÷ (2·sin angle), so flatter hangs multiply the load fast. Ridgeline ≈ 83 % of hammock length. Weight/lengths in your own unit (output matches).",
        "service": "hammock-api",
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/force": "Tension in each suspension line at a given hang angle.",
            "GET /v1/ridgeline": "Structural ridgeline length for a hammock (≈ 83 %).",
            "GET /v1/strapheight": "Strap attachment height from tree distance and sit height."
        },
        "description": "Hammock-hang maths: suspension force at a hang angle, structural ridgeline length, and strap-attachment height."
    },
    "meta": {
        "timestamp": "2026-06-06T15:30:49.280Z",
        "request_id": "11c80686-a7a1-4c41-8945-1e3adc1b5acd"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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