# Blackjack Strategy API
> Blackjack maths as an API, computed locally and deterministically and exactly — the hand value, the textbook basic-strategy play and the dealer odds, the numbers that hold the house edge to half a percent. The hand-value endpoint scores a hand the way the table does: aces count 11 unless that busts, then 1, so it reports the best total, whether it is soft (an ace still counting 11, safe to hit) or hard, whether it busts, and whether two cards make a blackjack. The strategy endpoint gives the correct basic-strategy action — hit, stand, double or split — for any hand against the dealer's upcard, for the standard 4-to-8-deck game where the dealer stands on soft 17 with double-after-split allowed: 16 against a 10 hits, a pair of 8s always splits, soft 18 doubles against a 6 but hits against a 9, and 11 doubles against everything but an ace. The dealer-odds endpoint gives the dealer's bust probability by upcard — a 5 or 6 busts about 42 % of the time, an ace only 12 % — the reason you stand on stiffs against weak upcards. Everything is computed locally and deterministically, so it is instant and exact. Ideal for blackjack trainers and strategy apps, card-game and casino-game tools, learning aids, and game back-ends. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 compute endpoints. Educational — not betting advice; the house always keeps an edge.

## 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/blackjack-api/..."
```

## Pricing
- **Free** (Free) — 7,000 calls/Mo, 2 req/s
- **Starter** ($4/Mo) — 95,000 calls/Mo, 8 req/s
- **Pro** ($12/Mo) — 380,000 calls/Mo, 20 req/s
- **Mega** ($37/Mo) — 1,650,000 calls/Mo, 48 req/s

## Endpoints

### Blackjack

#### `GET /v1/dealer-odds` — Dealer bust probability

**Parameters:**
- `dealer` (query, required, string) — Dealer upcard (2-10, j, q, k, a) Example: `6`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/blackjack-api/v1/dealer-odds?dealer=6"
```

**Response:**
```json
{
    "data": {
        "note": "Dealer bust probability by upcard, standing on soft 17. A 5 or 6 up is the dealer's weakest (busts ~42 %) — the 'bust cards' you press your bets and stand more against; a 7-through-ace up is strong, so you hit your stiffs harder. Approximate infinite-deck figures.",
        "inputs": {
            "dealer": "6"
        },
        "bust_probability_pct": 42.3
    },
    "meta": {
        "timestamp": "2026-06-06T15:30:39.826Z",
        "request_id": "9ec501b4-291f-42f5-aa7c-ee3a36820b2b"
    },
    "status": "ok",
    "message": "Dealer odds",
    "success": true
}
```

#### `GET /v1/hand-value` — Best hand value

**Parameters:**
- `cards` (query, required, string) — Comma-separated cards (2-10, j, q, k, a) Example: `a,7`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/blackjack-api/v1/hand-value?cards=a%2C7"
```

**Response:**
```json
{
    "data": {
        "note": "Aces count 11 unless that busts the hand, then 1 — a 'soft' total still has an ace counted as 11, so it can't bust on the next card. A two-card 21 is a blackjack (pays 3:2). Hit a soft hand freely; a hard 12–16 is the danger zone.",
        "soft": true,
        "total": 18,
        "inputs": {
            "cards": "a,7"
        },
        "is_bust": false,
        "is_blackjack": false
    },
    "meta": {
        "timestamp": "2026-06-06T15:30:39.911Z",
        "request_id": "1c09f7f2-9fea-47e3-8bcc-56390d0e3416"
    },
    "status": "ok",
    "message": "Hand value",
    "success": true
}
```

#### `GET /v1/strategy` — Basic-strategy action

**Parameters:**
- `cards` (query, required, string) — Your cards (e.g. 8,8 or a,7) Example: `8,8`
- `dealer` (query, required, string) — Dealer upcard (2-10, j, q, k, a) Example: `10`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/blackjack-api/v1/strategy?cards=8%2C8&dealer=10"
```

**Response:**
```json
{
    "data": {
        "note": "Basic strategy for 4–8 decks, dealer stands on soft 17, double-after-split allowed. Double and split apply only to a fresh two-card hand; otherwise hit or stand. Following basic strategy holds the house edge to about half a percent — but it is a guide, not a guarantee on any single hand.",
        "soft": false,
        "basis": "pair",
        "total": 16,
        "action": "P",
        "inputs": {
            "cards": "8,8",
            "dealer": "10"
        },
        "action_label": "split"
    },
    "meta": {
        "timestamp": "2026-06-06T15:30:40.018Z",
        "request_id": "e13f818b-8f86-4b61-839d-dd14cb565de6"
    },
    "status": "ok",
    "message": "Basic strategy",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "4–8 deck, dealer stands soft 17, DAS. Cards: 2-10, j/q/k, a. Strategy double/split assume a two-card hand. Educational — not betting advice; the house always keeps an edge.",
        "service": "blackjack-api",
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/strategy": "Basic-strategy action (hit/stand/double/split) for a hand vs a dealer upcard.",
            "GET /v1/hand-value": "Best total, soft/hard, bust and blackjack for a set of cards.",
            "GET /v1/dealer-odds": "Dealer bust probability by upcard."
        },
        "description": "Blackjack maths: best hand value, the basic-strategy action for a hand vs a dealer upcard, and the dealer's bust probability by upcard."
    },
    "meta": {
        "timestamp": "2026-06-06T15:30:40.112Z",
        "request_id": "b12aae84-426f-43c9-95fd-67d1def2147c"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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