curl -sS -X POST "$BMA_BASE_URL/v1/web_fetches" \
-H "x-api-key: $BMA_API_KEY" \
-H "bma-workspace-id: $BMA_PROJECT_ID" \
-H "Idempotency-Key: $(uuidgen)" \
-H "content-type: application/json" \
-d '{
"url": "https://example.com/",
"max_chars": 2000
}'{
"id": "wfetch_agq7b3l2m4n5p6q7r8s9t0u1v2",
"type": "web_fetch",
"created_at": "2026-11-24T08:00:00Z",
"url": "https://example.com/",
"final_url": "https://example.com/",
"title": "Example Domain",
"content_type": "text/html",
"format": "markdown",
"content": "# Example Domain\n\nThis domain is for use in illustrative examples in documents.",
"truncated": false,
"content_chars": 84,
"usage": {
"web_fetch_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>"
}Fetch a web page
Fetches one public page and answers its main content as markdown or text. Only public addresses are reached (checked on every connection and redirect, at most 5 redirects); robots.txt is respected; no cookies or credentials are sent; at most 5 MB and 20 seconds; HTML, text, markdown, JSON, XML and CSV only; no JavaScript and no PDF. With an Idempotency-Key, the same key and body within 24 hours replays the first answer without a second charge. Errors: 400 invalid_request, url_not_allowed (not http(s), credentials in the URL, a non-public address or disallowed by robots.txt), unsupported_content_type, content_too_large; 403 insufficient_credits; 429 rate_limited; 500 fetch_failed (the site failed, timed out or answered an error).
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 fetches per minute (all callers, sessions included); past it 429
rate_limitedwithRetry-After. - At most 5 MB and 20 seconds per page, 5 redirects;
max_chars1000 to 100000. - USD 1 per 1,000 fetched pages (model
web-fetchin 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 | content_too_large | The page is larger than 5 MB. | Fetch a smaller page or another URL. |
| 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. |
| 400 | invalid_request_error | unsupported_content_type | The page is not HTML, text, markdown, JSON, XML or CSV. | Fetch a page of a supported type. |
| 400 | invalid_request_error | url_not_allowed | The URL is not http(s), carries credentials, reaches a non-public address or robots.txt disallows it. | Fetch a public http(s) URL that robots.txt allows. |
| 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 fetches of this minute. | Wait for the retry-after delay, then retry. |
| 500 | api_error | fetch_failed | The site failed, timed out, did not resolve or answered an error. | Retry later or fetch another URL. |
curl -sS -X POST "$BMA_BASE_URL/v1/web_fetches" \
-H "x-api-key: $BMA_API_KEY" \
-H "bma-workspace-id: $BMA_PROJECT_ID" \
-H "Idempotency-Key: $(uuidgen)" \
-H "content-type: application/json" \
-d '{
"url": "https://example.com/",
"max_chars": 2000
}'{
"id": "wfetch_agq7b3l2m4n5p6q7r8s9t0u1v2",
"type": "web_fetch",
"created_at": "2026-11-24T08:00:00Z",
"url": "https://example.com/",
"final_url": "https://example.com/",
"title": "Example Domain",
"content_type": "text/html",
"format": "markdown",
"content": "# Example Domain\n\nThis domain is for use in illustrative examples in documents.",
"truncated": false,
"content_chars": 84,
"usage": {
"web_fetch_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 page fetch. The same schema as the input of the web_fetch tool (contracts tool.json WebFetchInput).
Response
Success.
The answer of one page fetch.