> ## Documentation Index
> Fetch the complete documentation index at: https://docs.timeback.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> Direct API access to Timeback services

Timeback provides API clients for direct access to all services in both TypeScript and Python. Use these when you need fine-grained control over API interactions or want to build custom integrations.

## Available Clients

| Client       | Description                    | Typescript | Python |
| ------------ | ------------------------------ | :--------: | :----: |
| OneRoster    | Rostering, enrollments, grades |      ✓     |    ✓   |
| EduBridge    | Analytics and resources        |      ✓     |    ✓   |
| Caliper      | Learning event tracking        |      ✓     |    ✓   |
| QTI          | Assessments and questions      |      ✓     |    ✓   |
| PowerPath    | Adaptive learning paths        |      ✓     |    ✓   |
| CASE         | Competencies and standards     |      ✓     |    ✓   |
| CLR          | Comprehensive Learner Records  |      ✓     |    ✓   |
| MasteryTrack | Test inventory and assignments |      ✓     |    ✓   |
| Webhooks     | Webhook management and filters |      ✓     |    ✓   |

## Installation

Install individual clients as needed:

<CodeGroup>
  ```bash npm theme={null}
  npm install @timeback/oneroster
  npm install @timeback/edubridge
  npm install @timeback/caliper
  npm install @timeback/qti
  npm install @timeback/powerpath
  npm install @timeback/case
  npm install @timeback/clr
  npm install @timeback/webhooks
  npm install @timeback/masterytrack
  ```

  ```bash pnpm theme={null}
  pnpm add @timeback/oneroster
  pnpm add @timeback/edubridge
  pnpm add @timeback/caliper
  pnpm add @timeback/qti
  pnpm add @timeback/powerpath
  pnpm add @timeback/case
  pnpm add @timeback/clr
  pnpm add @timeback/webhooks
  pnpm add @timeback/masterytrack
  ```

  ```bash yarn theme={null}
  yarn add @timeback/oneroster
  yarn add @timeback/edubridge
  yarn add @timeback/caliper
  yarn add @timeback/qti
  yarn add @timeback/powerpath
  yarn add @timeback/case
  yarn add @timeback/clr
  yarn add @timeback/webhooks
  yarn add @timeback/masterytrack
  ```

  ```bash bun theme={null}
  bun add @timeback/oneroster
  bun add @timeback/edubridge
  bun add @timeback/caliper
  bun add @timeback/qti
  bun add @timeback/powerpath
  bun add @timeback/case
  bun add @timeback/clr
  bun add @timeback/webhooks
  bun add @timeback/masterytrack
  ```

  ```bash pip theme={null}
  pip install timeback-oneroster
  pip install timeback-edubridge
  pip install timeback-caliper
  pip install timeback-qti
  pip install timeback-powerpath
  pip install timeback-case
  pip install timeback-clr
  pip install timeback-webhooks
  pip install timeback-masterytrack
  ```

  ```bash uv theme={null}
  uv add timeback-oneroster
  uv add timeback-edubridge
  uv add timeback-caliper
  uv add timeback-qti
  uv add timeback-powerpath
  uv add timeback-case
  uv add timeback-clr
  uv add timeback-webhooks
  uv add timeback-masterytrack
  ```
</CodeGroup>

Or install all via the unified client:

<CodeGroup>
  ```bash npm theme={null}
  npm install @timeback/core
  ```

  ```bash pnpm theme={null}
  pnpm add @timeback/core
  ```

  ```bash yarn theme={null}
  yarn add @timeback/core
  ```

  ```bash bun theme={null}
  bun add @timeback/core
  ```

  ```bash pip theme={null}
  pip install timeback-core
  ```

  ```bash uv theme={null}
  uv add timeback-core
  ```
</CodeGroup>

## Authentication

All clients use OAuth 2.0 client credentials flow. There are two configuration modes:

### Environment Mode (Recommended)

Connect to Timeback platforms with automatic URL resolution:

<CodeGroup>
  ```typescript TypeScript theme={null}
  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!,
  	},
  })
  ```

  ```python Python theme={null}
  from timeback_oneroster import OneRosterClient

  client = OneRosterClient(
      env="staging",  # or "production"
      client_id=os.environ["ONEROSTER_CLIENT_ID"],
      client_secret=os.environ["ONEROSTER_CLIENT_SECRET"],
  )
  ```
</CodeGroup>

### Explicit Mode

Connect to custom OneRoster APIs:

<CodeGroup>
  ```typescript TypeScript theme={null}
  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',
  	},
  })
  ```

  ```python Python theme={null}
  client = OneRosterClient(
      base_url="https://api.example.com",
      auth_url="https://auth.example.com/oauth2/token",
      client_id=os.environ["ONEROSTER_CLIENT_ID"],
      client_secret=os.environ["ONEROSTER_CLIENT_SECRET"],
  )
  ```
