# Vegetable Fermentation API
> Vegetable lacto-fermentation maths as an API, computed locally and deterministically — the salt numbers a fermenter weighs sauerkraut, kimchi and pickles by. (Vegetables, not meat — for cure and nitrite that is a separate calculation.) Salt is the whole game: too little and the wrong microbes win, too much and the ferment stalls. The salt endpoint does the dry-salt method for shredded veg, salt = vegetable weight × percent, with about 2 % being the classic sauerkraut and kimchi target — so a kilo of cabbage takes 20 grams — and it bands the result from low-and-fast to a near salt-cure. The brine endpoint sizes a submerged ferment, salt = water weight × percent where the percent is of the water as recipes state it (1 ml water ≈ 1 g), so a litre at 5 % needs 50 grams for a standard sour pickle, 3.5 % for a milder one; it also reports the salinity as a percent of the total solution. The salinity endpoint converts the two ways the same brine is expressed — percent of water versus percent of total — so a 5 %-of-water brine reads about 4.76 % on a refractometer. Everything is computed locally and deterministically, so it is instant and private. Ideal for fermentation, homesteading, recipe and food app developers, ferment-calculator and batch tools, and culinary software. Pure local computation — no key, no third-party service, instant. Grams and ml. 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/fermentation-api/..."
```

## Pricing
- **Free** (Free) — 6,920 calls/Mo, 2 req/s
- **Starter** ($4/Mo) — 56,400 calls/Mo, 6 req/s
- **Pro** ($12/Mo) — 231,200 calls/Mo, 15 req/s
- **Mega** ($37/Mo) — 1,347,000 calls/Mo, 40 req/s

## Endpoints

### Ferment

#### `GET /v1/brine` — Brine salt for water

**Parameters:**
- `water_g` (query, required, string) — Water weight/volume (g/ml) Example: `1000`
- `brine_percent` (query, optional, string) — Brine % of water (default 5) Example: `5`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/fermentation-api/v1/brine?water_g=1000&brine_percent=5"
```

**Response:**
```json
{
    "data": {
        "note": "Brine method (cucumbers, peppers, whole veg kept under liquid): salt = water weight × percent, where the percent is of the WATER (the usual recipe convention). 3.5 % is a mild pickle, 5 % a standard sour, 5–7 % for firm or warm-climate ferments. 1 ml water ≈ 1 g.",
        "inputs": {
            "water_g": 1000,
            "brine_percent": 5
        },
        "salt_g": 50,
        "salinity_of_total_percent": 4.76
    },
    "meta": {
        "timestamp": "2026-06-06T15:30:52.370Z",
        "request_id": "c204890c-9ebe-470f-844f-9623d8619c2e"
    },
    "status": "ok",
    "message": "Brine salt",
    "success": true
}
```

#### `GET /v1/salinity` — Salinity from salt + water

**Parameters:**
- `salt_g` (query, required, string) — Salt (g) Example: `50`
- `water_g` (query, required, string) — Water (g/ml) Example: `1000`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/fermentation-api/v1/salinity?salt_g=50&water_g=1000"
```

**Response:**
```json
{
    "data": {
        "note": "Two ways to express the same brine: percent of the water (the recipe convention) and percent of the total solution (what a refractometer or hydrometer reads). For a 5 %-of-water brine, the total reads about 4.76 %.",
        "inputs": {
            "salt_g": 50,
            "water_g": 1000
        },
        "percent_of_total": 4.76,
        "percent_of_water": 5
    },
    "meta": {
        "timestamp": "2026-06-06T15:30:52.445Z",
        "request_id": "ff0ba80c-0902-4375-9555-0252e67b89a1"
    },
    "status": "ok",
    "message": "Salinity",
    "success": true
}
```

#### `GET /v1/salt` — Dry salt by vegetable weight

**Parameters:**
- `vegetable_g` (query, required, string) — Vegetable weight (g) Example: `1000`
- `salt_percent` (query, optional, string) — Salt % of veg (default 2) Example: `2`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/fermentation-api/v1/salt?vegetable_g=1000&salt_percent=2"
```

**Response:**
```json
{
    "data": {
        "band": "standard (~2 % is the sauerkraut/kimchi sweet spot)",
        "note": "Dry-salt method (sauerkraut, kimchi): salt = vegetable weight × percent. About 2 % by weight is the classic target — enough to draw brine and favour lactobacillus while keeping it crisp. Weigh the trimmed, shredded veg. ~6 g of fine salt ≈ 1 tsp.",
        "inputs": {
            "vegetable_g": 1000,
            "salt_percent": 2
        },
        "salt_g": 20,
        "salt_tsp_approx": 3.33
    },
    "meta": {
        "timestamp": "2026-06-06T15:30:52.554Z",
        "request_id": "2ef33090-a76c-48de-838c-ba909e781e3c"
    },
    "status": "ok",
    "message": "Dry salt",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "Grams and ml (1 ml water ≈ 1 g). Dry-salt ~2 % of veg weight; brine ~3.5–7 % of water. Vegetable fermentation only — for meat cure and nitrite use a curing API. Keep everything under the brine and to taste.",
        "service": "fermentation-api",
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/salt": "Dry salt (sauerkraut/kimchi) as a percent of vegetable weight.",
            "GET /v1/brine": "Salt for a water volume at a target brine salinity.",
            "GET /v1/salinity": "Resulting salinity (% of water and of total) from salt and water."
        },
        "description": "Vegetable lacto-fermentation maths: dry-salt by vegetable weight, brine salinity for submerged ferments, and salinity from salt and water."
    },
    "meta": {
        "timestamp": "2026-06-06T15:30:52.635Z",
        "request_id": "f42789bd-1e90-48de-b4ca-40b215b1e222"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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