BetterSpace Developer API
Integrate mental health and wellness services into your platform with a simple REST API. Per-user pricing, no base fees.
12
API Modules
40+
Endpoints
₹10-60
Per User/Month
Prerequisites
Before making API calls, complete these steps in order:
Create a Developer Account
Register at developers.betterspace.care/register with your company details. Your account is activated instantly.
Subscribe to Modules
Go to Dashboard → Modules and subscribe to the features you need. Each module unlocks specific API endpoints. You can only call endpoints for modules you're subscribed to.
Generate an API Key
Go to Dashboard → API Keys and create a key. Start with a sandbox key for testing (free, unlimited). Create a live key when ready for production.
Copy the key immediately — it's only shown once.
Register Your Users (via API)
Call POST /v1/users/register with the user's email and your external ID. The API automatically:
- Finds an existing BetterSpace profile by email and links it
- Or creates a new BetterSpace account and links it
No manual linking needed. One API call does everything.
Use Your External IDs in API Calls
Once registered, use the external_id in all subsequent API calls. The gateway resolves it automatically.
Test in the Playground
Go to Dashboard → API Playground, paste your API key, and test endpoints live. The playground shows real responses from the API.
Authentication
All API requests go through the Supabase Edge Function gateway. You need two headers:
bs_live_ for production (billed), bs_test_ for sandbox (free, unlimited).Base URL
All endpoint paths are appended to this base. E.g., /v1/assessments/types
Users & Linking
Before using most endpoints, register your users with their external IDs from your system. Then link them to BetterSpace profiles.
1. Register a user (in the portal UI)
Go to Dashboard → Users → Add User. Enter their external ID (e.g., emp-001).
2. Link to BetterSpace profile
Click "Link" on the user row and search for their BetterSpace profile by name or email. This maps your external ID to their internal UUID.
3. Use in API calls
The gateway automatically resolves emp-001 to the linked BetterSpace UUID.
Rate Limits
| Window | Default Limit |
|---|---|
| Per minute | 60 requests |
| Per hour | 1,000 requests |
| Per day | 10,000 requests |
Check X-RateLimit-Remaining header. Enterprise plans get higher limits.
Error Handling
All errors return a consistent JSON structure:
| Code | Status | Meaning |
|---|---|---|
| missing_api_key | 401 | No X-API-Key header |
| invalid_api_key | 401 | Key invalid, expired, or account suspended |
| module_not_subscribed | 403 | Module not in your subscription |
| rate_limit_exceeded | 429 | Too many requests |
| user_not_found | 404 | External user ID not registered |
| invalid_request | 400 | Missing or invalid parameters |
Pricing
Simple per-active-user/month pricing. No base fees. Only charged for users who make API calls.
Example: Subscribe to Assessments (₹30) + AI Chat (₹45) + Mood (₹15). With 200 active users → 200 × ₹90 = ₹18,000/month.
Mental Health Assessments
₹30/user/month — Administer standardized screenings with AI insights.
GET /v1/assessments/types
List all available assessment types.
POST /v1/assessments/administer
Get questions for a specific assessment.
POST /v1/assessments/submit
Submit answers and get scored results.
POST /v1/assessments/insights
Get AI-generated personalized insights for a score.
AI Wellness Chat (Rooh)
₹45/user/month — White-label AI companion powered by Gemini 2.5 Flash.
POST /v1/chat/message
Send a message and get an AI wellness response.
POST /v1/chat/session
Create a new chat session.
Crisis Detection
₹20/user/month — Real-time text analysis for crisis indicators.
POST /v1/crisis/analyze
Analyze text for suicide ideation, self-harm, harm to others, or severe distress.
Categories: suicide_ideation, self_harm, harm_to_others, crisis_distress
GET /v1/crisis/alerts
List recent crisis alerts for your organization.
Therapy Marketplace
₹60/user/month — Therapist directory, booking, and video sessions.
GET /v1/therapists
Search therapists. Optional filters: specialization, language, max_price, min_rating
specialization and language are matched exactly against the therapist's tags. A lowercase value like specialization=anxiety returns an empty list — stored values are capitalized (Anxiety, CBT, Stress Management). Send the value exactly as stored, or omit the filter to list all and read each result's specializations array to discover valid values.GET /v1/therapists/:id/availability?date=2026-06-15
Get available and booked slots for a specific date.
POST /v1/bookings
Create a therapy session booking.
GET /v1/bookings/:id
Get booking status, video link, and details.
Corporate Wellness
₹40/user/month — Team analytics, burnout scoring, and wellness plans.
GET /v1/teams/:id/analytics
Get team wellness metrics for the last 30 days.
GET /v1/teams/:id/burnout-score
Calculate team burnout risk score (0-100).
POST /v1/teams/:id/members
Bulk add team members.
Wellness Analytics
₹15/user/month — Mood trends, engagement metrics, PDF reports.
GET /v1/analytics/mood-trends?period=monthly&team_id=uuid
Get aggregated mood data. Periods: weekly, monthly, yearly
POST /v1/reports/generate
Generate a PDF wellness report.
Mood & Journal
₹15/user/month — Mood logging, trends, AI journal prompts.
POST /v1/mood/log
Log a mood entry (1-5 scale).
GET /v1/mood/trends?user_id=emp-001&period=monthly
Get mood history and average for a user.
GET /v1/journal/prompts
Get 3 randomized AI-powered journal prompts.
Sleep & Health
₹25/user/month — Sleep tracking, scoring, and health dashboard.
POST /v1/sleep/log
Log a sleep entry with bedtime, wake time, and quality.
GET /v1/sleep/trends
Get historical sleep data and trends.
Psychometric Testing
₹35/user/month — Custom test creation, scoring engine, PDF reports.
GET /v1/tests
List all published psychometric tests.
POST /v1/tests/:id/score
Score a completed test response using the formula engine.
Notifications
₹10/user/month — Push, email, WhatsApp multi-channel delivery.
POST /v1/notifications/send
Send a notification to a user via multiple channels.
Event Webhooks
Free — Included with any module subscription.
POST /v1/webhooks/endpoints
Register a webhook endpoint to receive events.
GET /v1/webhooks/events
List all available webhook events.
Verifying Webhook Signatures
All payloads are signed with HMAC-SHA256. Verify using the X-Webhook-Signature header:
SDKs
Official client libraries for quick integration. No need to manage headers manually.
JavaScript / TypeScript
Node.js, React, Next.js
Python
Django, Flask, FastAPI
Full SDK docs: Dashboard → SDKs
Need help? Contact us at api-support@betterspace.care