STABLEVersion 2.0

Vendor API Reference

Complete reference for the Balance for Life Vendor API. Build integrations, automate workflows, and connect your systems with the BFL platform.

Base URL

https://api.balanceforlifeai.com

Auth Header

X-API-Key: YOUR_API_KEY

Rate Limit

100 /min

Encryption

TLS 1.3 + AES-256

Quick Start

Make your first API request in under a minute.

All API requests require an X-API-Key header. Your API key is provided by the platform admin during onboarding.

bash
curl -X GET "https://api.balanceforlifeai.com/api/v2/members/" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY"

Or with TypeScript:

typescript
const response = await fetch("https://api.balanceforlifeai.com/api/v2/members/", {
  headers: {
    "Content-Type": "application/json",
    "X-API-Key": process.env.VENDOR_API_KEY,
  },
});
const members = await response.json();

Authentication

API key scopes and security best practices.

Include your API key in every request via the X-API-Key header. Each key has specific scopes that determine what resources you can access.

ScopePermissions
members:readView assigned members
sessions:readView sessions, care context, intelligence, handoffs, events
sessions:writeLog sessions, update care context, manage handoffs
notes:readView clinical notes
notes:writeCreate clinical notes
assessments:readView assessments
assessments:writeSubmit assessments
crisis:readView crisis flags
crisis:writeCreate crisis flags

Security: Never expose your API key in client-side code, public repos, or browser network logs. Store it server-side and proxy requests through your backend.

Error Handling

HTTP status codes and error response format.

All errors return a JSON body with a detail field.

json
{ "detail": "Member not found or not assigned to this vendor" }
StatusMeaningAction
401Invalid or expired API keyRe-authenticate with a valid key
403Insufficient scope / not assignedCheck your API key permissions
404Resource not foundVerify the ID is correct
409Conflict (duplicate resource)Check existing records
422Validation errorFix the request body per the detail message
429Rate limit exceededWait and retry after Retry-After seconds
500Internal server errorRetry with exponential backoff

Rate Limits

Request throttling and retry strategies.

The API enforces a rate limit of 100 requests per minute per API key. Rate limit status is communicated via response headers.

HeaderDescription
X-RateLimit-LimitMaximum requests per window (100)
X-RateLimit-RemainingRequests remaining in current window
X-RateLimit-ResetUnix timestamp when the window resets
Retry-AfterSeconds to wait (only on 429 responses)
typescript
async function fetchWithRetry(url: string, opts: RequestInit, retries = 3) {
  for (let i = 0; i < retries; i++) {
    const res = await fetch(url, opts);
    if (res.status === 429) {
      const wait = parseInt(res.headers.get("Retry-After") || "5");
      await new Promise((r) => setTimeout(r, wait * 1000));
      continue;
    }
    return res;
  }
  throw new Error("Rate limit exceeded after retries");
}

API Reference

27 endpoints across 10 resources

Members

2

Manage and view member profiles assigned to your vendor account.

Intelligence

2

Access computed intelligence briefs including risk levels, engagement scores, and mood trends.

Care Context

2

Configure treatment parameters that guide the Zen AI companion.

Sessions

3

Log therapy sessions and track session history.

Clinical Notes

2

Create and manage encrypted clinical notes tied to sessions.

Assessments

2

Submit and review clinical assessments (PHQ-9, GAD-7, custom).

Crisis Flags

2

Report and monitor crisis flags for members.

Handoffs

8

Manage care transitions between vendors with full clinical context.

Events

3

Access the real-time activity feed and member timelines.

Onboarding

1

Public endpoint for vendor onboarding requests.

Balance for Life Behavioral Health Platform · API v2.0