openclaw - ✅(Solved) Fix [Bug]: Brave Search API authentication broken - X-Subscription-Token header required [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#69673Fetched 2026-04-22 07:49:28
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Participants
Timeline (top)
labeled ×2cross-referenced ×1

Description Brave Search API recently changed authentication from URL parameter apikey to requiring the X-Subscription-Token header. OpenClaw's websearch tool still sends the key as a URL query parameter, causing all searches to fail. Expected behavior web_search tool should return search results successfully using the configured Brave Search API key.

Error Message

Error response from Brave APIjson { "error": { "code": "VALIDATION", "detail": "Unable to validate request parameter(s)", "meta": { "errors": [ { "input": null,

Root Cause

Description Brave Search API recently changed authentication from URL parameter apikey to requiring the X-Subscription-Token header. OpenClaw's websearch tool still sends the key as a URL query parameter, causing all searches to fail. Expected behavior web_search tool should return search results successfully using the configured Brave Search API key.

Fix Action

Fixed

PR fix notes

PR #69704: test(brave): add regression tests for X-Subscription-Token header auth (#69673)

Description (problem / solution / changelog)

Summary

Fixes #69673 — Brave Search API authentication broken.

The Brave Search API requires the API key to be sent via the X-Subscription-Token request header (not as a URL query parameter). The runtime implementation already sends the header correctly, but there were no tests verifying this behavior, leaving the door open for regressions.

Changes

Added two regression tests in extensions/brave/src/brave-web-search-provider.test.ts:

TestWhat it verifies
web mode auth headerX-Subscription-Token header is sent with the correct API key
llm-context mode auth headerSame verification for the LLM Context endpoint

Both tests also assert that the API key does not appear as a URL query parameter (apikey or key), which is the exact failure mode reported in #69673.

Why this matters

Without these tests, a refactor could silently regress to sending apikey as a query param and break every Brave Search user — exactly what the issue reports happened. This locks in the correct auth behavior for both API modes.

Testing

✓ extensions/brave/src/brave-web-search-provider.test.ts (11 tests) 300ms

All 11 tests pass, including the 2 new regression tests.

Changed files

  • extensions/brave/src/brave-web-search-provider.test.ts (modified, +74/-0)
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Description Brave Search API recently changed authentication from URL parameter apikey to requiring the X-Subscription-Token header. OpenClaw's websearch tool still sends the key as a URL query parameter, causing all searches to fail. Expected behavior web_search tool should return search results successfully using the configured Brave Search API key.

Steps to reproduce

Configure Brave Search API key in OpenClaw Use web_search tool Error response from Brave APIjson { "error": { "code": "VALIDATION", "detail": "Unable to validate request parameter(s)", "meta": { "errors": [ { "input": null, "loc": ["header", "x-subscription-token"], "msg": "Field required", "type": "missing" } ] } } } Possible fix OpenClaw should send the API key via the X-Subscription-Token request header instead of as a URL query parameter.

Expected behavior

web_search tool should successfully return search results using the configured Brave Search API key.

Actual behavior

web_search tool should successfully return search results using the configured Brave Search API key.

OpenClaw version

3.2

Operating system

windows 11

Install method

No response

Model

minimax

Provider / routing chain

openclaw

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

Update OpenClaw's websearch tool to send the Brave Search API key via the X-Subscription-Token request header instead of as a URL query parameter.

Guidance

  • Identify the code section in OpenClaw's websearch tool where the API key is being sent as a URL query parameter and modify it to send the key via the X-Subscription-Token header.
  • Verify that the X-Subscription-Token header is correctly set by checking the request headers sent by OpenClaw's websearch tool.
  • Test the updated websearch tool with a sample search query to ensure it returns search results successfully using the configured Brave Search API key.
  • Review the Brave Search API documentation to ensure compliance with the updated authentication requirements.

Example

# Before
import requests
url = "https://api.brave.com/search?q=example&apikey=YOUR_API_KEY"
response = requests.get(url)

# After
import requests
url = "https://api.brave.com/search?q=example"
headers = {"X-Subscription-Token": "YOUR_API_KEY"}
response = requests.get(url, headers=headers)

Notes

The fix assumes that the OpenClaw websearch tool uses a library like requests in Python to send HTTP requests. The actual implementation may vary depending on the programming language and libraries used.

Recommendation

Apply workaround: Update OpenClaw's websearch tool to send the API key via the X-Subscription-Token header, as this is the recommended approach by the Brave Search API.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

web_search tool should successfully return search results using the configured Brave Search API key.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Bug]: Brave Search API authentication broken - X-Subscription-Token header required [1 pull requests, 1 participants]