# Grain Bin API
> Grain-bin storage maths as an API, computed locally and deterministically — the bushel and weight numbers a farmer or elevator sizes storage by. The bushels endpoint measures a round bin: floor area × grain depth gives the cubic feet, and a cubic foot holds about 0.8036 bushels, so an 18-foot bin filled 20 feet level holds roughly 4,090 bushels — and grain heaped to a peak adds a cone of (1/3) × floor area × peak height, so a 4-foot peak adds about 270 more. The weight endpoint converts bushels to weight by the crop’s standard test weight — corn and sorghum at 56 pounds a bushel, wheat and soybeans 60, oats 32, barley 48 — so those 4,090 bushels of corn weigh 229,040 pounds, about 114.5 US tons or 104 tonnes; pass a measured test weight for light or heavy grain. Everything is computed locally and deterministically, so it is instant and private. Ideal for agriculture, grain-elevator, farm-management and ag-tech app developers, storage-capacity and inventory tools, and harvest software. Pure local computation — no key, no third-party service, instant. US units (feet, bushels, pounds). Live, nothing stored. 2 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/grainbin-api/..."
```

## Pricing
- **Free** (Free) — 6,380 calls/Mo, 2 req/s
- **Starter** ($4/Mo) — 53,100 calls/Mo, 6 req/s
- **Pro** ($12/Mo) — 223,000 calls/Mo, 15 req/s
- **Mega** ($39/Mo) — 1,303,000 calls/Mo, 40 req/s

## Endpoints

### GrainBin

#### `GET /v1/bushels` — Bushels in a round bin

**Parameters:**
- `diameter_ft` (query, required, string) — Bin diameter (ft) Example: `18`
- `fill_height_ft` (query, required, string) — Level grain depth (ft) Example: `20`
- `peak_height_ft` (query, optional, string) — Cone peak height above level (ft) Example: `0`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/grainbin-api/v1/bushels?diameter_ft=18&fill_height_ft=20&peak_height_ft=0"
```

**Response:**
```json
{
    "data": {
        "note": "A round bin holds floor area × grain depth in cubic feet, and 1 ft³ ≈ 0.8036 bushels. Grain heaped to a peak adds a cone: (1/3) × floor area × peak height. An 18-ft bin filled 20 ft level holds about 4,090 bushels.",
        "inputs": {
            "diameter_ft": 18,
            "fill_height_ft": 20,
            "peak_height_ft": 0
        },
        "peak_bushels": 0,
        "level_bushels": 4090,
        "total_bushels": 4090,
        "floor_area_sqft": 254.5,
        "total_cubic_feet": 5089.4
    },
    "meta": {
        "timestamp": "2026-06-06T15:30:50.135Z",
        "request_id": "d035f950-c13b-42a4-8b22-ad059aa3bb3d"
    },
    "status": "ok",
    "message": "Bin bushels",
    "success": true
}
```

#### `GET /v1/weight` — Grain weight from bushels

**Parameters:**
- `bushels` (query, required, string) — Number of bushels Example: `4090`
- `crop` (query, optional, string) — corn, wheat, soybeans, oats, barley, … Example: `corn`
- `test_weight_lb` (query, optional, string) — Measured test weight (lb/bu)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/grainbin-api/v1/weight?bushels=4090&crop=corn"
```

**Response:**
```json
{
    "data": {
        "note": "Weight = bushels × the crop's standard test weight (corn & sorghum 56 lb/bu, wheat/soybeans 60, oats 32, barley 48). Test weight is a quality measure too — light grain weighs less per bushel than the standard.",
        "inputs": {
            "crop": "corn",
            "bushels": 4090,
            "test_weight_lb": 56
        },
        "total_pounds": 229040,
        "total_us_tons": 114.52,
        "total_metric_tonnes": 103.89,
        "test_weight_lb_per_bu": 56
    },
    "meta": {
        "timestamp": "2026-06-06T15:30:50.232Z",
        "request_id": "4303719a-8e92-40d4-9916-f4a5370096ea"
    },
    "status": "ok",
    "message": "Grain weight",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "Round bins: bushels = (π/4·d²·depth) × 0.8036; peak adds (1/3)·area·peak. Test weights: corn 56, wheat/soy 60, oats 32, barley 48 lb/bu. Feet and bushels. For grain-drying or aeration use a different tool.",
        "service": "grainbin-api",
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/weight": "Grain weight (lb / tons / tonnes) from bushels by crop test weight.",
            "GET /v1/bushels": "Bushels in a round bin from diameter, fill height and an optional peak."
        },
        "description": "Grain-bin storage maths: bushels in a round bin (level fill plus cone peak), and grain weight from bushels by crop."
    },
    "meta": {
        "timestamp": "2026-06-06T15:30:50.327Z",
        "request_id": "913c0e54-3e55-44c0-bfea-62a5d6847826"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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