Prism
One endpoint. Exactly the data you need.
Prism is the BetterSpace v2 API. Send one request, name the fields you want, and get back precisely that — across any number of modules, in a single round trip. No over-fetching, no waterfall of REST calls, no guessing which endpoint holds which field.
One round trip
Compose across modules in a single call.
25 operations
15 reads and 10 writes covering every module.
Same keys & billing
Nothing new to buy. Your v1 key just works.
Why Prism
The same data, far fewer requests.
REST v1 — 3 requests
Three round trips. Each returns every field whether you need it or not.
Prism v2 — 1 request
One round trip, and only the fields you listed come back.
Getting started
If you already have a v1 API key, you are ready — there is nothing extra to enable.
Endpoint
Authentication
Send your API key as a Bearer token. Same keys as REST v1.
Request body
| Field | Type | Notes |
|---|---|---|
| query | string | Required. The operation to run. |
| variables | object | Optional. Pass values instead of inlining them. |
| operationName | string | Optional. Required only if you send multiple operations. |
Using variables
Prefer variables over string interpolation — safer and cacheable.
Tooling
Prism speaks a GraphQL-compatible wire format with introspection enabled, so any standard client, schema-codegen tool, or IDE plugin works against it without custom adapters.
Client examples
Any HTTP client works. Here are the common ones.
Node / TypeScript (no dependencies)
Python
Any GraphQL client (Apollo, urql, graphql-request)
Access & billing
Access is per capability — the same unit you already buy.
Every Prism field maps to the same capability as its REST counterpart. A field resolves if your plan includes that capability (every paid plan includes the full catalog). Therapy session fees are still a separate wallet debit. Access is not metered per module PEPM.
Partial results are normal. If a query asks for one entitled field and one unentitled field, Prism returns the entitled data in data and an entry in errors for the other. Always check both.
Operations reference
All 25 operations. Arguments marked ! are required.
Reads
assessmentTypesassessmentsCatalog of supported standardized screenings (PHQ-9, GAD-7, PSS-10, WHO-5, DASS-21).
Requires capability assessments.types
therapiststherapy_bookingSearch the verified therapist directory. Returns name, photo, rates, session length, languages, and weekly schedule. Filters match stored values exactly (e.g. Anxiety, CBT).
Requires capability therapists.search
therapisttherapy_bookingEverything needed to render one therapist's profile page.
Requires capability therapists.get
therapistAvailabilitytherapy_bookingBookable slots for a date (YYYY-MM-DD). Booked times are already removed, so any returned slot can be booked. Check bookable/reason when the list is empty.
Requires capability therapists.availability
bookingtherapy_bookingFetch a single booking, including its video room link once issued.
Requires capability bookings.get
bookingQuotetherapy_bookingPrice a session before booking. Free — never charged, and works at zero wallet balance.
Requires capability bookings.quote
moodTrendsjournal_moodPer-user mood history and average over the chosen window.
Requires capability mood.trends
teamAnalyticsteam_wellnessAggregated, non-identifying wellness metrics for a team over the last 30 days.
Requires capability teams.analytics
teamBurnoutteam_wellnessBurnout risk score (0–100) derived from recent team mood signals.
Requires capability teams.burnout
resourcescontentBrowse the content library — articles, meditations, and videos.
Requires capability resources.list
resourceCategoriescontentContent categories, useful for building navigation.
Requires capability resources.categories
liveClassescontentUpcoming live wellness classes.
Requires capability classes.list
testspsychometricPublished psychometric tests available to your tenant.
Requires capability tests.list
crisisAlertscrisis_detectionRecent crisis alerts raised for your organization.
Requires capability crisis.alerts
useralways-onLook up a registered end user by your own external id. Free — no module required.
Requires capability users.get
Writes
registerUseralways-onCreate or link an end user. Call this first — every other user-scoped operation needs it. Free.
Requires capability users.register
administerAssessmentassessmentsFetch the question set and instructions for an assessment.
Requires capability assessments.administer
submitAssessmentassessmentsScore and store answers. Returns score, severity band, and max score.
Requires capability assessments.submit
createBookingtherapy_bookingBook a therapy session. The session fee is debited from your wallet and paid to the therapist — booking and payment are one atomic operation. Errors: insufficient_balance, slot_unavailable, user_not_linked, date_in_past.
Requires capability bookings.create
cancelBookingtherapy_bookingCancel a booking. Refunds the wallet in full if the session has not started. Free, idempotent, and callable at zero balance.
Requires capability bookings.cancel
logMoodjournal_moodRecord a mood entry. moodValue must be 1–5.
Requires capability mood.log
logSleepsleep_healthRecord a sleep entry and get a computed sleep score.
Requires capability sleep.log
analyzeCrisiscrisis_detectionScreen free text for suicide ideation, self-harm, or severe distress.
Requires capability crisis.analyze
chatMessagerooh_aiSend a message to Rooh, the white-label AI wellness companion. Pass sessionId to keep context.
Requires capability chat.message
sendNotificationnotificationsSend a push, email, WhatsApp, or in-app notification. Respects user preferences and quiet hours.
Requires capability notifications.send
Browser & mobile clients
Two steps to call Prism safely from a browser or mobile app.
Secret keys must stay server-side. Exchange yours for a short-lived, user-scoped session token on your backend, then hand that token to the client.
Session tokens are locked to the user they were minted for — Prism ignores any otheruserId the client sends — and cannot register users, mint tokens, or manage webhooks.
Error handling
Errors arrive in errors[], each with a stable extensions.code.
| Code | Meaning |
|---|---|
| missing_api_key | No Authorization header |
| invalid_api_key | Key invalid, expired, or account suspended |
| capability_not_entitled | Your plan does not include this field's capability |
| capability_denied | Capability explicitly disabled for your account |
| session_forbidden | Session token attempted a secret-key-only operation |
| rate_limit_exceeded | Too many requests — check Retry-After |
| query_too_deep | Query nesting exceeded the depth limit of 12 |
| query_parse_error | Malformed query syntax |
| invalid_request | Missing or invalid arguments |
| not_found | Referenced record does not exist |
Limits
Max query depth is 12. Rate limits match your plan's per-minute allowance on v1 — read X-RateLimit-Remaining on every response.
Migrating from REST v1
Move at your own pace. REST v1 stays fully supported.
| REST v1 | Prism v2 |
|---|---|
| GET /v1/assessments/types | assessmentTypes |
| POST /v1/assessments/submit | submitAssessment |
| GET /v1/therapists | therapists |
| GET /v1/therapists/:id | therapist |
| GET /v1/therapists/:id/availability | therapistAvailability |
| GET /v1/bookings/quote | bookingQuote |
| POST /v1/bookings | createBooking |
| POST /v1/bookings/:id/cancel | cancelBooking |
| POST /v1/mood/log | logMood |
| GET /v1/mood/trends | moodTrends |
| POST /v1/users/register | registerUser |
| POST /v1/crisis/analyze | analyzeCrisis |
| POST /v1/chat/message | chatMessage |
| POST /v1/notifications/send | sendNotification |
No deadline, no dual billing
v1 and Prism run side by side on the same keys, capabilities, and meter. Migrate one call at a time, or mix both indefinitely. We will give long, explicit notice before any v1 change — and there is no plan to retire it.
Building a UI on top? The React UI kit ships prebuilt components that work with either version.
Need help? Contact us at api-support@betterspace.care