Skip to content

The klahaya Command Line

klahaya is a command-line tool for the admin API. It is built for bulk work that is tedious in the browser — loading a season of lesson classes from a spreadsheet, creating a month of volunteer shifts — and for scripting. It needs a personal access token from API Access.

The tool is not published to a package registry; it is installed from the portal’s code repository. From a checkout of the repository, with Node 20 or newer:

Terminal window
npm run build -w packages/cli
npm link -w packages/cli # puts `klahaya` on your PATH
klahaya --version

If you prefer not to install it, npm run cli -- <command> from the repository root runs the same thing.

  1. Create a personal access token at Admin > Settings > API Access and copy it.

  2. Run klahaya login and paste the token when prompted. It is stored in your user config directory, readable only by you.

  3. Run klahaya whoami to confirm which admin, which scopes and which deployment you are talking to.

Tokens are stored per deployment, so staging and production can coexist; pick one with --base-url <url>. With only one stored you never need the flag. klahaya logout forgets the local copy but does not revoke the token — do that on the API Access page.

For automation, set KLAHAYA_PAT (and optionally KLAHAYA_BASE_URL) in the environment instead; the credential file is then never read or written.

Terminal window
klahaya ops list # every operation available
klahaya ops list lessons # filter by name
klahaya run lessons classes list --session-id <uuid>
klahaya run lessons classes create --help # what it takes
klahaya run lessons classes create --input @classes.json

Simple inputs are flags (--session-id, --name). Anything structured — a list of rows, a nested filter — goes through --input, which takes @file.json, - for standard input, or inline JSON. Flags override the file, so --input @classes.json --session-id <other> reuses a document against a different session. Add --json to print the server’s raw response.

A write does not write. Running a create or update operation returns a plan describing what it would do — the rows, the emails it would send, and anything it refuses — and nothing changes until you apply it:

Terminal window
klahaya run volunteer opportunities create --input @shifts.json # prints a plan and its id
klahaya plans get <plan-id> # re-read it
klahaya plans apply <plan-id> # perform it

plans apply asks for confirmation unless you pass --yes. A plan lasts 15 minutes, holds at most 500 rows, and cannot be applied if it contains a single error row — fix the input and plan again. Apply also re-checks the records first and refuses if they changed underneath the plan.

Every apply is recorded as a batch, on the API Access page and here:

Terminal window
klahaya batches list # recent writes, newest first
klahaya batches get <batch-id> # one batch, row by row
klahaya batches revert <batch-id> # plan an undo, then apply it

See API Changes and Undo for what a revert can and cannot put back.