# Alcohol & ABV API
> Alcohol and cocktail maths as an API, computed locally and deterministically — the ABV, dilution and standard-drink numbers a bartender, brewer or drinks app works out behind the bar. The abv endpoint mixes a drink: pass the ingredients as a volume:abv list and it returns the final alcohol by volume = (sum of volume × ABV) ÷ total volume, so a Negroni-style 2 parts at 40 %, 1 at 20 % and 1 mixer at 0 % lands at 25 % ABV (50 US proof), with mixers diluting the result. The dilution endpoint models ice melt and stirring, which add water and drop the strength: final volume = volume × (1 + dilution) and ABV falls by the same factor while the alcohol itself is unchanged, so a 4 oz stirred drink at 25 % with 25 % dilution becomes 5 oz at 20 % — stirred drinks pick up roughly 20–25 %, shaken a little more. The standard endpoint counts the dose: pure alcohol = volume × ABV, then a US standard drink is 14 grams (0.6 fl oz) and a UK unit is 10 ml of pure alcohol, so a 12 fl oz beer at 5 % is one standard drink (14 g, 1.77 UK units) and a 5 fl oz glass of 12 % wine is one too. Everything is computed locally and deterministically, so it is instant and private. Ideal for bartending, brewing, beverage, hospitality and responsible-drinking app developers, cocktail-builder and drink-tracker tools, and bar-menu calculators. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 compute endpoints. For drink recipes use a cocktails database 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/abv-api/..."
```

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

## Endpoints

### Alcohol

#### `GET /v1/abv` — Mixed-drink ABV

**Parameters:**
- `ingredients` (query, required, string) — Comma list of 'volume:abv' Example: `2:40,1:20,1:0`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/abv-api/v1/abv?ingredients=2%3A40%2C1%3A20%2C1%3A0"
```

**Response:**
```json
{
    "data": {
        "note": "Final ABV = (sum of volume × abv) ÷ total volume. Mixers at 0 % dilute it. US proof is twice the ABV. This is the ABV before any ice melt — see /v1/dilution for that.",
        "inputs": {
            "ingredients": [
                {
                    "abv": 40,
                    "volume": 2
                },
                {
                    "abv": 20,
                    "volume": 1
                },
                {
                    "abv": 0,
                    "volume": 1
                }
            ]
        },
        "proof_us": 50,
        "total_volume": 4,
        "alcohol_volume": 1,
        "final_abv_percent": 25
    },
    "meta": {
        "timestamp": "2026-06-06T07:14:04.102Z",
        "request_id": "3238dbae-4a2e-43ab-b04f-9abdb41a49c5"
    },
    "status": "ok",
    "message": "Mixed ABV",
    "success": true
}
```

#### `GET /v1/dilution` — Ice / stirring dilution

**Parameters:**
- `volume` (query, required, string) — Starting volume Example: `4`
- `abv` (query, required, string) — Starting ABV % Example: `25`
- `dilution_percent` (query, optional, string) — Added water as % of volume (default 25) Example: `25`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/abv-api/v1/dilution?volume=4&abv=25&dilution_percent=25"
```

**Response:**
```json
{
    "data": {
        "note": "Ice melt adds water: final volume = volume × (1 + dilution); ABV drops by the same factor (alcohol amount is unchanged). Stirred drinks pick up ~20–25 %, shaken ~25–30 %, builds less. Defaults to 25 %.",
        "inputs": {
            "abv": 25,
            "volume": 4,
            "dilution_percent": 25
        },
        "water_added": 1,
        "final_volume": 5,
        "final_abv_percent": 20
    },
    "meta": {
        "timestamp": "2026-06-06T07:14:04.205Z",
        "request_id": "e8044773-ed1d-4b7a-b9c8-53272b3494fc"
    },
    "status": "ok",
    "message": "Dilution",
    "success": true
}
```

#### `GET /v1/standard` — Standard drinks + units

**Parameters:**
- `volume` (query, required, string) — Volume Example: `12`
- `abv` (query, required, string) — ABV % Example: `5`
- `unit` (query, optional, string) — floz or ml (default floz) Example: `floz`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/abv-api/v1/standard?volume=12&abv=5&unit=floz"
```

**Response:**
```json
{
    "data": {
        "note": "Pure alcohol = volume × ABV. A US standard drink is 14 g (0.6 fl oz) of pure alcohol; a UK unit is 10 ml. A 12 fl oz beer at 5 % ≈ 1 standard drink; a 5 fl oz glass of 12 % wine ≈ 1 too.",
        "inputs": {
            "abv": 5,
            "unit": "floz",
            "volume": 12
        },
        "uk_units": 1.77,
        "volume_ml": 354.88,
        "pure_alcohol_ml": 17.74,
        "pure_alcohol_grams": 14,
        "us_standard_drinks": 1
    },
    "meta": {
        "timestamp": "2026-06-06T07:14:04.310Z",
        "request_id": "14bb5b32-2621-4c42-a535-d20fcf83006a"
    },
    "status": "ok",
    "message": "Standard drinks",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "Ethanol density 0.789 g/ml; US standard drink = 14 g; UK unit = 10 ml; 1 fl oz = 29.5735 ml. Volumes in /v1/abv can be any single consistent unit. For drink recipes use a cocktails database API.",
        "service": "abv-api",
        "endpoints": {
            "GET /v1/abv": "Final ABV (and US proof) of a mixed drink from a 'volume:abv' ingredient list.",
            "GET /v1/meta": "This document.",
            "GET /v1/dilution": "Volume and ABV after ice-melt / stirring dilution.",
            "GET /v1/standard": "US standard drinks, UK units and grams of alcohol for a volume at an ABV."
        },
        "description": "Alcohol / cocktail maths: final ABV of a mixed drink, dilution from ice, and standard-drink / unit counting."
    },
    "meta": {
        "timestamp": "2026-06-06T07:14:04.407Z",
        "request_id": "5aa482de-ba24-49d0-921f-a547a8d0f319"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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