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

# Credentials

> Manage API credentials for Timeback services

## Overview

The `timeback credentials` command manages local API credentials for the Timeback and MasteryTrack providers. Credentials are stored as JSON in `~/.timeback/credentials.json`; the CLI creates the directory with mode `0700` and writes the file with mode `0600`.

> [!TIP]
>
> If you're just getting started, `timeback init` will automatically prompt for credentials when
> needed. Use `timeback credentials` when you need explicit control over credential management.

## Commands

### `add`

Add credentials interactively:

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

The default provider is `timeback`. Choose one or more environments, then enter the client ID, client secret, and optional email for each environment. The email is used to look up your OneRoster profile. API and token URLs are resolved from the provider and environment.

For MasteryTrack, select its provider explicitly:

```bash theme={null}
timeback credentials add --provider masterytrack
```

The MasteryTrack wizard collects an API key and registered email for each selected environment.

### `email`

Add or update the email associated with your saved Timeback credentials:

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

### `list`

List stored credentials:

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

### `remove`

Remove stored credentials:

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

## Credential Priority

The CLI looks for credentials in this order:

1. **Environment variables**
2. **Stored credentials**

For Timeback, use `TIMEBACK_API_CLIENT_ID` and `TIMEBACK_API_CLIENT_SECRET`. The legacy `TIMEBACK_CLIENT_ID` and `TIMEBACK_CLIENT_SECRET` aliases are also accepted. For MasteryTrack, use `TIMEBACK_MASTERYTRACK_API_KEY` and `TIMEBACK_MASTERYTRACK_EMAIL`; the legacy `MASTERYTRACK_API_KEY` and `MASTERYTRACK_EMAIL` names remain supported.

## Next Steps

> [card] [CLI: API](https://docs.timeback.com/beta/build-on-timeback/cli/api.md)
>
> Use credentials to query APIs

> [card] [CLI: Resources](https://docs.timeback.com/beta/build-on-timeback/cli/resources.md)
>
> Manage course configurations
