Skip to content

API

YearRoll exposes a versioned REST API under /api/v1. The web app and the API share Auth.js session cookies. Send the session cookie with requests that require a signed-in user. These pages do not document a separate API token.

Base URL on a local Compose install: http://127.0.0.1:3456.

Method and path Who What it returns
GET /api/v1/health Anyone Liveness and migration status. No session required.
GET /api/v1/openapi Staff session The OpenAPI document. Some distribution packs omit this route.
GET /api/v1/students Staff session The student roster.
GET /api/v1/enrollments Staff session The enrollment pipeline.
GET /api/v1/staff Staff session The staff directory.
GET /api/v1/parent/children Parent session Children linked to the signed-in parent.
GET /api/v1/school Staff session School settings and reference data.

Staff routes expect a staff role (platform admin, school admin, registrar, teacher, or staff). GET /api/v1/parent/children expects a parent session.

GET /api/v1/health is the check to poll after a deploy or a Compose start.

Healthy:

{ "ok": true, "migrations": "applied" }

HTTP 503 means the process is up but not ready:

migrations Meaning
pending At least one migration file is not in the journal yet.
mismatch A journal checksum does not match the file on disk.
error The migration check threw. The JSON includes error.

Pending and mismatch responses also include pending and mismatched arrays of migration names. The field list for the other routes is the OpenAPI document, not this page.

Next: Backups and migrations.