Skip to content

Gateway API

The gateway is Human’s HTTP server. It serves the Control UI, handles webhooks from messaging channels, and provides a WebSocket control protocol for real-time control.

Terminal window
human gateway # Default: 127.0.0.1:3000
human gateway --port 8080 # Custom port
human gateway --host 127.0.0.1 # Bind to localhost only

Gateway settings in ~/.human/config.json:

{
"gateway": {
"enabled": true,
"port": 3000,
"host": "::",
"require_pairing": false,
"allow_public_bind": false,
"pair_rate_limit_per_minute": 60,
"webhook_hmac_secret": null,
"control_ui_dir": null,
"cors_origins": []
}
}
  • If auth_token is configured, WebSocket clients must send Authorization: Bearer <token> on upgrade.
  • If no auth token is set, localhost connections are typically accepted without a token.

Webhooks can verify request integrity with HMAC-SHA256:

  • Set webhook_hmac_secret in config or HUMAN_WEBHOOK_HMAC_SECRET
  • Incoming webhook requests are checked against the X-Signature header (or similar) using the secret and request body
  • Invalid signatures receive 401 Unauthorized

Connect to ws://<host>:<port>/ws for the control protocol. Messages are JSON-RPC 2.0.

After connecting, the server sends a hello-ok message with:

  • server.version: e.g. "0.1.0"
  • protocol: version number
  • features.methods: list of supported RPC methods
  • features.sessions, features.cron, features.skills, features.cost_tracking: booleans
MethodDescription
connectInitial handshake (implicit)
healthHealth check
config.getGet current configuration
config.schemaGet config schema
config.setUpdate configuration
config.applyApply and persist config
capabilitiesList channels, tools, providers
chat.sendSend message to agent
chat.historyGet conversation history
chat.abortAbort current generation
sessions.listList sessions
sessions.patchUpdate session
sessions.deleteDelete session
tools.catalogList available tools
channels.statusChannel health
cron.listList scheduled jobs
cron.addAdd cron job
cron.removeRemove cron job
cron.runManually trigger a job
skills.listList installed skills
skills.installInstall a skill
skills.enableEnable a skill
skills.disableDisable a skill
update.checkCheck for updates
update.runApply update
exec.approval.resolveResolve tool approval
usage.summaryUsage/cost summary
models.listList models
nodes.listList nodes
push.registerRegister for push
push.unregisterUnregister from push
{
"type": "req",
"id": "1",
"method": "chat.send",
"params": { "message": "Hello" }
}

For chat.send with stream: true, responses arrive as notifications with method: "chat.chunk" and incremental content.

Channels register webhooks under /webhook/<channel> or legacy paths:

PathChannel
/webhook/telegramTelegram
/webhook/discordDiscord
/webhook/slackSlack
/webhook/whatsappWhatsApp
/webhook/lineLine
/webhook/larkLark
/telegramTelegram (legacy)
/slack/eventsSlack (legacy)

Webhook payloads are channel-specific (Telegram Update, Slack event envelope, etc.). The gateway routes them to the appropriate channel handler.

When control_ui_dir is set, the gateway serves static files from that directory. This is used for the built-in Control UI (SPA) for managing the agent, cron, skills, and config.