---
title: "Calculates a test or exam grade from the number of correct answers and total questions. Returns the percentage score, letter grade, points missed, and GPA points. Supports US grading (A/B/C/D/F with 4.0 GPA scale), UK grading (First/2:1/2:2/Third/Fail), and percentage-only mode. US thresholds: A>=90, B>=80, C>=70, D>=60, F<60. UK thresholds: First>=70, 2:1>=60, 2:2>=50, Third>=40, Fail<40. Useful for students checking scores and teachers computing class statistics."
method: POST
path: "/api/test_grade"
tags: ["general"]
---

# Calculates a test or exam grade from the number of correct answers and total questions. Returns the percentage score, letter grade, points missed, and GPA points. Supports US grading (A/B/C/D/F with 4.0 GPA scale), UK grading (First/2:1/2:2/Third/Fail), and percentage-only mode. US thresholds: A>=90, B>=80, C>=70, D>=60, F<60. UK thresholds: First>=70, 2:1>=60, 2:2>=50, Third>=40, Fail<40. Useful for students checking scores and teachers computing class statistics.

`POST /api/test_grade`

## Request

- Base URL: `https://calc.engineer`
- URL: `https://calc.engineer/api/test_grade`
- Auth: none declared

## Request body

- object
  - `correct` number, required: Number of questions answered correctly. Must be a non-negative integer.
  - `total` number, required: Total number of questions on the test. Must be a positive integer.
  - `grading_scale` 'us' | 'uk' | 'percentage_only': Grading scale to use. 'us' for A-F letter grades, 'uk' for First/2:1/2:2/Third/Fail, 'percentage_only' for just the percentage.

## Response `200`

Computed result for test_grade

- object
  - `result` object, required
    - `percentage` number, required: Score as a percentage (0-100).
    - `letter_grade` string, nullable, required: Letter grade based on the selected grading scale. Null if percentage_only.
    - `points_missed` number, required: Number of questions answered incorrectly (total - correct).
    - `gpa_points` number, nullable, required: GPA points on a 4.0 scale (US only). A=4.0, B=3.0, C=2.0, D=1.0, F=0. Null for UK and percentage_only.
  - `tool` string, required
  - `version` string, required
  - `computed_at` string, date-time, required
  - `chain` object, required
    - `feeds` unknown[]
      - unknown
    - `accepts_from` unknown[]
      - unknown

## Other responses

- `400`: Validation error or invalid JSON
- `404`: Tool not found

---

[API](https://skmtc.dev/calc/apis/calc-engineer-api.md) · [All operations](https://skmtc.dev/calc/apis/calc-engineer-api/llms.txt) · [OpenAPI document](https://skmtc.dev/calc/apis/calc-engineer-api/revisions/8830480ec488?raw)
