CLI
The ChapterTwo CLI (@chapter-two-music/cli) provides command-line access to the platform for managing rightsholders, querying data, and scripting workflows.
Installation
bashnpm install -g @chapter-two-music/cli
Quick Start
bash# Authenticate (opens browser) c2 auth login # List your rightsholders c2 rightsholder.list # Get details for a specific rightsholder c2 api rightsholder.getById -i '{"id": "uuid-here"}' # Check API health c2 health
Commands
| Command | Description |
|---|---|
| c2 auth login | Authenticate via browser (OAuth2 + PKCE) |
| c2 auth logout | Clear saved credentials |
| c2 auth status | Show current authentication status |
| c2 auth token | Print current token (for piping) |
| c2 api <procedure> | Call any API procedure |
| c2 endpoints | List available API endpoints |
| c2 describe <endpoint> | Show detailed endpoint info |
| c2 whoami | Show current user and organization |
| c2 health | Check API health status |
| c2 config show | Show CLI configuration |
| c2 config set <key> <value> | Set a configuration value |
Shorthand
You can call CLI-scoped endpoints directly without the api subcommand:
bash# These are equivalent: c2 rightsholder.list c2 api rightsholder.list
Authentication
The CLI supports two authentication flows:
Browser OAuth (default)
Run c2 auth login to open your browser for OAuth2 + PKCE authentication.
Device Flow
For remote or headless environments, use c2 auth login --device. This displays a code to enter at the authorization URL.
Tokens auto-refresh for 30 days. Credentials are stored in ~/.c2/.
Output Formats
bashc2 api rightsholder.list --format json # raw JSON c2 api rightsholder.list --format pretty # formatted (default) c2 api rightsholder.list --format table # table view