# Fertilizer Calculator API
> Fertilizer maths as an API, computed locally and deterministically. The rate endpoint works out how much fertilizer product to apply to hit a target nitrogen rate over an area: from the N-P-K analysis (such as 10-10-10 or 20-5-10), a target pounds of nitrogen per 1000 ft² (or per 100 m²) and the area, it returns the product weight and the pounds of nitrogen, phosphate and potash applied. The nutrients endpoint reports the pounds of nitrogen, P₂O₅ and K₂O — and the elemental phosphorus and potassium — in a bag of a given weight and analysis. The coverage endpoint works out how much area a bag covers at a target nitrogen rate. N-P-K are percent by weight; phosphorus is reported as P₂O₅ and potassium as K₂O following the label convention, with the elemental amounts alongside (P₂O₅ × 0.4364, K₂O × 0.8301). Everything is computed locally and deterministically, so it is instant and private. Ideal for lawn-care and gardening apps, agriculture and turf tools, and landscaping and quoting software. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is fertilizer rate maths; for mulch, gravel and topsoil quantities use a landscaping 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/fertilizer-api/..."
```

## Pricing
- **Free** (Free) — 12,335 calls/Mo, 2 req/s
- **Starter** ($14/Mo) — 21,950 calls/Mo, 8 req/s
- **Pro** ($34/Mo) — 269,500 calls/Mo, 20 req/s
- **Mega** ($72/Mo) — 1,390,000 calls/Mo, 50 req/s

## Endpoints

### Fertilizer

#### `GET /v1/coverage` — Area a bag covers

**Parameters:**
- `analysis` (query, required, string) — N-P-K Example: `20-5-10`
- `bag_weight` (query, required, string) — Bag weight (lb) Example: `40`
- `target_n` (query, optional, string) — Target N per basis (default 1) Example: `1`
- `rate_basis` (query, optional, string) — 1000sqft|100sqm Example: `1000sqft`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/fertilizer-api/v1/coverage?analysis=20-5-10&bag_weight=40&target_n=1&rate_basis=1000sqft"
```

**Response:**
```json
{
    "data": {
        "note": "Area a bag covers at the target N rate = (N in bag ÷ target N per basis) × basis area.",
        "input": {
            "basis": "1000 ft²",
            "analysis": "20-5-10",
            "bag_weight_lb": 40,
            "target_n_per_basis": 1
        },
        "area_unit": "ft²",
        "area_covered": 8000,
        "nitrogen_in_bag_lb": 8,
        "basis_units_covered": 8
    },
    "meta": {
        "timestamp": "2026-06-04T01:59:13.971Z",
        "request_id": "b6fa6ca1-e6af-4f9c-9257-b56f3d8ce294"
    },
    "status": "ok",
    "message": "Bag coverage",
    "success": true
}
```

#### `GET /v1/nutrients` — Nutrient pounds in a bag

**Parameters:**
- `analysis` (query, required, string) — N-P-K Example: `20-5-10`
- `bag_weight` (query, required, string) — Bag weight (lb) Example: `40`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/fertilizer-api/v1/nutrients?analysis=20-5-10&bag_weight=40"
```

**Response:**
```json
{
    "data": {
        "note": "Pounds of nutrient in the bag. P is shown as P₂O₅ and K as K₂O (label) plus the elemental amount.",
        "input": {
            "analysis": "20-5-10",
            "bag_weight_lb": 40
        },
        "nutrients": {
            "k2o_lb": 4,
            "p2o5_lb": 2,
            "nitrogen_lb": 8,
            "potassium_lb": 3.3206,
            "phosphorus_lb": 0.8728
        }
    },
    "meta": {
        "timestamp": "2026-06-04T01:59:14.071Z",
        "request_id": "d121b28d-1dd0-42ba-9641-e5054ecd070f"
    },
    "status": "ok",
    "message": "Nutrients in a bag",
    "success": true
}
```

#### `GET /v1/rate` — Product for a target N rate

**Parameters:**
- `analysis` (query, required, string) — N-P-K e.g. 10-10-10 Example: `10-10-10`
- `target_n` (query, optional, string) — Target N per basis (default 1) Example: `1`
- `area` (query, required, string) — Area (ft² or m²) Example: `5000`
- `rate_basis` (query, optional, string) — 1000sqft|100sqm Example: `1000sqft`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/fertilizer-api/v1/rate?analysis=10-10-10&target_n=1&area=5000&rate_basis=1000sqft"
```

**Response:**
```json
{
    "data": {
        "note": "Product per 1000 ft² = target N ÷ (N% ÷ 100). Total = that × the number of 1000 ft² in the area.",
        "input": {
            "area": 5000,
            "basis": "1000 ft²",
            "analysis": "10-10-10",
            "target_n_per_basis": 1
        },
        "total_product_kg": 22.68,
        "total_product_lb": 50,
        "nutrients_applied": {
            "k2o_lb": 5,
            "p2o5_lb": 5,
            "nitrogen_lb": 5,
            "potassium_lb": 4.1507,
            "phosphorus_lb": 2.1821
        },
        "product_lb_per_basis": 10
    },
    "meta": {
        "timestamp": "2026-06-04T01:59:14.171Z",
        "request_id": "902ce3d0-89c2-4e30-9508-eac9e5281b9c"
    },
    "status": "ok",
    "message": "Fertilizer rate for an area",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "note": "Rates default to per 1000 ft² (US lawn convention); pass rate_basis=100sqm for metric. P₂O₅→P ×0.4364, K₂O→K ×0.8301.",
        "service": "fertilizer",
        "endpoints": {
            "/v1/rate": "Product needed to apply a target nitrogen rate over an area, with the nutrient breakdown.",
            "/v1/coverage": "How much area a bag covers at a target nitrogen rate.",
            "/v1/nutrients": "Pounds of N, P₂O₅/P and K₂O/K in a bag of a given weight and analysis."
        },
        "description": "Fertilizer maths: N-P-K analysis, product rate for a target nutrient over an area, nutrient pounds per bag, and bag coverage."
    },
    "meta": {
        "timestamp": "2026-06-04T01:59:14.259Z",
        "request_id": "8870ccdd-530d-49bc-a2e4-19c4556a7b00"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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