@pactpay/cli
v0.1.1
Published
PactPay CLI for authentication, token usage plans, API tokens, and growing organization workflows
Downloads
45
Readme
PactPay CLI
PactPay CLI is a command-line tool for working with PactPay from your terminal.
Today it is mainly focused on token usage plans and API tokens, and support for organizations-related workflows is also being expanded.
Install
Install from npm:
npm install -g @pactpay/cliThen confirm the CLI is available:
pactpay --helpWhat You Can Do
- Sign in with your PactPay account from the browser
- View and switch the current organization
- List and inspect token usage plans
- Check plan balances
- List API tokens under a plan
- Create new API tokens from the terminal
Get Started
After installing the CLI, start by signing in:
pactpay auth loginThe CLI will open your browser, complete the login flow, and save your local session automatically.
You can then check your current session:
pactpay auth statusCommon Commands
Authentication:
pactpay auth login
pactpay auth status
pactpay auth logoutOrganizations:
pactpay org list
pactpay org current
pactpay org switch --org-id <orgId>
pactpay org switch --org-name <orgName>Plans:
pactpay plan list
pactpay plan list --with-balance
pactpay plan find --name <planName>
pactpay plan show --plan-id <planId>
pactpay plan balance --plan-id <planId>API tokens:
pactpay token list --plan <planId-or-planName>
pactpay token create --plan <planId-or-planName> --name <tokenName>
pactpay token create --plan <planId-or-planName> --name <tokenName> --limited --remain-amount 10Login Behavior
Commands that need authentication will use your saved local session automatically.
If the CLI does not find a valid session, it will:
- Open the PactPay login page in your browser
- Wait for the login callback on your machine
- Save the session locally for future commands
Working With Plans
Commands that target a token usage plan use:
--plan <planId-or-planName>The CLI will first try to match an exact plan id, then an exact plan name, then a partial plan name.
If more than one plan matches, it will stop and ask you to use a more specific value.
Output
By default, list-style commands print readable tables in the terminal.
If you want to use the CLI in scripts, add:
--jsonEnvironment Variables
PACTPAY_BASE_URL: Override API base URL. Default:https://pactpay.appPACTPAY_WEB_BASE_URL: Override web base URL for browser login. Default:https://pactpay.app
