← Back to CLIs
Nardjo

learnhouse-cli

Manage a self-hosted LearnHouse LMS via CLI - users, usergroups, courses, enrollments, org (feature toggles), webhooks, auth (API token, admin session, magic sign-in links). Use when user mentions 'LearnHouse', 'formation', 'training platform', 'grant course access', 'add buyer to group', 'revoke access after refund', 'magic link', 'enroll a student', 'hide a LearnHouse feature', or 'LearnHouse webhook'.

Install

$ npx api2cli install Nardjo/learnhouse-cli

Details

Skill type: Wrapper CLI
Auth type: bearer
Version: 0.1.0
Author: Nardjo
Views: 1

README

learnhouse-cli

CLI for the admin API of a self-hosted LearnHouse instance: provision members, grant and revoke course access through user groups, enroll, issue magic sign-in links, toggle org features and manage webhook subscriptions. Verified on LearnHouse community edition 1.4.0. Made with api2cli.dev.

Install

npx api2cli install Nardjo/learnhouse-cli

This clones the repo, builds the CLI, links it to your PATH, and installs the AgentSkill to your coding agents. Requires Bun.

Install AgentSkill only

npx skills add Nardjo/learnhouse-cli

Configure

Nothing is hardcoded. Env vars win over the saved settings.

SettingEnv varSaved with
Instance URL (https://<domain>)LEARNHOUSE_URLlearnhouse-cli config set url <url>
Organization slugLEARNHOUSE_ORG_SLUGlearnhouse-cli config set org <slug>
Org API token (lh_...)LEARNHOUSE_API_TOKENlearnhouse-cli auth set <token>
Admin session (only for org toggle)LEARNHOUSE_ADMIN_PASSWORD or stdinlearnhouse-cli auth login --email <admin>

Create the API token as an org admin (admin UI, or POST /api/v1/orgs/{org_id}/api-tokens) with only the rights buckets you need, e.g. users, usergroups, courses. LearnHouse 1.4.0 rejects a token whose rights is a complete role object. Org config routes refuse API tokens, hence the separate admin session (about 8 hours).

learnhouse-cli config set url https://learn.example.com
learnhouse-cli config set org my-org
learnhouse-cli auth set "lh_..."
learnhouse-cli auth test

Resources

ResourceActions
authset, show, remove, test, login, logout, magic-link <user_id>
configset url|org <value>, show
userslist, get <email>, create --email, groups <user_id>
usergroupslist, members <uuid>, add <uuid> <user_id>, remove <uuid> <user_id>
courseslist
enrollmentslist <user_id>, add <user_id> <course_uuid>
orgget, features, toggle <feature> on|off
webhooksevents, list, create --url --event, delete <id>

Every action documents its flags with --help. Full guide with examples: skills/learnhouse-cli/SKILL.md.

# Grant access to a private course: membership of its linked user group opens it
ID=$(learnhouse-cli users create --email buyer@example.com --first-name Ada --json | jq -r .data.id)
learnhouse-cli usergroups add usergroup_xxx "$ID"
learnhouse-cli auth magic-link "$ID" --ttl 900 --json | jq -r .data.url

Global Flags

All commands support: --json, --format <text|json|csv|yaml>, --verbose, --no-color, --no-header

Exit codes: 0 = success, 1 = API error, 2 = usage or configuration error.

License

MIT

Sponsors