> ## 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.

# API

> Query Timeback APIs from the command line

## Overview

The `timeback api` command provides direct access to Timeback APIs from the command line.

## Services

| Service                   | Description           |
| ------------------------- | --------------------- |
| [`oneroster`](#oneroster) | OneRoster 1.2 API     |
| [`edubridge`](#edubridge) | EduBridge API         |
| [`caliper`](#caliper)     | Caliper Analytics API |
| [`powerpath`](#powerpath) | PowerPath API         |
| [`qti`](#qti)             | QTI API               |

## Discovery

View available resources and operations:

```bash theme={null}
# View API documentation
timeback api docs oneroster

# List available resources
timeback api oneroster --help
```

## Examples

### OneRoster

```bash theme={null}
# List schools
timeback api oneroster schools list

# List users (with limit)
timeback api oneroster users list --limit 100

# List enrollments (active only)
timeback api oneroster enrollments list --active

# Get specific user
timeback api oneroster users get <user-id>

# Create user from JSON file
timeback api oneroster users create --file user.json

# Filter with OneRoster filter syntax
timeback api oneroster users list --filter "role='student'"

# Delete a user
timeback api oneroster users delete <user-id>
```

### EduBridge

```bash theme={null}
# List enrollments for user
timeback api edubridge enrollments list <user-id>

# Get activity data
timeback api edubridge analytics activity --student-id <student-id>

# Get weekly facts
timeback api edubridge analytics weekly-facts --email user@example.com

# Get grade mastery
timeback api edubridge analytics grade-mastery <student-id> Math
```

### Caliper

```bash theme={null}
# List events
timeback api caliper events list --limit 50

# Get events for a specific actor
timeback api caliper events list --actor <user-id>

# Filter by event type
timeback api caliper events list --type AssessmentEvent
```

### QTI

```bash theme={null}
# List assessment items
timeback api qti items list

# Get specific item
timeback api qti items get <identifier>
```

### PowerPath

```bash theme={null}
# List test assignments
timeback api powerpath assignments list --student <student-id>

# Get placement level
timeback api powerpath placement level --student <student-id> --subject Math

# Get screening results
timeback api powerpath screening results --student <student-id>
```

## Environment

Specify the target environment:

```bash theme={null}
# Use production
timeback api oneroster schools list --env production

# Use staging (default)
timeback api oneroster schools list --env staging
```

## Output Formats

```bash theme={null}
# Default format: JSON
timeback api oneroster schools list

# Explicit JSON output
timeback api oneroster schools list --format json

# Table format (human-readable)
timeback api oneroster schools list --format table

# JSON Lines format
timeback api oneroster schools list --format jsonl
```

## Credentials

API commands require credentials. Set them via:

1. **Environment variables** (recommended for CI):

```bash theme={null}
export ONEROSTER_CLIENT_ID=...
export ONEROSTER_CLIENT_SECRET=...
```

2. **Credentials command**:

```bash theme={null}
timeback credentials add
```

See [CLI: Credentials](/beta/build-on-timeback/cli/credentials) for details.

## Debug Mode

Enable verbose output to see request/response details:

```bash theme={null}
DEBUG=1 timeback api oneroster schools list
```

## Pagination

For large result sets:

```bash theme={null}
# Limit results
timeback api oneroster users list --limit 50

# Offset pagination
timeback api oneroster users list --offset 100 --limit 50
```

## Next Steps

<CardGroup cols={2}>
  <Card title="CLI: Credentials" icon="key" href="/beta/build-on-timeback/cli/credentials">
    Manage API credentials
  </Card>

  <Card title="API Clients" icon="code" href="/beta/build-on-timeback/api-clients">
    Programmatic API access
  </Card>
</CardGroup>
