# Gold Purity API
> Gold purity and karat maths as an API, computed locally and deterministically — the karat, fineness and alloy numbers a jeweller, goldsmith, assayer or refiner works to. The karat-to-fineness endpoint converts between the two purity systems: karat is the number of 24ths of a piece that is pure gold, so the fineness (parts per thousand, the figure on a hallmark stamp) = karat ÷ 24 × 1000 and the gold percentage = karat ÷ 24 × 100 — 24K is pure (1000‰), 18K is 750‰ (75 %), 14K is 583‰, 9K is 375‰. The pure-gold-weight endpoint gives the actual fine gold in a piece = its total weight × the gold fraction (karat ÷ 24): a 10 g 18K ring holds 7.5 g of gold and 2.5 g of alloy, the fine-gold content a refiner pays on and the basis of the intrinsic metal value. The alloy-mix endpoint inverts it for the bench: to bring refined fine gold down to a target karat, the total weight = the fine gold ÷ (target karat ÷ 24) and the alloy to add = the total − the fine gold, so 7.5 g of pure gold makes 10 g of 18K with 2.5 g of master alloy. Everything is computed locally and deterministically, so it is instant and private. Ideal for jewellery and goldsmithing tools, pawn and scrap-gold apps, and assay and metal-value calculators. Pure local computation — no key, no third-party service, instant. Purity maths only — it does not fetch the live gold price. 3 compute endpoints. For a metal part's weight from its dimensions use a metal-weight 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/goldpurity-api/..."
```

## Pricing
- **Free** (Free) — 6,800 calls/Mo, 2 req/s
- **Starter** ($7/Mo) — 60,000 calls/Mo, 6 req/s
- **Pro** ($25/Mo) — 248,000 calls/Mo, 15 req/s
- **Mega** ($76/Mo) — 1,150,000 calls/Mo, 40 req/s

## Endpoints

### Gold

#### `GET /v1/alloy-mix` — Alloy to add for a target karat

**Parameters:**
- `pure_gold_g` (query, required, string) — Fine gold mass (g) Example: `7.5`
- `target_karat` (query, required, string) — Target karat (0.1–24) Example: `18`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/goldpurity-api/v1/alloy-mix?pure_gold_g=7.5&target_karat=18"
```

**Response:**
```json
{
    "data": {
        "note": "To bring fine gold down to a target karat, the fine gold must end up as karat ÷ 24 of the total, so the total weight = the fine gold ÷ that fraction and the alloy to add = the total − the fine gold. Starting from 7.5 g of pure gold for 18K gives a 10 g total, so add 2.5 g of alloy. Lower karats need more alloy; 24K needs none. This is the master-alloy batching a goldsmith does to hit a karat from refined gold.",
        "inputs": {
            "pure_gold_g": 7.5,
            "target_karat": 18
        },
        "alloy_to_add_g": 2.5,
        "total_weight_g": 10,
        "target_fineness_permille": 750
    },
    "meta": {
        "timestamp": "2026-06-07T08:17:54.510Z",
        "request_id": "516eb088-4b6d-4e44-8c6d-1f9601d7bac1"
    },
    "status": "ok",
    "message": "Alloy mix",
    "success": true
}
```

#### `GET /v1/karat-to-fineness` — Karat to fineness and percent

**Parameters:**
- `karat` (query, required, string) — Karat (0–24) Example: `18`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/goldpurity-api/v1/karat-to-fineness?karat=18"
```

**Response:**
```json
{
    "data": {
        "note": "Karat is the number of 24ths of a piece that is pure gold, so the fineness (parts per thousand) = karat ÷ 24 × 1000 and the gold percentage = karat ÷ 24 × 100. 24K is pure (1000‰, 100 %), 18K is 750‰ (75 %), 14K is 583‰ (58.3 %), 9K is 375‰. Hallmark stamps quote the fineness directly — 750 for 18K — so this is the conversion between the two systems jewellers and assayers move between.",
        "inputs": {
            "karat": 18
        },
        "gold_percent": 75,
        "gold_fraction": 0.75,
        "fineness_permille": 750
    },
    "meta": {
        "timestamp": "2026-06-07T08:17:54.606Z",
        "request_id": "e0442c49-ee24-4823-bd84-f319229abe24"
    },
    "status": "ok",
    "message": "Karat to fineness",
    "success": true
}
```

#### `GET /v1/pure-gold-weight` — Pure gold weight in a piece

**Parameters:**
- `total_weight_g` (query, required, string) — Total piece weight (g) Example: `10`
- `karat` (query, required, string) — Karat (0–24) Example: `18`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/goldpurity-api/v1/pure-gold-weight?total_weight_g=10&karat=18"
```

**Response:**
```json
{
    "data": {
        "note": "The pure (fine) gold in a piece = its total weight × the gold fraction (karat ÷ 24). A 10 g 18K ring holds 7.5 g of actual gold and 2.5 g of alloy metals (copper, silver, etc.). This is the fine-gold content that drives the intrinsic metal value and what a refiner pays on — the rest is the alloy that gives the colour and hardness.",
        "inputs": {
            "karat": 18,
            "total_weight_g": 10
        },
        "alloy_g": 2.5,
        "pure_gold_g": 7.5,
        "gold_fraction": 0.75
    },
    "meta": {
        "timestamp": "2026-06-07T08:17:54.680Z",
        "request_id": "5a6bddc3-1271-462e-a89d-37a7ab35c971"
    },
    "status": "ok",
    "message": "Pure gold weight",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "Karat = 24ths pure gold; fineness = karat/24·1000 ‰. pure = total·karat/24; total = pure·24/target_karat. Grams. Metal-value and refining context only — for a metal's weight from its dimensions use a metal-weight API.",
        "service": "goldpurity-api",
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/alloy-mix": "Alloy to add to fine gold to reach a target karat.",
            "GET /v1/pure-gold-weight": "Pure gold and alloy weight from total weight and karat.",
            "GET /v1/karat-to-fineness": "Fineness (per mille) and gold percent from a karat."
        },
        "description": "Gold purity / karat maths: karat to fineness and percent, pure-gold weight in a piece, and alloy mix to a target karat."
    },
    "meta": {
        "timestamp": "2026-06-07T08:17:54.776Z",
        "request_id": "ed6bd1f3-96e5-4e85-8126-cdff5fa53165"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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