HAIP has no in-process scheduler. Run these scripts from system cron, Kubernetes CronJob, or similar.
Full endpoint reference: docs/operations/cron.md.
All endpoints require a Keycloak JWT with the appropriate realm role (night_auditor or admin for night audit; admin, night_auditor, or revenue_manager for group cutoffs).
Two supported options:
- In Keycloak, create a confidential client (e.g.
haip-cron) with Service accounts enabled. - Assign realm roles to the service account user: at minimum
night_auditor(oradmin). - Copy the client secret from the Credentials tab.
- Export:
export HAIP_URL=https://pms.example.com
export HAIP_PROPERTY_ID=<property-uuid>
export KEYCLOAK_URL=https://auth.example.com
export KEYCLOAK_REALM=haip
export KEYCLOAK_CLIENT_ID=haip-cron
export KEYCLOAK_CLIENT_SECRET=<secret>Scripts fetch a short-lived token automatically before each run.
Full Keycloak + local user linking guide: docs/integrations/service-principal.md.
If you refresh tokens externally, set HAIP_CRON_TOKEN to a valid Bearer JWT and omit Keycloak client vars.
| Variable | Required | Description |
|---|---|---|
HAIP_URL |
yes | Base URL of your deployment (no trailing slash) |
HAIP_PROPERTY_ID |
yes | Property UUID to operate on |
HAIP_BUSINESS_DATE |
no | Night audit date (YYYY-MM-DD); defaults to yesterday UTC |
HAIP_CRON_TOKEN |
option B | Pre-fetched JWT |
KEYCLOAK_URL |
option A | Keycloak base URL |
KEYCLOAK_REALM |
option A | Realm name (default haip) |
KEYCLOAK_CLIENT_ID |
option A | Cron service client id |
KEYCLOAK_CLIENT_SECRET |
option A | Cron service client secret |
OIDC_TOKEN_URL |
option A, non-Keycloak IdP | Token endpoint of any OIDC provider (e.g. Zitadel <issuer>/oauth/v2/token); replaces KEYCLOAK_URL + KEYCLOAK_REALM |
OIDC_TOKEN_SCOPE |
optional | scope sent with the client-credentials grant (Zitadel needs the project audience scope) |
chmod +x scripts/cron/*.shCopy crontab.example, edit paths and env, then:
crontab scripts/cron/crontab.exampleOr source env from a file:
# /etc/haip/cron.env (mode 600, root-owned)
set -a
source /etc/haip/cron.env
set +a
/path/to/haip/scripts/cron/night-audit.sh| Script | Schedule (typical) | API |
|---|---|---|
night-audit.sh |
Daily ~00:30 property local time | POST /api/v1/night-audit/run with "mode": "unattended" |
group-cutoffs.sh |
Daily after night audit | POST /api/v1/groups/blocks/process-cutoffs |
agent-runs.sh <agentType> |
See matrix in docs/operations/cron.md |
POST /api/v1/agents/:propertyId/:agentType/run?triggeredBy=schedule |
night-audit.sh posts {"propertyId","businessDate","mode":"unattended"}. That marks the run as a scheduled close. Do not drop mode when reimplementing the call. A body without mode is a manual close. The staff Night Audit screen omits mode on purpose. An API that accepts the extra field and does not use it ignores it and closes as before.
Revenue cadence: cron revenue_manager only — do not also schedule demand_forecast / pricing / overbooking / channel_mix / group_pickup (they run inside RManager).
Scripts exit non-zero on HTTP errors (non-2xx). Role: admin.