Overview
The user profile contains an enriched view of the current user, including identity information, school, grade, enrolled courses, goals, and XP totals. You can access user data in several ways:- Server-side: verify users or fetch profiles directly from your backend
- Client-side: use a framework hook with built-in state and caching
Server-Side
Thetimeback.user namespace provides programmatic methods that accept an email directly. Use them in your own API routes, server actions, webhooks, cron jobs, or any backend context.
Verify a user
Usetimeback.user.verify(email) to check whether a Timeback user exists for a given email. This is a lightweight check — it does not fetch enrollments, analytics, or build an enriched profile.
Whether the user exists in Timeback.
The Timeback user ID. Only present when
verified is true.Get a user profile
Usetimeback.user.getProfile(email) to get the full enriched profile — identity, enrollments, courses, goals, and XP. This is the programmatic equivalent of the /user/me HTTP handler.
TimebackUserResolutionError if the user cannot be resolved. If you’re not sure whether a user exists, call verify() first.
Client-Side
On the client, use the framework-specific profile hook. The hook handles loading state, caching, and session-aware refetching — you never calltimeback.user.fetch() directly from the browser.
- React
- Vue
- Svelte
- Solid
Hook State
The profile hook returns a state object with these statuses:Caching
The client SDK caches profile data to minimize API calls:- Profile is fetched once per session
- Manual refetch available via
fetchProfile() - Cache is invalidated on sign-out
Next Steps
Custom Activities
Track activities to earn XP
Identity
Authentication setup
EduBridge Client
Advanced analytics queries
OneRoster Client
Query enrollments directly