# GPA API
> Calculate a weighted grade-point average (GPA). The calc endpoint takes a list of courses — each with a grade and the credit hours it is worth — and returns the credit-weighted GPA, the totals, and a per-course breakdown of quality points so you can see exactly how the average was formed. Grades may be US letter grades (A, A-, B+, … F) on the standard 4.0 scale, or 4.3 with the us_plus scale that gives A+ extra weight; percentages from 0 to 100 mapped to letters and points with the usual cutoffs; raw grade points given directly as numbers; or your own custom letter-to-point mapping for any institution's scheme. Courses can be passed as a JSON array or a compact string like "A:3,B+:4,C:2", and credits default to 1 for an unweighted average. The scales endpoint lists the built-in grade scales and their point values. Everything is computed locally and deterministically, so it is instant and private — no student data is stored. Ideal for student planners and dashboards, university and school portals, LMS and ed-tech apps, scholarship and admissions tools, and academic what-if calculators. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This computes GPA; for general statistics use a statistics 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/gpa-api/..."
```

## Pricing
- **Free** (Free) — 4,735 calls/Mo, 2 req/s
- **Starter** ($6/Mo) — 14,250 calls/Mo, 8 req/s
- **Pro** ($26/Mo) — 193,500 calls/Mo, 20 req/s
- **Mega** ($64/Mo) — 1,010,000 calls/Mo, 50 req/s

## Endpoints

### GPA

#### `GET /v1/calc` — Calculate GPA

**Parameters:**
- `courses` (query, required, string) — JSON array of {grade,credits} or a string like 'A:3,B+:4,C:2' Example: `A:3,B+:4,C:2`
- `scale` (query, optional, string) — us (default, 4.0), us_plus (4.3) or percentage Example: `us`
- `scale_map` (query, optional, string) — Optional custom letter→point JSON map

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/gpa-api/v1/calc?courses=A%3A3%2CB%2B%3A4%2CC%3A2&scale=us"
```

**Response:**
```json
{
    "data": {
        "gpa": 3.24,
        "scale": "us",
        "courses": 3,
        "breakdown": [
            {
                "grade": "A",
                "letter": "A",
                "points": 4,
                "credits": 3,
                "quality_points": 12
            },
            {
                "grade": "B+",
                "letter": "B+",
                "points": 3.3,
                "credits": 4,
                "quality_points": 13.2
            },
            {
                "grade": "C",
                "letter": "C",
                "points": 2,
                "credits": 2,
                "quality_points": 4
            }
        ],
        "gpa_precise": 3.2444,
        "total_credits": 9,
        "total_quality_points": 29.2
    },
    "meta": {
        "timestamp": "2026-06-03T17:42:19.918Z",
        "request_id": "ff88f8b1-d93f-448c-a2f6-31588b8cf122"
    },
    "status": "ok",
    "message": "Calculate GPA",
    "success": true
}
```

#### `GET /v1/scales` — List grade scales

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

**Response:**
```json
{
    "data": {
        "scales": {
            "us": {
                "A": 4,
                "B": 3,
                "C": 2,
                "D": 1,
                "F": 0,
                "A+": 4,
                "A-": 3.7,
                "B+": 3.3,
                "B-": 2.7,
                "C+": 2.3,
                "C-": 1.7,
                "D+": 1.3,
                "D-": 0.7
            },
            "us_plus": {
                "A": 4,
                "B": 3,
                "C": 2,
                "D": 1,
                "F": 0,
                "A+": 4.3,
                "A-": 3.7,
                "B+": 3.3,
                "B-": 2.7,
                "C+": 2.3,
                "C-": 1.7,
                "D+": 1.3,
                "D-": 0.7
            },
            "percentage": "0–100 mapped to US letters (93+=A, 90+=A-, 87+=B+, …, <60=F)"
        }
    },
    "meta": {
        "timestamp": "2026-06-03T17:42:20.024Z",
        "request_id": "def61567-281a-4253-95a6-30ba3b300b34"
    },
    "status": "ok",
    "message": "List grade scales",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "name": "GPA API",
        "notes": "GPA = Σ(grade points × credits) ÷ Σ(credits). Credits default to 1 when omitted (unweighted). Percentages use the common US cutoffs (93+ = A, 90–92 = A-, …). This computes GPA — for general statistics use a statistics API. Nothing is stored.",
        "version": "v1",
        "endpoints": [
            {
                "path": "/v1/calc",
                "params": {
                    "scale": "us (default, 4.0), us_plus (4.3) or percentage",
                    "courses": "a JSON array of {grade, credits} — or a string like 'A:3,B+:4,C:2'",
                    "scale_map": "optional custom letter→point JSON map"
                },
                "returns": "the weighted GPA, totals and per-course breakdown"
            },
            {
                "path": "/v1/scales",
                "params": [],
                "returns": "the built-in grade scales and their points"
            },
            {
                "path": "/v1/meta",
                "params": [],
                "returns": "this document"
            }
        ],
        "description": "Calculate a weighted grade-point average (GPA). The calc endpoint takes a list of courses — each with a grade and the credit hours it is worth — and returns the credit-weighted GPA, the totals and a per-course breakdown of quality points. Grades may be US letter grades (A, A-, B+ … F) on the standard 4.0 scale (or 4.3 with us_plus), percent
…(truncated, see openapi.json for full schema)
```


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