Skip to main content
TRW
TRWAPI Reference

Docs

API reference

This page covers the hosted TRW platform API. You do not need these endpoints for the day-to-day repo-local workflow itself; use them when you are integrating auth, telemetry, releases, or other hosted surfaces. All backend routes are prefixed with /v1.

Base URL: https://trwframework.com/v1

How access works

Most operational routes are organization-scoped and authenticated with a platform API key. Public auth and onboarding endpoints stay open, but the data-bearing routes assume approved hosted access.

Public routes — Used for health checks, access requests, contact, and sign-in or verification flows. These routes do not require a bearer token.
API key routes — Used for telemetry, learnings, installations, and releases after access has been approved. Pass the key as Authorization: Bearer trw_live_...
Full-auth routes — Used for signed-in account flows such as email login and 2FA management. Exchange an API key for a short-lived JWT via POST /auth/token when you need one.
Platform admin routes — Used for cross-org administration and operational views such as audit events, admin stats, and waitlist conversion.
Important: The local open-source framework uses its own MCP tool surface. This REST API is for the hosted platform and synchronized org features.
JWT bearer tokens — returned by email login or token exchange when a browser or signed-in dashboard flow needs them.Authorization: Bearer <token>

Auth Badges

Each endpoint shows one of four auth badges:

BadgeMeaning
publicNo bearer credential required.
api-keyRequires a platform API key scoped to one organization.
full-authRequires a signed-in user session or JWT-backed auth context.
platform-adminRequires platform-admin privileges.

Authentication

Account creation, sign-in, email verification, password reset, and 2FA flows.

MethodPathAuthDescription
POST/auth/tokenpublicExchange a platform API key for a short-lived JWT bearer token.
POST/auth/registerpublicCreate an email/password account. Always returns the same anti-enumeration message.
POST/auth/loginpublicAuthenticate with email and password. Returns an access token or a 2FA challenge.
POST/auth/verify-emailpublicVerify email address using the token from the verification email.
POST/auth/resend-verificationpublicRequest a new verification email. Always returns a generic success message.
POST/auth/request-password-resetpublicSend a password reset link. Always returns the same anti-enumeration message.
POST/auth/reset-passwordpublicReset a password using the token from the email reset flow.
POST/auth/2fa/enablefull-authStart 2FA enablement for the signed-in user by sending an email verification code.
POST/auth/2fa/confirm-enablefull-authConfirm 2FA enablement and return the generated backup codes.
POST/auth/2fa/disablefull-authDisable 2FA with a valid email code or backup code.
GET/auth/2fa/statusfull-authReturn the current 2FA state for the signed-in user.
POST/auth/2fa/verifypublicFinish a 2FA login challenge using the temporary token from /auth/login.

Expand an endpoint below for request and response details.

Public routes

Hosted-surface endpoints that do not require a bearer credential.

MethodPathAuthDescription
GET/healthpublicHealth check. Returns service status and version.
GET/statspublicReturn public product counters used on the public site.
GET/metricspublicReturn public metrics for marketing and dashboard summaries.
POST/waitlistpublicSubmit a public beta-access request for the current TRW rollout.
POST/contactpublicSubmit the public contact form. Uses a honeypot field and email rate limiting.

Expand an endpoint below for request and response details.

Organization-scoped data

Telemetry, learnings, installations, and release-distribution routes authenticated with a platform API key.

MethodPathAuthDescription
POST/telemetryapi-keySubmit a telemetry batch for the authenticated organization.
GET/telemetry/statsapi-keyReturn aggregated telemetry stats for the authenticated organization.
GET/telemetry/hourlyapi-keyReturn hourly telemetry buckets for charts and trend views.
GET/telemetry/eventsapi-keyList raw telemetry events for the authenticated organization.
GET/installationsapi-keyList distinct installations derived from telemetry for the authenticated organization.
POST/learningsapi-keyPublish or update a shared learning entry for the authenticated organization.
POST/learnings/searchapi-keySearch learnings with keyword filters and optional embedding similarity.
GET/learningsapi-keyList learnings for the authenticated organization.
GET/learnings/{learning_id}api-keyReturn one learning by ID.
PATCH/learnings/{learning_id}/statusapi-keyChange a learning status to active, resolved, or obsolete.

Expand an endpoint below for request and response details.

Platform admin

Cross-organization operational routes for platform admins.

MethodPathAuthDescription
GET/admin/statsplatform-adminReturn platform-wide statistics for the admin dashboard.
GET/admin/telemetry/aggregateplatform-adminReturn platform-wide telemetry aggregates.
GET/admin/installationsplatform-adminList installations across all organizations.
GET/admin/audit-eventsplatform-adminList audit events with optional action and time-window filters.
GET/admin/usersplatform-adminList all users. Platform admin only.
GET/admin/organizationsplatform-adminList all organizations. Platform admin only.
GET/admin/api-keysplatform-adminList API keys across organizations. Platform admin only.
GET/waitlistplatform-adminList waitlist entries. This is a platform-admin endpoint even though it is not under /admin.

Expand an endpoint below for request and response details.

Releases

Release metadata and installer distribution routes used by hosted clients.

MethodPathAuthDescription
GET/releases/latestapi-keyGet metadata for the latest TRW release.
GET/releasesapi-keyList releases for a given channel.
GET/releases/{version}/artifactapi-keyReturn artifact metadata for a specific release.
GET/releases/{version}/downloadapi-keyReturn a direct or pre-signed download URL for a release artifact.
GET/releases/latest/installerapi-keyRedirect to the latest installer artifact for the requested channel.

Expand an endpoint below for request and response details.

Examples

Common API operations using curl.

Exchange API key for JWT
curl -X POST https://trwframework.com/v1/auth/token \
  -H "Content-Type: application/json" \
  -d '{"api_key": "trw_live_..."}'

# Response:
# { "access_token": "eyJ...", "token_type": "bearer" }
List learnings
curl https://trwframework.com/v1/learnings?page=1&page_size=10 \
  -H "Authorization: Bearer trw_live_..."

# Response:
# { "items": [...], "total": 342, "page": 1, "page_size": 10 }
Submit telemetry
curl -X POST https://trwframework.com/v1/telemetry \
  -H "Authorization: Bearer trw_live_..." \
  -H "Content-Type: application/json" \
  -d '{"events": [{"event_type": "session_start", "session_id": "run_123", "status": "ok"}]}'

# 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:

X-RateLimit-Limit: 500
X-RateLimit-Remaining: 498
X-RateLimit-Reset: 1709200000

Error Format

Application errors are normalized to a flat JSON shape with an error code, a human-readable detail string, and a request ID for correlation.

Error response
// 401 Unauthorized
{
  "error": "unauthorized",
  "detail": "Invalid or expired token",
  "request_id": "3a8f7f52-..."
}

// 404 Not Found
{
  "error": "not_found",
  "detail": "Learning not found",
  "request_id": "6f4f1b9c-..."
}

// 500 Internal Server Error
{
  "error": "internal_server_error",
  "detail": "An unexpected error occurred.",
  "request_id": "d2a0ab21-..."
}

Tip

When you run the backend locally, FastAPI serves interactive OpenAPI docs on the backend origin at /docs .

Where to go next

Read configuration if you are wiring a repo install to the hosted platform. Read troubleshooting for auth, proxy, or environment issues. Read tools if your real integration surface is MCP rather than REST.

Next Step

Use configuration to point clients at the right endpoints, then use troubleshooting guidance when auth, proxying, or connectivity misbehaves.