CLI

The ChapterTwo CLI (@chapter-two-music/cli) provides command-line access to the platform for managing rightsholders, querying data, and scripting workflows.

Installation

bash
npm 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

CommandDescription
c2 auth loginAuthenticate via browser (OAuth2 + PKCE)
c2 auth logoutClear saved credentials
c2 auth statusShow current authentication status
c2 auth tokenPrint current token (for piping)
c2 api <procedure>Call any API procedure
c2 endpointsList available API endpoints
c2 describe <endpoint>Show detailed endpoint info
c2 whoamiShow current user and organization
c2 healthCheck API health status
c2 config showShow 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

bash
c2 api rightsholder.list --format json # raw JSON c2 api rightsholder.list --format pretty # formatted (default) c2 api rightsholder.list --format table # table view