Tools Invoke (HTTP)
OpenClaw’s Gateway exposes a simple HTTP endpoint for invoking a single tool directly. It is always enabled and uses Gateway auth plus tool policy, but callers that pass Gateway bearer auth are treated as trusted operators for that gateway.POST /tools/invoke- Same port as the Gateway (WS + HTTP multiplex):
http://<gateway-host>:<port>/tools/invoke
Authentication
Uses the Gateway auth configuration. Send a bearer token:Authorization: Bearer <token>
- When
gateway.auth.mode="token", usegateway.auth.token(orOPENCLAW_GATEWAY_TOKEN). - When
gateway.auth.mode="password", usegateway.auth.password(orOPENCLAW_GATEWAY_PASSWORD). - If
gateway.auth.rateLimitis configured and too many auth failures occur, the endpoint returns429withRetry-After. - Treat this credential as a full-access operator secret for that gateway. It is not a scoped API token for a narrower
/tools/invokerole.
Request body
tool(string, required): tool name to invoke.action(string, optional): mapped into args if the tool schema supportsactionand the args payload omitted it.args(object, optional): tool-specific arguments.sessionKey(string, optional): target session key. If omitted or"main", the Gateway uses the configured main session key (honorssession.mainKeyand default agent, orglobalin global scope).dryRun(boolean, optional): reserved for future use; currently ignored.
Policy + routing behavior
Tool availability is filtered through the same policy chain used by Gateway agents:tools.profile/tools.byProvider.profiletools.allow/tools.byProvider.allowagents.<id>.tools.allow/agents.<id>.tools.byProvider.allow- group policies (if the session key maps to a group or channel)
- subagent policy (when invoking with a subagent session key)
POST /tools/invokeis in the same trusted-operator bucket as other Gateway HTTP APIs such as/v1/chat/completions,/v1/responses, and/api/channels/*.- Exec approvals are operator guardrails, not a separate authorization boundary for this HTTP endpoint. If a tool is reachable here via Gateway auth + tool policy,
/tools/invokedoes not add an extra per-call approval prompt. - Do not share Gateway bearer credentials with untrusted callers. If you need separation across trust boundaries, run separate gateways (and ideally separate OS users/hosts).
cronsessions_spawnsessions_sendgatewaywhatsapp_login
gateway.tools:
x-openclaw-message-channel: <channel>(example:slack,telegram)x-openclaw-account-id: <accountId>(when multiple accounts exist)
Responses
200→{ ok: true, result }400→{ ok: false, error: { type, message } }(invalid request or tool input error)401→ unauthorized429→ auth rate-limited (Retry-Afterset)404→ tool not available (not found or not allowlisted)405→ method not allowed500→{ ok: false, error: { type, message } }(unexpected tool execution error; sanitized message)