Brave APIask.brave.com ↗
Query Brave's AI answer engine via 2 endpoints. Get AI-generated answers with cited sources, web results, and autocomplete suggestions with entity data.
What is the Brave API?
The Brave Ask API exposes 2 endpoints that give you access to Brave's AI answer engine and its autocomplete suggestion system. The ask endpoint returns a Markdown-formatted AI-generated answer, cited sources with URLs and snippets, and the underlying web results used for generation. The suggest endpoint delivers ranked query completions, including entity-enriched results with names, descriptions, categories, and images.
curl -X GET 'https://api.parse.bot/scraper/0f327506-6891-4ea0-b754-24e85f0b5c73/suggest?query=python+programming&country=us' \ -H 'X-API-Key: $PARSE_API_KEY'
Typed, relational, agent-ready
A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.
- Fully typed · autocompletes
- Objects link to objects
- Typed errors & pagination
Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:
uv add parse-sdk uv run parse init uv run parse add --marketplace ask-brave-com-api
uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.
"""Walkthrough: Brave Ask SDK — autocomplete suggestions and AI answers."""
from parse_apis.ask_brave_com_api import BraveAsk, QueryRequired
client = BraveAsk()
# Get autocomplete suggestions for a partial query
for suggestion in client.suggestions.search(query="machine learning", limit=5):
print(suggestion.query, suggestion.is_entity)
# Ask a question and get an AI-generated answer with sources
answer = client.answers.create(query="What is the capital of France?")
print(answer.answer[:200])
print(f"Sources: {len(answer.sources)}, Web results: {len(answer.web_results)}")
# Access individual source details
for source in answer.sources[:3]:
print(source.title, source.url)
# Handle invalid input
try:
client.answers.create(query="")
except QueryRequired as e:
print(f"Error: {e}")
print("exercised: suggestions.search / answers.create / source attributes / error handling")
Retrieve autocomplete suggestions for a partial or full query. Returns ranked suggestions including entity-enriched results (with name, description, category, and image) alongside plain query completions.
| Param | Type | Description |
|---|---|---|
| queryrequired | string | The search query or partial query to get suggestions for. |
| country | string | Two-letter country code for localizing suggestions (e.g. us, gb, de, fr). |
{
"type": "object",
"fields": {
"query": "string",
"suggestions": "array of suggestion objects with query, is_entity, and optional name/description/category/image"
},
"sample": {
"data": {
"query": "python programming",
"suggestions": [
{
"name": "Python (programming language)",
"image": "https://imgs.search.brave.com/...",
"query": "python programming",
"category": "programming",
"is_entity": true,
"description": "general-purpose programming language"
},
{
"query": "python programming for beginners",
"is_entity": false
}
]
},
"status": "success"
}
}About the Brave API
Endpoints
The ask endpoint accepts a query string plus optional country and language parameters. Each call returns a answer field in Markdown format, a sources array where each entry carries a url, title, and snippet, a web_results array with the title, url, and description of each page consulted, and a conversation_id string. Every invocation starts a fresh conversation — there is no multi-turn state carried between calls via this API.
The suggest endpoint takes the same query input and an optional country code. It returns a suggestions array where each object includes a query string and an is_entity boolean. Entity results also carry name, description, category, and image fields, making them useful for disambiguation UI or knowledge-panel-style previews.
Localization
Both endpoints accept a country parameter (two-letter ISO code such as us, gb, or de) to bias results toward a specific region. The ask endpoint additionally accepts a language code (e.g. en, fr, es) to control the language of the AI-generated answer and sources returned.
Response Shape Notes
The ask endpoint's answer field is plain Markdown, so consuming applications can render it directly or strip formatting as needed. The sources and web_results arrays are separate: sources are the references explicitly cited in the answer, while web_results is the broader set of pages consulted during generation. The suggest endpoint's entity entries are only present when the input matches a recognized named entity — plain completions omit name, description, category, and image.
The Brave API is a managed, monitored endpoint for ask.brave.com — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when ask.brave.com changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.
This isn't an official ask.brave.com API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.
Will this API break when the source site changes?+
Is this an official API from the source site?+
Can I fix or extend this API myself if I need a new endpoint or field?+
What happens if I call an endpoint that has an issue?+
- Build a research assistant that returns cited answers and lets users follow source URLs directly from the
sourcesarray. - Power a search bar autocomplete that shows entity cards (name, category, image) for recognized named entities alongside plain query completions.
- Generate topic summaries from the
answerfield and supplement them with theweb_resultslist for further reading links. - Localize AI answers for regional audiences by passing
countryandlanguageparameters to theaskendpoint. - Seed a Q&A knowledge base by storing
conversation_id,answer, andsourcesfields for audit and review workflows. - Filter
suggestresults byis_entityto build an entity-disambiguation picker that displays category and description metadata.
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 100 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 100 req/min |
One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does Brave offer an official developer API for its search or AI products?+
What does the `ask` endpoint return beyond the AI-generated answer?+
answer field (Markdown text), the response includes a sources array of explicitly cited references — each with url, title, and snippet — a web_results array of pages consulted during generation with title, url, and description, and a conversation_id string identifying the session.Can I continue a conversation across multiple `ask` calls using the `conversation_id`?+
ask call creates a new conversation and returns a conversation_id, but the API does not accept a prior conversation_id as input to continue a thread. You can fork this API on Parse and revise it to add a multi-turn endpoint that threads follow-up questions.Does the `suggest` endpoint always return entity fields like `name`, `description`, and `image`?+
is_entity is true — that is, when the query matches a recognized named entity. Plain query completions return only the query string and is_entity: false. The country parameter can shift which entities are recognized.Does the API support fetching image or video search results through Brave Ask?+
ask endpoint and query suggestions via the suggest endpoint. Image or video results are not part of the response shape. You can fork this API on Parse and revise it to add an endpoint targeting image or video search results.