curl -sS -X POST "$BMA_BASE_URL/v1/web_searches" \
-H "x-api-key: $BMA_API_KEY" \
-H "bma-workspace-id: $BMA_PROJECT_ID" \
-H "Idempotency-Key: $(uuidgen)" \
-H "content-type: application/json" \
-d '{
"query": "Model Context Protocol authorization",
"num_results": 2,
"recency": "year"
}'{
"id": "wsrch_agq7b3l2m4n5p6q7r8s9t0u1v2",
"type": "web_search",
"created_at": "2026-11-24T08:00:00Z",
"query": "Model Context Protocol authorization",
"provider": "tavily",
"results": [
{
"rank": 1,
"url": "https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization",
"title": "Authorization - Model Context Protocol",
"snippet": "Authorization is optional for MCP implementations. When supported, HTTP transports should conform to this specification.",
"published_at": "2025-11-25T00:00:00Z"
},
{
"rank": 2,
"url": "https://datatracker.ietf.org/doc/html/rfc9728",
"title": "RFC 9728: OAuth 2.0 Protected Resource Metadata"
}
],
"usage": {
"web_search_requests": 1
}
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"bma_error_code": "<string>"
},
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"bma_error_code": "<string>"
},
"request_id": "<string>"
}Search the web
Runs one web search with the platform’s providers and answers the ranked results (title, URL, snippet, publication time). A query mostly in CJK script or a zh locale is answered by a provider that serves Chinese first. With an Idempotency-Key, the same key and body within 24 hours replays the first answer without a second charge. Errors: 400 invalid_request; 403 insufficient_credits; 429 rate_limited; 529 search_unavailable (every provider failed; retry later).
Authorization: An organization API key, a personal access token or OAuth access token, or a dashboard session. Any workspace role may call; the workspace is the credential’s own or bma-workspace-id.
Limits:
- Each organization may run 120 searches per minute (all callers, sessions included); past it 429
rate_limitedwithRetry-After. queryat most 400 characters;num_results1 to 10; at most 20 domains.- USD 10 per 1,000 answered searches (model
web-searchin the usage and cost reports); failures are not charged. - Rate limit: one request of the organization’s write budget (Rate limits).
Errors (besides the common errors (401 authentication, 429 rate_limited, 500)):
| Status | error.type | error.code | Cause | Fix |
|---|---|---|---|---|
| 400 | invalid_request_error | idempotency_key_reused | The Idempotency-Key was used with another body within 24 hours. | Correct the request as the message describes and send it again; the same request will keep failing. |
| 400 | invalid_request_error | invalid_request | The body does not match the schema or its limits. | Send a body of the schema. |
| 403 | permission_error | insufficient_credits | The organization’s billing does not admit new paid work. | Use a credential with the required role or access; retrying with the same credential will not help. |
| 409 | conflict_error | idempotency_key_in_use | A call with the same Idempotency-Key is still running. | Retry the same request after a short delay. |
| 429 | rate_limit_error | rate_limited | The organization used up its searches of this minute. | Wait for the retry-after delay, then retry. |
| 529 | overloaded_error | search_unavailable | Every search provider failed or is throttled. | Retry with exponential backoff. |
curl -sS -X POST "$BMA_BASE_URL/v1/web_searches" \
-H "x-api-key: $BMA_API_KEY" \
-H "bma-workspace-id: $BMA_PROJECT_ID" \
-H "Idempotency-Key: $(uuidgen)" \
-H "content-type: application/json" \
-d '{
"query": "Model Context Protocol authorization",
"num_results": 2,
"recency": "year"
}'{
"id": "wsrch_agq7b3l2m4n5p6q7r8s9t0u1v2",
"type": "web_search",
"created_at": "2026-11-24T08:00:00Z",
"query": "Model Context Protocol authorization",
"provider": "tavily",
"results": [
{
"rank": 1,
"url": "https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization",
"title": "Authorization - Model Context Protocol",
"snippet": "Authorization is optional for MCP implementations. When supported, HTTP transports should conform to this specification.",
"published_at": "2025-11-25T00:00:00Z"
},
{
"rank": 2,
"url": "https://datatracker.ietf.org/doc/html/rfc9728",
"title": "RFC 9728: OAuth 2.0 Protected Resource Metadata"
}
],
"usage": {
"web_search_requests": 1
}
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"bma_error_code": "<string>"
},
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"bma_error_code": "<string>"
},
"request_id": "<string>"
}Headers
Body
A web search. The same schema as the input of the web_search tool (contracts tool.json WebSearchInput).
Response
Success.
The answer of one web search.