</CodeGroup>

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`:

<CodeGroup>
  ```typescript TypeScript theme={null}
  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 enrollments = await timeback.api.edubridge.enrollments.list({ userId })
  await timeback.api.caliper.events.sendActivity(sensorUrl, activityData)
  ```

  ```python Python theme={null}
  from timeback.server import create_server, TimebackConfig, ApiCredentials

  timeback = create_server(TimebackConfig(
      env="staging",
      api=ApiCredentials(
          client_id=os.environ["TIMEBACK_API_CLIENT_ID"],
          client_secret=os.environ["TIMEBACK_API_CLIENT_SECRET"],
      ),
  ))

  users = await timeback.api.oneroster.users.list()
  enrollments = await timeback.api.edubridge.enrollments.list(user_id=user_id)
  await timeback.api.caliper.events.send_activity(sensor_url, activity_data)
  ```
</CodeGroup>

## Common Patterns

All clients follow consistent CRUD patterns:

<CodeGroup>
  ```typescript TypeScript theme={null}
  client.users.list({ limit?, offset?, where? })
  client.users.get(id)
  client.users.exists(id)
  client.users.create({ ...fields })
  client.users.update(id, { ...fields })
  client.users.upsert(id, { ...fields })
  client.users.delete(id)
  client.users.stream()
  ```

  ```python Python theme={null}
  await client.users.list(limit=..., offset=..., where=...)
  await client.users.get(id)
  await client.users.create(...)
  await client.users.update(id, ...)
  await client.users.delete(id)
  async for user in client.users.stream():
      ...
  ```
</CodeGroup>

| Method     | Returns            | Description                                  |
| ---------- | ------------------ | -------------------------------------------- |
| `list()`   | `PageResult`       | List with pagination/filters                 |
| `get()`    | `Resource`         | Get by ID                                    |
| `exists()` | `boolean`          | Check if resource exists (lightweight HEAD)  |
| `create()` | `CreateResponse`   | Create new resource                          |
| `update()` | `Resource \| void` | Update existing resource (throws if missing) |
| `upsert()` | `Resource \| void` | Create or update resource                    |
| `delete()` | `void`             | Delete resource                              |
| `stream()` | `AsyncIterable`    | Stream all results efficiently               |

<Info>
  Return values for `update()` and `upsert()` are client-specific:

  * Most clients return the updated entity
  * Some APIs return no body on write, so the SDK returns `void`
  * In OneRoster specifically: rostering/resources return `void`, while gradebook/assessment return the updated entity
</Info>

## Environment Configuration

Configure clients via environment variables (when using environment mode, URLs are auto-resolved):

```bash .env theme={null}
# 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

# CASE
CASE_CLIENT_ID=your-client-id
CASE_CLIENT_SECRET=your-client-secret

# CLR
CLR_CLIENT_ID=your-client-id
CLR_CLIENT_SECRET=your-client-secret

# MasteryTrack (uses API key + email, not OAuth)
MASTERYTRACK_API_KEY=your-api-key
MASTERYTRACK_EMAIL=your-registered-email

# Webhooks
WEBHOOKS_CLIENT_ID=your-client-id
WEBHOOKS_CLIENT_SECRET=your-client-secret
```

## Client Guides

<CardGroup cols={2}>
  <Card title="OneRoster" icon="users" href="/beta/build-on-timeback/clients/oneroster">
    Rostering, enrollments, and gradebook
  </Card>

  <Card title="EduBridge" icon="bridge" href="/beta/build-on-timeback/clients/edubridge">
    Analytics and resource management
  </Card>

  <Card title="Caliper" icon="chart-line" href="/beta/build-on-timeback/clients/caliper">
    Learning analytics events
  </Card>

  <Card title="QTI" icon="clipboard-question" href="/beta/build-on-timeback/clients/qti">
    Assessments and questions
  </Card>

  <Card title="PowerPath" icon="road" href="/beta/build-on-timeback/clients/powerpath">
    Adaptive learning paths
  </Card>

  <Card title="CASE" icon="sitemap" href="/beta/build-on-timeback/clients/case">
    Competencies and standards
  </Card>

  <Card title="CLR" icon="award" href="/beta/build-on-timeback/clients/clr">
    Comprehensive Learner Records
  </Card>

  <Card title="MasteryTrack" icon="bullseye" href="/beta/build-on-timeback/clients/masterytrack">
    Test inventory and assignments
  </Card>

  <Card title="Webhooks" icon="webhook" href="/beta/build-on-timeback/clients/webhooks">
    Webhook management and filters
  </Card>
</CardGroup>
