Reference
CLI
Manage endpoints, destinations, and secrets from the terminal, and keep project configuration in version control with pull and apply.
The hooks CLI logs in with an API key and talks to the same public /v1 API as the console. Install it from this repository, then run:
hooks login --api-key "$HOOKS_API_KEY"hooks whoamiThe CLI token is written to ~/.config/hooks/config.json with mode 600 and is never printed.
Resource commands
Section titled “Resource commands”Every resource command supports --json for machine-readable output.
# Endpointshooks endpoints listhooks endpoints get ep_123hooks endpoints create --file endpoint.yamlhooks endpoints update ep_123 --file endpoint.yamlhooks endpoints delete ep_123
# Destinations (list and create need the owning endpoint)hooks destinations list --endpoint ep_123hooks destinations get dst_123hooks destinations create --endpoint ep_123 --file destination.yamlhooks destinations update dst_123 --file destination.yamlhooks destinations delete dst_123
# Secrets: values are write-only and never printedhooks secrets listhooks secrets get sec_123hooks secrets create --file secret.yamlhooks secrets update sec_123 --file secret.yamlhooks secrets delete sec_123
# Built-in and project templates; apply creates an endpointhooks templates listhooks templates get stripe-to-httphooks templates apply stripe-to-http --values '{"url":"https://example.com/hook"}'
# Project templates: create/update/delete take a full definitionhooks templates create --file acme.yamlhooks templates update acme --data '{"name":"Acme (staging)"}'hooks templates delete acmeBuilt-in templates are read-only; custom is true for templates created in the workspace. Creating or updating a template needs the endpoints:write scope and workspace admin, and ids cannot collide with built-ins.
--file accepts YAML or JSON. --data '<json>' passes an object inline. Bodies match the REST API request shapes in the API reference.
Secret responses contain metadata only. The CLI never prints a secret value, including after secrets create or secrets update.
Config as code
Section titled “Config as code”hooks pull exports endpoints, their destinations, and secret names. Secret values are omitted because the API is write-only.
hooks pull --output hooks.yamlhooks pull --format json --output hooks.jsonhooks apply compares the file with the live project and creates or patches the difference. It matches endpoints by name and destinations by name (or URL when a destination has no name).
hooks apply -f hooks.yaml --dry-run # print the diff, write nothinghooks apply -f hooks.yaml # prompt before writinghooks apply -f hooks.yaml --yes # non-interactivehooks apply -f hooks.yaml --prune # also delete destinations/secrets missing from the fileA pull followed by an apply is a no-op: the second run prints only = lines and applied 0 change(s).
To create secrets in a new workspace, provide values at apply time. value: in the file works for local runs, but prefer an environment variable named after the secret:
version: 1endpoints: - name: Orders provider: stripe verificationMode: hmac destinations: - name: Production API url: https://api.example.com/hooks/orderssecrets: - name: STRIPE_WEBHOOK_SECRETHOOKS_SECRET_STRIPE_WEBHOOK_SECRET=whsec_... hooks apply -f hooks.yaml --yesSecret names map to HOOKS_SECRET_<NAME> with non-alphanumeric characters replaced by _.
Limitations
Section titled “Limitations”Endpoints and destinations are never deleted by apply; deletion stays an explicit hooks endpoints delete or hooks destinations delete. Templates come from the server catalog and cannot be created, updated, or deleted through the API.