Documentation Index
Fetch the complete documentation index at: https://mintlify.com/openclaw/openclaw/llms.txt
Use this file to discover all available pages before exploring further.
Authentication
The OpenClaw Gateway API supports multiple authentication methods to secure access to your agents and data.Authentication Methods
Bearer Token
The primary authentication method. Include your token in theAuthorization header:
Password Authentication
Alternative to token-based auth:Device Token Authentication
For mobile and desktop clients, device tokens are issued after pairing:- Client requests pairing via
node.pair.request - Gateway admin approves via
node.pair.approve - Client receives a device token
- Client authenticates with device token
Tailscale Authentication
When running behind Tailscale Serve, the Gateway can authenticate users via Tailscale identity:enabled- Allow Tailscale auth alongside token/passwordrequire- Only accept Tailscale-authenticated requestsdisabled- Disable Tailscale auth
Tailscale-User-Login headers injected by Tailscale Serve.
Trusted Proxy Authentication
For trusted reverse proxies (e.g., Cloudflare, nginx):trustedProxies and reads the user identity from the configured header.
Local Loopback (No Auth)
Requests fromlocalhost (127.0.0.1, ::1) are automatically authenticated when:
- Client IP is loopback
- Host header is
localhost,127.0.0.1, or::1 - No proxy forwarding headers present
Authentication Priority
The Gateway checks authentication methods in this order:- Local loopback - Bypass auth for local requests
- Device token - Check device token from pairing
- Bearer token - Check configured token
- Password - Check configured password
- Tailscale - Check Tailscale identity (if enabled)
- Trusted proxy - Check proxy header (if enabled)
Rate Limiting
To prevent brute-force attacks, the Gateway rate-limits failed authentication attempts:- Limit: 20 failures per client per 60-second window
- Tracking: By client IP address
- Response: HTTP
429 Too Many RequestswithRetry-Afterheader
WebSocket Authentication
WebSocket connections authenticate during the initialconnect handshake:
control- Full control plane accessnode- Device/node role (mobile, desktop)webchat- Web chat interface
HTTP Authentication
HTTP endpoints authenticate viaAuthorization header:
Security Best Practices
Use strong tokens
Use strong tokens
Generate tokens with sufficient entropy:Store tokens securely (environment variables, secret managers).
Limit network exposure
Limit network exposure
Bind Gateway to loopback when possible:Use Tailscale or VPN for remote access instead of exposing to the internet.
Rotate tokens regularly
Rotate tokens regularly
For device tokens, use rotation endpoints:
Monitor authentication failures
Monitor authentication failures
Gateway logs failed authentication attempts. Monitor for suspicious activity:
Troubleshooting
401 Unauthorized:- Verify token matches
gateway.auth.tokenin config - Check token is sent in
Authorization: Bearerheader - Ensure no extra whitespace in token
- Wait for the
Retry-Afterduration - Check for authentication failures in logs
- Verify token is correct to avoid repeated failures
- Verify Gateway is running:
openclaw status - Check bind address:
openclaw config get gateway.bind - Confirm port:
openclaw config get gateway.port
Next Steps
WebSocket Protocol
Connect via WebSocket
Device Pairing
Pair mobile/desktop devices

