Skip to main content
Timeback provides TypeScript clients for direct API access to all services. Use these when you need fine-grained control over API interactions or want to build custom integrations without the full SDK.

Available Clients

PackageDescription
@timeback/onerosterOneRoster 1.2 API for rostering, enrollments, and gradebook
@timeback/edubridgeEduBridge API for analytics and resource management
@timeback/caliperCaliper Analytics API for learning events
@timeback/qtiQTI API for assessments and question items
@timeback/powerpathPowerPath API for adaptive learning

Installation

Install individual clients as needed:
npm install @timeback/oneroster
npm install @timeback/edubridge
npm install @timeback/caliper
npm install @timeback/qti
npm install @timeback/powerpath
Or install all clients via the SDK:
npm install @timeback/sdk

Authentication

All clients use OAuth 2.0 client credentials flow. There are two configuration modes: Connect to Timeback platforms with automatic URL resolution:
import { OneRosterClient } from '@timeback/oneroster'

const client = new OneRosterClient({
	env: 'staging', // or 'production'
	auth: {
		clientId: process.env.ONEROSTER_CLIENT_ID!,
		clientSecret: process.env.ONEROSTER_CLIENT_SECRET!,
	},
})

Explicit Mode

Connect to custom OneRoster APIs:
const client = new OneRosterClient({
	baseUrl: 'https://api.example.com',
	auth: {
		clientId: process.env.ONEROSTER_CLIENT_ID!,
		clientSecret: process.env.ONEROSTER_CLIENT_SECRET!,
		authUrl: 'https://auth.example.com/oauth2/token',
	},
})
Tokens are automatically managed:
  • Fetched on first request
  • Cached for subsequent requests
  • Refreshed when expired

SDK Integration

When using the full SDK, clients are available via timeback.api:
import { createTimeback } from '@timeback/sdk'

const timeback = await createTimeback({
	env: 'staging',
	api: {
		clientId: process.env.TIMEBACK_API_CLIENT_ID!,
		clientSecret: process.env.TIMEBACK_API_CLIENT_SECRET!,
	},
	identity: {
		/* ... */
	},
})

const { data: users } = await timeback.api.oneroster.users.list()
const { data: enrollments } = await timeback.api.edubridge.enrollments.list()
await timeback.api.caliper.events.sendActivity(sensorUrl, activityData)

Common Patterns

All clients follow consistent CRUD patterns:
client.users.list({ limit?, offset?, where? })
client.users.get(id)
client.users.create({ ...fields })
client.users.update(id, { ...fields })
client.users.delete(id)
client.users.stream()
MethodReturnsDescription
list()PageResultList with pagination/filters
get()ResourceGet by ID
create()CreateResponseCreate new resource
update()voidUpdate existing resource
delete()voidDelete resource
stream()AsyncIterableStream all results efficiently

Usage Examples

OneRoster

import { OneRosterClient } from '@timeback/oneroster'

const client = new OneRosterClient({
	env: 'staging',
	auth: {
		clientId: process.env.ONEROSTER_CLIENT_ID!,
		clientSecret: process.env.ONEROSTER_CLIENT_SECRET!,
	},
})

// List students
const { data: students } = await client.users.list({
	limit: 100,
	where: { role: 'student' },
})

// Get specific user
const user = await client.users.get('user-id')

// List enrollments
const { data: enrollments } = await client.enrollments.list({ active: true })

Caliper

import { CaliperClient } from '@timeback/caliper'

const client = new CaliperClient({
	env: 'staging',
	auth: {
		clientId: process.env.CALIPER_CLIENT_ID!,
		clientSecret: process.env.CALIPER_CLIENT_SECRET!,
	},
})

// Send activity event
await client.events.sendActivity(sensorUrl, {
	studentId: 'student-123',
	activityId: 'lesson-1',
	duration: 1800000, // 30 minutes
	xpEarned: 80,
})

EduBridge

import { EduBridgeClient } from '@timeback/edubridge'

const client = new EduBridgeClient({
	env: 'staging',
	auth: {
		clientId: process.env.EDUBRIDGE_CLIENT_ID!,
		clientSecret: process.env.EDUBRIDGE_CLIENT_SECRET!,
	},
})

// Get student analytics
const analytics = await client.analytics.activity({ studentId: 'student-123' })

// Get weekly facts
const weeklyFacts = await client.analytics.weeklyFacts({ email: '[email protected]' })

Environment Variables

Configure clients via environment variables:
.env
# OneRoster
ONEROSTER_CLIENT_ID=your-client-id
ONEROSTER_CLIENT_SECRET=your-client-secret

# EduBridge
EDUBRIDGE_CLIENT_ID=your-client-id
EDUBRIDGE_CLIENT_SECRET=your-client-secret

# Caliper
CALIPER_CLIENT_ID=your-client-id
CALIPER_CLIENT_SECRET=your-client-secret

# QTI
QTI_CLIENT_ID=your-client-id
QTI_CLIENT_SECRET=your-client-secret

# PowerPath
POWERPATH_CLIENT_ID=your-client-id
POWERPATH_CLIENT_SECRET=your-client-secret

API Reference

For detailed endpoint documentation, see the API Reference: