Skip to content

API Reference

import { Aside } from ‘@astrojs/starlight/components’;

The VitaSync API is a REST API that returns JSON. It provides endpoints for managing users, OAuth connections, health data, events, personal records, webhooks, and API keys.

https://api.yourdomain.com

All endpoints are versioned under /v1/:

https://api.yourdomain.com/v1/

All endpoints require Bearer token authentication:

Authorization: Bearer vs_live_<your_api_key>

See Authentication for full details on creating keys and managing scopes.

All request bodies must be JSON with the appropriate header:

Content-Type: application/json
MethodPathScopeDescription
POST/v1/userswriteCreate or find a user by externalId
GET/v1/usersreadList all users (paginated)
GET/v1/users/:userIdreadGet a user by ID
PATCH/v1/users/:userIdwriteUpdate user properties
DELETE/v1/users/:userIdadminDelete a user and all their data
MethodPathScopeDescription
GET/v1/oauth/:providerId/authorizeRedirect user to provider OAuth
GET/v1/oauth/:providerId/callbackOAuth callback (handled by VitaSync)
GET/v1/users/:userId/connectionsreadList a user’s provider connections
DELETE/v1/users/:userId/connections/:connectionIdwriteDisconnect a provider
POST/v1/users/:userId/connections/:connectionId/syncwriteTrigger a manual sync
MethodPathScopeDescription
GET/v1/users/:userId/healthreadRaw health metrics (paginated)
GET/v1/users/:userId/health/summaryreadCount per metric type
GET/v1/users/:userId/health/timeseriesreadAggregated timeseries data
GET/v1/users/:userId/health/daily-summariesreadPer-day metric totals
DELETE/v1/users/:userId/healthadminDelete all health data (GDPR)
MethodPathScopeDescription
GET/v1/users/:userId/eventsreadList workouts, sleep, and activities
GET/v1/users/:userId/events/:eventIdreadGet a single event
MethodPathScopeDescription
GET/v1/users/:userId/personal-recordsreadAll personal records
GET/v1/users/:userId/personal-records/:metricTypereadRecords for a metric type
MethodPathScopeDescription
POST/v1/webhooksadminRegister a webhook endpoint
GET/v1/webhooksadminList webhooks
GET/v1/webhooks/:webhookIdadminGet a webhook
PATCH/v1/webhooks/:webhookIdadminUpdate webhook settings
DELETE/v1/webhooks/:webhookIdadminDelete a webhook
GET/v1/webhooks/:webhookId/deliveriesadminDelivery history
MethodPathScopeDescription
POST/v1/api-keysadminCreate an API key
GET/v1/api-keysadminList API keys
DELETE/v1/api-keys/:keyIdadminDelete an API key
POST/v1/api-keys/:keyId/rotateadminRotate (replace) an API key
MethodPathScopeDescription
GET/v1/providersreadList all configured providers
MethodPathScopeDescription
GET/v1/users/:userId/analytics/contextreadLLM-ready biological context (baselines, trends, anomalies, correlations, health scores)
POST/v1/users/:userId/analytics/correlationsreadAuto-discover metric correlations over a configurable time window
POST/v1/users/:userId/analytics/anomaliesreadDetect health anomalies using statistical and clinical thresholds
MethodPathScopeDescription
GET/v1/users/:userId/notifications/channelsreadList notification channels
POST/v1/users/:userId/notifications/channelswriteRegister a notification channel
PUT/v1/users/:userId/notifications/channels/:channelIdwriteUpdate channel settings
DELETE/v1/users/:userId/notifications/channels/:channelIdwriteDelete a channel
POST/v1/users/:userId/notifications/channels/:channelId/testwriteSend a test notification
GET/v1/users/:userId/notifications/rulesreadList notification rules
POST/v1/users/:userId/notifications/ruleswriteCreate a notification rule
PUT/v1/users/:userId/notifications/rules/:ruleIdwriteUpdate a rule
DELETE/v1/users/:userId/notifications/rules/:ruleIdwriteDelete a rule
GET/v1/users/:userId/notifications/logsreadQuery notification delivery history
MethodPathScopeDescription
GET/v1/users/:userId/moodreadList mood entries (filterable by date, mood type)
POST/v1/users/:userId/moodwriteLog a mood entry (score, energy, stress, tags)
GET/v1/users/:userId/mood/statsreadMood statistics and trends
GET/v1/users/:userId/journalreadList journal entries (search, filter by tags/date)
POST/v1/users/:userId/journalwriteCreate a journal entry (title, body, mood, gratitude)
PATCH/v1/users/:userId/journal/:entryIdwriteUpdate a journal entry
DELETE/v1/users/:userId/journal/:entryIdwriteDelete a journal entry
GET/v1/users/:userId/journal/statsreadJournal statistics (streak, mood distribution)
GET/v1/users/:userId/waterreadList water intake logs
POST/v1/users/:userId/waterwriteLog water intake (amount, beverage type)
DELETE/v1/users/:userId/water/:logIdwriteDelete a water log
GET/v1/users/:userId/water/todayreadToday’s hydration summary and goal progress
GET/v1/users/:userId/water/weeklyread7-day hydration stats with daily breakdown
GET/v1/users/:userId/habitsreadList habit definitions
POST/v1/users/:userId/habitswriteCreate a habit (name, icon, color, frequency)
PATCH/v1/users/:userId/habits/:habitIdwriteUpdate a habit
DELETE/v1/users/:userId/habits/:habitIdwriteDelete a habit and its logs
POST/v1/users/:userId/habits/:habitId/completewriteMark a habit as completed for a date
DELETE/v1/users/:userId/habits/:habitId/complete/:datewriteUndo a habit completion
GET/v1/users/:userId/habits/summaryreadDaily summary with completion rate and streaks
GET/v1/users/:userId/nutritionreadList nutrition/meal logs
POST/v1/users/:userId/nutritionwriteLog a meal with macros
GET/v1/users/:userId/nutrition/summary/dailyreadToday’s nutrition totals
GET/v1/users/:userId/nutrition/summary/weeklyreadWeekly average macros
GET/v1/users/:userId/medicationsreadList medications
POST/v1/users/:userId/medicationswriteAdd a medication
POST/v1/users/:userId/medications/:medId/logwriteLog a dose taken
GET/v1/users/:userId/medications/:medId/statsreadAdherence statistics
GET/v1/users/:userId/symptomsreadList symptom logs
POST/v1/users/:userId/symptomswriteLog a symptom occurrence
GET/v1/users/:userId/symptoms/patternsreadSymptom frequency patterns
MethodPathScopeDescription
GET/v1/users/:userId/goalsreadList health goals
POST/v1/users/:userId/goalswriteCreate a goal with target metric and value
PATCH/v1/users/:userId/goals/:goalIdwriteUpdate goal settings
GET/v1/users/:userId/achievementsreadList unlocked achievements
GET/v1/challengesreadList workspace challenges
POST/v1/challengeswriteCreate a challenge
POST/v1/challenges/:challengeId/joinwriteJoin a challenge
GET/v1/challenges/:challengeId/leaderboardreadChallenge leaderboard
MethodPathScopeDescription
GET/v1/users/:userId/training-plansreadList training plans
POST/v1/users/:userId/training-planswriteCreate a training plan
GET/v1/users/:userId/readinessreadReadiness score with contributing signals
GET/v1/users/:userId/readiness/training-loadreadTraining load metrics (CTL, ATL, TSB)
MethodPathScopeDescription
GET/v1/users/:userId/reportsreadList generated health reports
POST/v1/users/:userId/reportswriteGenerate a health report
GET/v1/users/:userId/exportsreadList data exports
POST/v1/users/:userId/exportswriteCreate a data export (JSON, CSV)
GET/v1/users/:userId/health-scoresreadComposite wellness scores (overall, sleep, activity, cardio, recovery)
POST/v1/users/:userId/health-scores/computewriteCompute a new health score
GET/v1/users/:userId/sleep-analysis/debtreadSleep debt analysis
GET/v1/users/:userId/sleep-analysis/qualityreadSleep quality metrics
GET/v1/users/:userId/baselinesreadBiometric baselines
GET/v1/users/:userId/snapshotsreadHealth snapshots
POST/v1/users/:userId/snapshotswriteCreate a health snapshot
GET/v1/users/:userId/insightsreadAI-generated health insights

