Skip to main content
buttons serve runs a local HTTP API that exposes the same press path as the CLI.
By default it binds to 127.0.0.1:8080.

Endpoints

Press a button

The response uses the same envelope as CLI JSON output:

Auth

Every endpoint except /api/health requires a bearer token when an API key is configured. The key comes from the first available source:
  1. --api-key
  2. API_KEY battery
  3. BUTTONS_API_KEY environment variable
Call with:

Binding rules

Without an API key, buttons serve only allows loopback binding. Binding 0.0.0.0 without auth is refused.

HTTP buttons are gated

Pressing HTTP buttons through the REST API is disabled by default because an exposed API can otherwise trigger outbound requests. Enable it explicitly:
Code and prompt buttons are pressable without this flag.

Trigger engine

buttons serve also runs the in-process button trigger engine and mounts webhook trigger routes alongside the API. Button triggers (buttons trigger add) fire here:
  • cron triggers run on their schedule.
  • watch triggers poll their watched file (mtime/size, 500ms).
  • webhook triggers mount a POST <path> route on the same listener, gated by the optional shared --token (X-Buttons-Token header or ?token=).
Disable the engine to run the API alone:
This is the button-trigger layer (single shared token, no tunnel). Drawer webhook triggers — n8n-style auth behind a Cloudflare tunnel — are a separate layer served by buttons webhook listen.