Authentication
Signing in with phone/password or a phone code, and calling authenticated endpoints.
Today, authentication is the sign-in flow our own apps use: short-lived JWT access tokens plus a refresh cookie. There is no separate integration credential yet — see API keys below.
Signing in
Two ways to sign in on a school's host:
Email/phone + password — POST /api/v1/auth/login
curl -X POST https://asante.semaschools.com/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"identifier": "[email protected]", "password": "correct horse battery", "remember": false}'
Phone code — request a code with POST /api/v1/auth/otp/request, then exchange it with
POST /api/v1/auth/otp/verify:
curl -X POST https://asante.semaschools.com/api/v1/auth/otp/request \
-H "Content-Type: application/json" \
-d '{"identifier": "0241234567"}'
Both sign-in endpoints return either tokens or an MFA challenge:
{
"access_token": "eyJhbGciOiJFZERTQSJ9…",
"token_type": "Bearer",
"expires_in": 600,
"account_id": "0199a1b2-7c3d-7e4f-8a5b-6c7d8e9f0a1b",
"campus_id": "0199a1b2-7c3d-7e4f-8a5b-6c7d8e9f0a1b"
}
{
"mfa_required": true,
"mfa_token": "q3V…",
"methods": ["totp", "recovery"]
}
When mfa_required is true, complete sign-in with POST /api/v1/auth/mfa/verify using the
mfa_token and a TOTP or recovery code.
Calling authenticated endpoints
Send the access token as a bearer token:
curl https://asante.semaschools.com/api/v1/auth/me \
-H "Authorization: Bearer eyJhbGciOiJFZERTQSJ9…"
Without a valid token, endpoints reply 401:
{
"error": {
"code": "auth.unauthenticated",
"message": "Please sign in to continue.",
"request_id": "01a0e09e252a766289d36829fa51a4d6"
}
}
The access token expires in 10 minutes (expires_in). It is bound to the host you signed in on —
using it against a different school's host fails.
Refreshing
Sign-in also sets an httpOnly refresh cookie, scoped to /api/v1/auth on that host, and a
readable CSRF cookie. POST /api/v1/auth/refresh and POST /api/v1/auth/logout require both the
cookie and a matching X-CSRF-Token header. This flow is designed for browser clients (our own
tenant app); a server-side integration should expect its own access token to simply expire after
10 minutes rather than relying on cookie refresh.
API keys — coming soon
Scoped, revocable API keys for server-to-server integrations (no browser session involved) are planned but not available yet. When shipped, they'll carry explicit permissions (for example, read-only access to a school's report data) rather than a full account session.