# Blood Type API
> Blood-type compatibility as an API, covering the ABO and Rh(D) systems, computed locally and deterministically. The compatibility endpoint says whether a given donor can give to a given recipient, for both red blood cells and plasma — the red-cell rule being that the donor's antigens must be a subset of the recipient's (Rh included), and plasma being the reverse and ignoring Rh. The info endpoint describes a blood type: the antigens it carries, the antibodies in its plasma, every type it can receive red cells from and donate red cells to, who it can give plasma to, whether it is a universal red-cell donor (O−), universal red-cell recipient (AB+) or universal plasma donor (AB), and its approximate US population frequency. The donors endpoint lists every compatible donor type for a recipient, for red cells or plasma. Blood types are accepted in many forms (O-, O neg, AB positive, …). Everything is computed locally and deterministically, so it is instant and private. This is educational only — real transfusion requires laboratory cross-matching and clinical judgement, and it is not medical advice. Ideal for medical-education and first-aid apps, blood-donation and health tools, and quiz and reference sites. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is ABO/Rh compatibility; for a drug reference database use a drug 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/bloodtype-api/..."
```

## Pricing
- **Free** (Free) — 11,535 calls/Mo, 2 req/s
- **Starter** ($13/Mo) — 21,150 calls/Mo, 8 req/s
- **Pro** ($33/Mo) — 261,500 calls/Mo, 20 req/s
- **Mega** ($71/Mo) — 1,350,000 calls/Mo, 50 req/s

## Endpoints

### Blood

#### `GET /v1/compatibility` — Donor → recipient compatibility

**Parameters:**
- `donor` (query, required, string) — Donor blood type Example: `O-`
- `recipient` (query, required, string) — Recipient blood type Example: `AB+`
- `component` (query, optional, string) — rbc|plasma (default rbc) Example: `rbc`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/bloodtype-api/v1/compatibility?donor=O-&recipient=AB%2B&component=rbc"
```

**Response:**
```json
{
    "data": {
        "note": "Red-cell rule: donor antigens must be a subset of the recipient's (Rh included). Plasma is the reverse and ignores Rh.",
        "input": {
            "donor": "O-",
            "component": "rbc",
            "recipient": "AB+"
        },
        "compatible": true,
        "disclaimer": "Educational only — actual transfusion requires laboratory cross-matching and clinical judgement. Not medical advice.",
        "rbc_compatible": true,
        "plasma_compatible": false
    },
    "meta": {
        "timestamp": "2026-06-04T01:59:17.004Z",
        "request_id": "7d3668f9-92e4-4ccf-a07f-65672e46b8d0"
    },
    "status": "ok",
    "message": "Donor/recipient compatibility",
    "success": true
}
```

#### `GET /v1/donors` — Compatible donors for a recipient

**Parameters:**
- `recipient` (query, required, string) — Recipient blood type Example: `A+`
- `component` (query, optional, string) — rbc|plasma Example: `rbc`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/bloodtype-api/v1/donors?recipient=A%2B&component=rbc"
```

**Response:**
```json
{
    "data": {
        "note": "Red-cell donors this recipient can safely receive from.",
        "input": {
            "component": "rbc",
            "recipient": "A+"
        },
        "disclaimer": "Educational only — actual transfusion requires laboratory cross-matching and clinical judgement. Not medical advice.",
        "donor_count": 4,
        "compatible_donors": [
            "O-",
            "O+",
            "A-",
            "A+"
        ]
    },
    "meta": {
        "timestamp": "2026-06-04T01:59:17.083Z",
        "request_id": "7e3f3f5b-abd4-41f0-b356-68c9881c2d3d"
    },
    "status": "ok",
    "message": "Compatible donors",
    "success": true
}
```

#### `GET /v1/info` — Blood type details

**Parameters:**
- `type` (query, required, string) — Blood type Example: `A+`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/bloodtype-api/v1/info?type=A%2B"
```

**Response:**
```json
{
    "data": {
        "note": "Antigens present, plasma antibodies, and RBC/plasma compatibility for this type.",
        "type": "A+",
        "antigens": [
            "A",
            "RhD"
        ],
        "disclaimer": "Educational only — actual transfusion requires laboratory cross-matching and clinical judgement. Not medical advice.",
        "plasma_antibodies": [
            "anti-B"
        ],
        "rbc_can_donate_to": [
            "A+",
            "AB+"
        ],
        "universal_rbc_donor": false,
        "plasma_can_donate_to": [
            "O-",
            "O+",
            "A-",
            "A+"
        ],
        "rbc_can_receive_from": [
            "O-",
            "O+",
            "A-",
            "A+"
        ],
        "us_frequency_percent": 35.7,
        "universal_plasma_donor": false,
        "universal_rbc_recipient": false
    },
    "meta": {
        "timestamp": "2026-06-04T01:59:17.160Z",
        "request_id": "49d6cf00-b596-4950-b9eb-c3756da3b360"
    },
    "status": "ok",
    "message": "Blood type info",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "note": "Educational only. Educational only — actual transfusion requires laboratory cross-matching and clinical judgement. Not medical advice.",
        "types": [
            "O-",
            "O+",
            "A-",
            "A+",
            "B-",
            "B+",
            "AB-",
            "AB+"
        ],
        "service": "bloodtype",
        "endpoints": {
            "/v1/info": "Antigens, antibodies, who a type can give to / receive from, and frequency.",
            "/v1/donors": "All compatible donor types for a recipient (red cells or plasma).",
            "/v1/compatibility": "Whether a donor can give to a recipient (red cells and plasma)."
        },
        "description": "ABO + Rh blood-type compatibility: red-cell and plasma donor/recipient rules, antigens/antibodies and population frequency."
    },
    "meta": {
        "timestamp": "2026-06-04T01:59:17.244Z",
        "request_id": "5ab2bf1a-af68-45c1-b484-b979232af363"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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