Skip to main content

Command Structure

lexq <group> <action> [options]

At a Glance

lexq auth                  login | logout | whoami
lexq status                API health check
lexq serve                 Run as MCP stdio server (--mcp)
lexq groups                list | get | create | update | delete
lexq groups ab-test        start | stop | adjust
lexq versions              list | get | create | update | delete | clone
lexq rules                 list | get | create | update | delete | reorder | toggle
lexq facts                 list | create | update | delete | action-metadata
lexq deploy                publish | live | rollback | undeploy | history | detail | overview | deployable | diff
lexq analytics             dry-run | dry-run-compare | requirements
lexq analytics simulation  start | status | list | cancel | export
lexq analytics dataset     upload | template
lexq history               list | get | stats
lexq integrations          list | get | save | delete | config-spec
lexq logs                  list | get | action | bulk-action
lexq webhook-subscriptions list | get | save | delete | test
Each section below covers the commands in detail.

Auth

CommandDescription
lexq auth loginStore API key interactively
lexq auth logoutRemove stored credentials
lexq auth whoamiShow current authentication info (tenant, role, key mask)

Status

CommandDescription
lexq statusCheck API connectivity and measure latency
lexq status verifies that the API is reachable and your key is valid by calling the whoami endpoint and reporting latency. lexq auth whoami returns the full authentication details. Use status for quick health checks; use whoami for identity verification.

Groups

CommandDescription
lexq groups listList all policy groups
lexq groups get --id <gid>Get group detail
lexq groups create --json '{...}'Create a new group
lexq groups update --id <gid> --json '{...}'Update group
lexq groups delete --id <gid>Delete group
lexq groups ab-test start --group-id <gid> --json '{...}'Start A/B test
lexq groups ab-test stop --group-id <gid>Stop A/B test
lexq groups ab-test adjust --group-id <gid> --json '{...}'Adjust traffic rate

Versions

CommandDescription
lexq versions list --group-id <gid>List versions
lexq versions get --group-id <gid> --id <vid>Get version detail
lexq versions create --group-id <gid> --json '{...}'Create DRAFT
lexq versions update --group-id <gid> --id <vid> --json '{...}'Update version
lexq versions delete --group-id <gid> --id <vid>Delete version
lexq versions clone --group-id <gid> --id <vid>Clone to new DRAFT

Rules

CommandDescription
lexq rules list --group-id <gid> --version-id <vid>List rules
lexq rules get --group-id <gid> --version-id <vid> --id <rid>Get rule detail
lexq rules create --group-id <gid> --version-id <vid> --json '{...}'Create rule
lexq rules update --group-id <gid> --version-id <vid> --id <rid> --json '{...}'Update rule
lexq rules delete --group-id <gid> --version-id <vid> --id <rid>Delete rule
lexq rules reorder --group-id <gid> --version-id <vid> --rule-ids "a,b,c"Set priority order
lexq rules toggle --group-id <gid> --version-id <vid> --id <rid> --enabled trueEnable/disable
Example:
lexq rules create --group-id <gid> --version-id <vid> --json '{
  "name": "VIP 10% Discount",
  "priority": 0,
  "condition": {
    "type": "GROUP", "operator": "AND",
    "children": [
      { "type": "SINGLE", "field": "customer_tier", "operator": "EQUALS", "value": "VIP", "valueType": "STRING" },
      { "type": "SINGLE", "field": "payment_amount", "operator": "GREATER_THAN_OR_EQUAL", "value": 100000, "valueType": "NUMBER" }
    ]
  },
  "actions": [{ "type": "MUTATE_FACT", "parameters": { "refVar": "payment_amount", "operator": "SUB", "method": "PERCENTAGE", "rate": 10 } }]
}'

Facts

CommandDescription
lexq facts listList all fact definitions
lexq facts create --key <key> --name <n> --type <type>Create fact
lexq facts update --id <fid> --name <n>Update fact
lexq facts delete --id <fid>Delete fact
lexq facts action-metadataShow runtime fact metadata per action type (which facts are required/produced by MUTATE_FACT, INCREMENT_FACT, EMIT_EVENT, etc.)
lexq facts action-metadata is read-only and cached per session — safe to call anytime when designing rules.

