# Hay Bale Weight API
> Hay and forage bale maths as an API, computed locally and deterministically — the weight, dry-matter and feed-supply numbers a rancher, hay producer or livestock manager plans winter feed with. The round-bale endpoint gives the weight from the cylinder volume (π·r²·width) × the dry-matter density (typically ~9–12 lb/ft³ for cured hay), so a 5×5 ft bale runs about 1,000 lb, and reports the dry-matter weight (≈88 % of as-fed) that actually feeds the animals — buy and ration on dry matter, not gate weight. The square-bale endpoint gives the weight of a rectangular bale from its length, width and height (÷ 1,728 for cubic feet from inches) × the density — a typical 14×18×36-inch small square is about 50 lb, big 3×3 or 4×4 ft bales hundreds — with a reminder that high moisture both adds weight and risks mould and barn-fire heating. The feed-supply endpoint sizes the stack: feed needed = head × daily intake × days (cattle eat ~2–2.5 % of bodyweight, about 25–30 lb of dry matter for a beef cow), and bales = that ÷ the bale weight, so 30 cows for 120 days at 30 lb is about 108 thousand-pound bales — add 10–20 % for feeding waste. Everything is computed locally and deterministically, so it is instant and private. Ideal for ranch- and farm-management tools, hay-trading and livestock apps, and ag calculators. Pure local computation — no key, no third-party service, instant. US units; densities are estimates. 3 compute endpoints. For grain storage use a grain-bin API; for rotational grazing a grazing 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/baleweight-api/..."
```

## Pricing
- **Free** (Free) — 7,250 calls/Mo, 2 req/s
- **Starter** ($9/Mo) — 75,500 calls/Mo, 6 req/s
- **Pro** ($29/Mo) — 320,000 calls/Mo, 15 req/s
- **Mega** ($90/Mo) — 1,500,000 calls/Mo, 40 req/s

## Endpoints

### Bale

#### `GET /v1/feed-supply` — Bales needed to feed a herd

**Parameters:**
- `bale_weight_lb` (query, required, string) — Weight per bale (lb) Example: `1000`
- `animal_count` (query, required, string) — Number of animals Example: `30`
- `daily_intake_lb_per_head` (query, required, string) — Daily intake per head (lb) Example: `30`
- `days` (query, required, string) — Number of days Example: `120`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/baleweight-api/v1/feed-supply?bale_weight_lb=1000&animal_count=30&daily_intake_lb_per_head=30&days=120"
```

**Response:**
```json
{
    "data": {
        "note": "Feed needed = head × daily intake × days; bales = that ÷ the bale weight. Cattle eat roughly 2–2.5 % of bodyweight per day in dry matter (about 25–30 lb for a beef cow), so 30 cows for 120 days at 30 lb each is 108,000 lb — about 108 thousand-pound bales. Add 10–20 % for feeding waste and refusal, more if bales are fed on the ground without a ring.",
        "inputs": {
            "days": 120,
            "animal_count": 30,
            "bale_weight_lb": 1000,
            "daily_intake_lb_per_head": 30
        },
        "whole_bales": 108,
        "bales_needed": 108,
        "total_feed_lb": 108000
    },
    "meta": {
        "timestamp": "2026-06-07T08:17:59.288Z",
        "request_id": "fd294a63-0728-4c94-b74c-0ef2295ed85c"
    },
    "status": "ok",
    "message": "Feed supply",
    "success": true
}
```

#### `GET /v1/round-bale` — Round-bale weight and dry matter

**Parameters:**
- `diameter_ft` (query, required, string) — Bale diameter (ft) Example: `5`
- `width_ft` (query, required, string) — Bale width (ft) Example: `5`
- `density_lb_ft3` (query, optional, string) — Density (lb/ft³, default 10) Example: `10`
- `dry_matter_pct` (query, optional, string) — Dry matter % (default 88) Example: `88`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/baleweight-api/v1/round-bale?diameter_ft=5&width_ft=5&density_lb_ft3=10&dry_matter_pct=88"
```

**Response:**
```json
{
    "data": {
        "note": "A round bale's weight = its cylinder volume (π·r²·width) × the dry-matter density (typically ~9–12 lb/ft³ for dry hay — wetter, tighter bales weigh more). A 5×5 ft bale runs roughly 1,000 lb. The dry-matter weight (≈88 % of as-fed for cured hay) is what actually feeds the animals, so buy and ration on dry matter, not the gate weight.",
        "inputs": {
            "width_ft": 5,
            "diameter_ft": 5,
            "density_lb_ft3": 10,
            "dry_matter_pct": 88
        },
        "weight_lb": 982,
        "volume_ft3": 98.17,
        "dry_matter_lb": 864
    },
    "meta": {
        "timestamp": "2026-06-07T08:17:59.364Z",
        "request_id": "ef95c6fb-c074-44c3-bb45-993041d2ee0a"
    },
    "status": "ok",
    "message": "Round bale",
    "success": true
}
```

#### `GET /v1/square-bale` — Square-bale weight

**Parameters:**
- `length_in` (query, required, string) — Length (inches) Example: `36`
- `width_in` (query, required, string) — Width (inches) Example: `18`
- `height_in` (query, required, string) — Height (inches) Example: `14`
- `density_lb_ft3` (query, optional, string) — Density (lb/ft³, default 10) Example: `10`
- `dry_matter_pct` (query, optional, string) — Dry matter % (default 88) Example: `88`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/baleweight-api/v1/square-bale?length_in=36&width_in=18&height_in=14&density_lb_ft3=10&dry_matter_pct=88"
```

**Response:**
```json
{
    "data": {
        "note": "A square (rectangular) bale's weight = length × width × height (÷ 1,728 for cubic feet from inches) × the density. A typical 14×18×36-inch small square is about 50 lb; big 3×3 or 4×4 ft bales run hundreds. Tighter packing and higher moisture both raise the weight — and high moisture risks mould and barn-fire heating, so bale dry hay below ~18 % moisture.",
        "inputs": {
            "width_in": 18,
            "height_in": 14,
            "length_in": 36,
            "density_lb_ft3": 10,
            "dry_matter_pct": 88
        },
        "weight_lb": 52.5,
        "volume_ft3": 5.25,
        "dry_matter_lb": 46.2
    },
    "meta": {
        "timestamp": "2026-06-07T08:17:59.461Z",
        "request_id": "d2482871-7ad5-442a-bf24-ee44976ce6ce"
    },
    "status": "ok",
    "message": "Square bale",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "US units (ft, in, lb/ft³, lb). round = π·r²·width·density; square = L·W·H/1728·density; bales = head·intake·days/bale weight. Dry hay ~9–12 lb/ft³, ~88 % DM. For grain storage use a grain-bin API; for rotational grazing a grazing API.",
        "service": "baleweight-api",
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/round-bale": "Round-bale volume, weight and dry matter.",
            "GET /v1/feed-supply": "Bales needed to feed a herd for a period.",
            "GET /v1/square-bale": "Square-bale weight from length/width/height."
        },
        "description": "Hay/forage bale maths: round and square bale weight from size and density, and bales needed to feed a herd."
    },
    "meta": {
        "timestamp": "2026-06-07T08:17:59.574Z",
        "request_id": "bd07db47-0245-4129-9cd9-0ddb1a53bb38"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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