API Reference
The TRW platform exposes a REST API for authentication, learning management, telemetry, and administration. All endpoints are prefixed with /v1.
Base URL: https://trwframework.com/v1
Authentication
Most endpoints require authentication. TRW supports two methods:
POST /auth/token with email + password. Pass as Authorization: Bearer <token>Authorization: Bearer trw_live_...Auth Badges
Each endpoint shows one of four auth badges:
| Badge | Meaning |
|---|---|
| public | No authentication required. |
| jwt | Requires a valid JWT bearer token. |
| api-key | Requires a platform API key. |
| admin | Requires JWT token with admin role. |
Authentication
Register, sign in, verify email, reset passwords, and manage two-factor authentication.
| Method | Path | Auth | Description |
|---|---|---|---|
| POST | /auth/token | public | Exchange email + password for a short-lived JWT bearer token. |
| POST | /auth/register | public | Create a new account. Sends a verification email. |
| POST | /auth/verify-email | public | Verify email address using the token from the verification email. |
| POST | /auth/forgot-password | public | Request a password reset email. |
| POST | /auth/reset-password | public | Reset password using the token from the reset email. |
| POST | /auth/2fa/enable | jwt | Enable two-factor authentication. Returns a TOTP secret and QR code URI. |
| POST | /auth/2fa/verify | jwt | Verify a TOTP code to complete 2FA setup or authenticate. |
/auth/tokenpublicExchange email + password for a short-lived JWT bearer token.
Request body:
Response:
/auth/registerpublicCreate a new account. Sends a verification email.
Request body:
Response:
/auth/verify-emailpublicVerify email address using the token from the verification email.
Request body:
Response:
/auth/forgot-passwordpublicRequest a password reset email.
Request body:
Response:
/auth/reset-passwordpublicReset password using the token from the reset email.
Request body:
Response:
/auth/2fa/enablejwtEnable two-factor authentication. Returns a TOTP secret and QR code URI.
Response:
/auth/2fa/verifyjwtVerify a TOTP code to complete 2FA setup or authenticate.
Request body:
Response:
Core
Health checks, telemetry ingestion, learning management, and installation tracking.
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /health | public | Health check. Returns service status and version. |
| POST | /telemetry/events | api-key | Submit a batch of anonymized telemetry events. |
| GET | /learnings | jwt | List learnings for the authenticated organization. Supports pagination and filtering. |
| POST | /learnings | jwt | Create a new learning entry. |
| PATCH | /learnings/{id} | jwt | Update a learning entry. Commonly used to change status or add tags. |
| GET | /installations | jwt | List TRW installations for the authenticated organization. |
/healthpublicHealth check. Returns service status and version.
Response:
/telemetry/eventsapi-keySubmit a batch of anonymized telemetry events.
Request body:
Response:
/learningsjwtList learnings for the authenticated organization. Supports pagination and filtering.
Response:
/learningsjwtCreate a new learning entry.
Request body:
Response:
/learnings/{id}jwtUpdate a learning entry. Commonly used to change status or add tags.
Request body:
Response:
/installationsjwtList TRW installations for the authenticated organization.
Response:
Admin
Organization and user management. All admin endpoints require the admin role.
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /admin/users | admin | List all users. Admin only. |
| GET | /admin/organizations | admin | List all organizations. Admin only. |
| GET | /admin/waitlist | admin | List waitlist entries. Admin only. |
/admin/usersadminList all users. Admin only.
Response:
/admin/organizationsadminList all organizations. Admin only.
Response:
/admin/waitlistadminList waitlist entries. Admin only.
Response:
Releases
Release metadata and installer downloads.
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /releases/latest | public | Get metadata for the latest TRW release. |
| GET | /releases/latest/installer | api-key | Download the self-contained installer script. |
/releases/latestpublicGet metadata for the latest TRW release.
Response:
/releases/latest/installerapi-keyDownload the self-contained installer script.
Response:
Examples
Common API operations using curl.
curl -X POST https://trwframework.com/v1/auth/token \
-H "Content-Type: application/json" \
-d '{"email": "user@example.com", "password": "..."}'
# Response:
# { "access_token": "eyJ...", "token_type": "bearer", "expires_in": 3600 }curl https://trwframework.com/v1/learnings?page=1&page_size=10 \
-H "Authorization: Bearer eyJ..."
# Response:
# { "items": [...], "total": 342, "page": 1, "page_size": 10 }curl -X POST https://trwframework.com/v1/telemetry/events \
-H "Authorization: Bearer trw_live_..." \
-H "Content-Type: application/json" \
-d '{"events": [{"event_type": "session_start", "ts": "2026-03-14T10:00:00Z"}]}'
# Response:
# { "accepted": 1 }Rate Limiting
All endpoints are rate-limited. When you exceed the limit, the API returns 429 Too Many Requests. Rate limit headers are included in every response:
Error Format
All errors return a consistent JSON shape with an HTTP status code, error type, and message.
// 401 Unauthorized
{
"detail": "Invalid or expired token"
}
// 422 Validation Error
{
"detail": [
{
"loc": ["body", "email"],
"msg": "value is not a valid email address",
"type": "value_error"
}
]
}
// 429 Too Many Requests
{
"detail": "Rate limit exceeded. Retry after 60 seconds."
}Tip
Interactive API docs (Swagger UI) are available at http://localhost:5002/api-docs when running locally.