Deploy

CommandDescription
lexq deploy publish --group-id <gid> --version-id <vid> --memo "..."DRAFT → ACTIVE
lexq deploy live --group-id <gid> --version-id <vid> --memo "..."Deploy to production
lexq deploy rollback --group-id <gid> --memo "..."Revert to previous version
lexq deploy undeploy --group-id <gid> --memo "..."Remove live version
lexq deploy history [--group-id <gid>]List deployment history
lexq deploy detail --deployment-id <id>Get deployment detail
lexq deploy overviewAll groups’ deployment status
lexq deploy deployable --group-id <gid>List ACTIVE versions ready for deployment
lexq deploy diff --base-version-id <vid> --target-version-id <vid>Compare rule snapshots between two versions

Analytics — Dry Run

CommandDescription
lexq analytics dry-run --version-id <vid> --json '{...}'Execute Dry Run
lexq analytics dry-run-compare --json '{...}'Compare two versions
lexq analytics requirements --group-id <gid> --version-id <vid>Check required facts

Analytics — Impact Simulation

CommandDescription
lexq analytics simulation start --json '{...}'Start simulation
lexq analytics simulation status --id <simId>Poll for results
lexq analytics simulation list [--status <s>]List simulations
lexq analytics simulation cancel --id <simId>Cancel
lexq analytics simulation export --id <simId> --format json|csvExport results

Analytics — Dataset

CommandDescription
lexq analytics dataset upload --file <path>Upload CSV/JSON dataset
lexq analytics dataset template --group-id <gid> --version-id <vid>Download template

History

CommandDescription
lexq history list [--group-id <gid>]List execution history
lexq history get --id <eid>Get execution detail
lexq history stats [--group-id <gid>]Aggregate statistics

Integrations

CommandDescription
lexq integrations listList all integrations
lexq integrations get --id <iid>Get integration detail
lexq integrations save --json '{...}'Create or update
lexq integrations delete --id <iid>Delete
lexq integrations config-spec --type <type>Show required config

Logs

CommandDescription
lexq logs list [filters]List failure logs
lexq logs get --id <lid>Get detail
lexq logs action --id <lid> --action <a>Retry, skip, resolve
lexq logs bulk-action --json '{...}'Bulk action

Webhook Subscriptions

Platform event webhooks receive deployment lifecycle notifications (VERSION_PUBLISHED, DEPLOYED, ROLLED_BACK, UNDEPLOYED). Separate from rule-level EMIT_WEBHOOK actions.
CommandDescription
lexq webhook-subscriptions listList all webhook subscriptions
lexq webhook-subscriptions get --id <wid>Get subscription detail
lexq webhook-subscriptions save --json '{...}'Create or update (omit id to create)
lexq webhook-subscriptions delete --id <wid>Delete subscription
lexq webhook-subscriptions test --id <wid>Send a test event to verify connectivity
Example:
lexq webhook-subscriptions save --json '{
  "name": "slack-deploy-alerts",
  "webhookUrl": "https://hooks.slack.com/services/...",
  "subscribedEvents": ["DEPLOYED", "ROLLED_BACK"],
  "payloadFormat": "SLACK",
  "secret": "your-hmac-secret",
  "isActive": true
}'

Serve

CommandDescription
lexq serve --mcpStart stdio MCP server
MCP Server Setup Guide

Standard Workflow

# 1. Create group       → lexq groups create --json '{...}'
# 2. Create version      → lexq versions create --group-id <gid> --json '{...}'
# 3. Register facts      → lexq facts create --key ... --name ... --type ...
# 4. Add rules           → lexq rules create --group-id <gid> --version-id <vid> --json '{...}'
# 5. Validate (dry run)  → lexq analytics dry-run --version-id <vid> --debug --mock --json '{...}'
# 6. Publish             → lexq deploy publish --group-id <gid> --version-id <vid> --memo "..."
# 7. Deploy              → lexq deploy live --group-id <gid> --version-id <vid> --memo "..."
Cannot create rules without a DRAFT version. Cannot publish without rules. Cannot deploy a DRAFT. Always dry-run before publishing.