VitaSync returns standard HTTP status codes. Error responses include a JSON body with statusCode, error, and message.

{
"statusCode": 404,
"error": "Not Found",
"message": "User not found"
}
StatusMeaning
200 OKRequest succeeded
201 CreatedResource created
202 AcceptedRequest accepted (async operation queued)
204 No ContentSuccess, no response body
400 Bad RequestInvalid request body or query parameters
401 UnauthorizedMissing or invalid API key
403 ForbiddenAPI key valid but insufficient scope
404 Not FoundResource does not exist or does not belong to this workspace
409 ConflictResource already exists (e.g. duplicate connection)
422 Unprocessable EntityValid JSON but semantic errors (e.g. invalid enum value)
429 Too Many RequestsRate limit exceeded — see Retry-After header
500 Internal Server ErrorVitaSync server error

Most list endpoints support two pagination styles:

?limit=100&offset=0

Response includes total, limit, and offset for building page navigation.

?limit=100&cursor=<nextCursor>

Response includes nextCursor (null when no more pages). More efficient for large datasets — use cursor pagination whenever possible.

All IDs are ULIDs — lexicographically sortable, URL-safe, 26-character strings. They are time-ordered by creation, making recent records always higher when sorted alphabetically.

All timestamps are returned as ISO 8601 strings in UTC:

2025-06-15T09:00:00.000Z

When providing timestamps in requests, use ISO 8601 format with UTC timezone.

The current API version is v1. Breaking changes will be introduced in a new version (v2) with a deprecation period for v1.

Non-breaking changes (new fields, new endpoints) are added without version bumps.