/v1/* surface की तरह, shared-secret bearer प्रमाणीकरण को पूरे gateway के लिए trusted operator access माना जाता है।
POST /tools/invoke- Gateway जैसा ही port (WS + HTTP multiplex):
http://<gateway-host>:<port>/tools/invoke
प्रमाणीकरण
Gateway auth configuration का उपयोग करता है। सामान्य HTTP auth paths:- shared-secret auth (
gateway.auth.mode="token"या"password"):Authorization: Bearer <token-or-password> - trusted identity-bearing HTTP auth (
gateway.auth.mode="trusted-proxy"): configured identity-aware proxy के माध्यम से route करें और उसे आवश्यक identity headers inject करने दें - private-ingress open auth (
gateway.auth.mode="none"): कोई auth header आवश्यक नहीं
- जब
gateway.auth.mode="token"हो, तोgateway.auth.token(याOPENCLAW_GATEWAY_TOKEN) का उपयोग करें। - जब
gateway.auth.mode="password"हो, तोgateway.auth.password(याOPENCLAW_GATEWAY_PASSWORD) का उपयोग करें। - जब
gateway.auth.mode="trusted-proxy"हो, तो HTTP request को configured trusted proxy source से आना चाहिए; same-host loopback proxies के लिए explicitgateway.auth.trustedProxy.allowLoopback = trueआवश्यक है। - Internal same-host callers जो proxy को bypass करते हैं, वे local direct
fallback के रूप में
gateway.auth.password/OPENCLAW_GATEWAY_PASSWORDका उपयोग कर सकते हैं। कोई भीForwarded,X-Forwarded-*, याX-Real-IPheader evidence request को इसके बजाय trusted-proxy path पर रखता है। - यदि
gateway.auth.rateLimitconfigured है और बहुत अधिक auth failures होते हैं, तो endpointRetry-Afterके साथ429लौटाता है।
सुरक्षा सीमा (महत्वपूर्ण)
इस endpoint को gateway instance के लिए पूर्ण operator-access surface मानें।- यहां HTTP bearer auth कोई संकीर्ण per-user scope model नहीं है।
- इस endpoint के लिए valid Gateway token/password को owner/operator credential जैसा माना जाना चाहिए।
- shared-secret auth modes (
tokenऔरpassword) के लिए, endpoint normal full operator defaults restore करता है, भले ही caller एक संकराx-openclaw-scopesheader भेजे। - Shared-secret auth इस endpoint पर direct tool invokes को owner-sender turns भी मानता है।
- Trusted identity-bearing HTTP modes (उदाहरण के लिए trusted proxy auth या private ingress पर
gateway.auth.mode="none") मौजूद होने परx-openclaw-scopesका सम्मान करते हैं और अन्यथा normal operator default scope set पर fall back करते हैं। - इस endpoint को केवल loopback/tailnet/private ingress पर रखें; इसे सीधे public internet पर expose न करें।
gateway.auth.mode="token"या"password"+Authorization: Bearer ...- shared gateway operator secret के possession को prove करता है
- संकरे
x-openclaw-scopesको ignore करता है - full default operator scope set restore करता है:
operator.admin,operator.approvals,operator.pairing,operator.read,operator.talk.secrets,operator.write - इस endpoint पर direct tool invokes को owner-sender turns मानता है
- trusted identity-bearing HTTP modes (उदाहरण के लिए trusted proxy auth, या private ingress पर
gateway.auth.mode="none")- किसी outer trusted identity या deployment boundary को authenticate करते हैं
- header मौजूद होने पर
x-openclaw-scopesका सम्मान करते हैं - header अनुपस्थित होने पर normal operator default scope set पर fall back करते हैं
- owner semantics केवल तब खोते हैं जब caller स्पष्ट रूप से scopes को narrow करता है और
operator.adminको omit करता है
Request body
tool(string, आवश्यक): invoke करने के लिए टूल नाम।action(string, वैकल्पिक): यदि tool schemaactionको support करता है और args payload ने इसे omit किया है, तो args में mapped किया जाता है।args(object, वैकल्पिक): tool-specific arguments।sessionKey(string, वैकल्पिक): target session key। यदि omit किया गया है या"main"है, तो Gateway configured main session key का उपयोग करता है (session.mainKeyऔर default agent का सम्मान करता है, या global scope मेंglobal)।dryRun(boolean, वैकल्पिक): future use के लिए reserved; अभी ignored है।
Policy + routing behavior
Tool availability को Gateway agents द्वारा उपयोग की जाने वाली same policy chain से filter किया जाता है:tools.profile/tools.byProvider.profiletools.allow/tools.byProvider.allowagents.<id>.tools.allow/agents.<id>.tools.byProvider.allow- group policies (यदि session key किसी group या channel पर map होती है)
- subagent policy (subagent session key के साथ invoke करते समय)
- Exec approvals operator guardrails हैं, इस HTTP endpoint के लिए कोई separate authorization boundary नहीं। यदि कोई टूल यहां Gateway auth + tool policy के माध्यम से reachable है, तो
/tools/invokeकोई extra per-call approval prompt नहीं जोड़ता। - यदि
execयहां reachable है, तो इसे mutating shell surface मानें।write,edit,apply_patch, या HTTP filesystem-write tools को deny करना shell execution को read-only नहीं बनाता। - Gateway bearer credentials को untrusted callers के साथ share न करें। यदि आपको trust boundaries के बीच separation चाहिए, तो separate gateways चलाएं (और ideally separate OS users/hosts)।
exec- direct command execution (RCE surface)spawn- arbitrary child process creation (RCE surface)shell- shell command execution (RCE surface)fs_write- host पर arbitrary file mutationfs_delete- host पर arbitrary file deletionfs_move- host पर arbitrary file move/renameapply_patch- patch application arbitrary files rewrite कर सकता हैsessions_spawn- session orchestration; agents को remotely spawn करना RCE हैsessions_send- cross-session message injectioncron- persistent automation control planegateway- gateway control plane; HTTP के माध्यम से reconfiguration रोकता हैnodes- node command relay paired hosts पर system.run तक पहुंच सकता हैwhatsapp_login- terminal QR scan की आवश्यकता वाला interactive setup; HTTP पर hangs
gateway.tools के माध्यम से इस deny list को customize कर सकते हैं:
gateway.tools.allow exposure override है, scope upgrade नहीं। Identity-bearing HTTP modes में, cron, gateway, और nodes उन callers के लिए unavailable रहते हैं जिनके पास owner/admin identity (operator.admin) नहीं है, भले ही वे gateway.tools.allow में listed हों। Shared-secret bearer auth अभी भी ऊपर दिए गए full trusted-operator rule का पालन करता है।
Group policies को context resolve करने में मदद करने के लिए, आप optionally set कर सकते हैं:
x-openclaw-message-channel: <channel>(उदाहरण:slack,telegram)x-openclaw-account-id: <accountId>(जब multiple accounts मौजूद हों)
Responses
200→{ ok: true, result }400→{ ok: false, error: { type, message } }(invalid request या tool input error)401→ unauthorized429→ auth rate-limited (Retry-Afterset)404→ tool available नहीं है (not found या allowlisted नहीं)405→ method allowed नहीं है500→{ ok: false, error: { type, message } }(unexpected tool execution error; sanitized message)