HTTP API
The REST API gives you direct HTTP access to webref from any language or environment. No SDK required — just standard HTTP requests.
Authentication
Include your API key in the Authorization header:
Authorization: Bearer wbrf_your_key_herebash
curl -X POST https://webref.ai/api/research \
-H "Authorization: Bearer wbrf_your_key" \
-H "Content-Type: application/json" \
-d '{"query": "how to use React hooks"}'The response contains the synthesized answer, source URLs, credits used, and duration:
json
{
"content": "# React Hooks\n\nHooks let you use state...",
"sources": ["https://react.dev/reference/react"],
"creditsUsed": 1,
"duration": "14.2s"
}Credits: 1 per call.
Streaming
For live progress, use the SSE streaming endpoint:
bash
curl -N -X POST https://webref.ai/api/research/stream \
-H "Authorization: Bearer wbrf_your_key" \
-H "Content-Type: application/json" \
-H "Accept: text/event-stream" \
-d '{"query": "what are the best LLMs today"}'Events include search.query_generated, source.discovered, source.completed, answer.delta, and research.completed. See the full API Reference for all event types and fields.
The initial response includes X-Research-Stream-Id, every SSE frame includes an id: line, and reconnecting clients can resume on the same running server instance by sending {"streamId":"..."} plus Last-Event-ID.
Quick examples
Python:
python
import requests
response = requests.post(
"https://webref.ai/api/research",
headers={"Authorization": "Bearer wbrf_your_key"},
json={"query": "Python async patterns"}
)
print(response.json()["content"])JavaScript:
javascript
const response = await fetch("https://webref.ai/api/research", {
method: "POST",
headers: {
"Authorization": "Bearer wbrf_your_key",
"Content-Type": "application/json"
},
body: JSON.stringify({ query: "JavaScript promises" })
});
const result = await response.json();
console.log(result.content);Go:
go
req, _ := http.NewRequest("POST", "https://webref.ai/api/research",
strings.NewReader(`{"query": "Go error handling"}`))
req.Header.Set("Authorization", "Bearer wbrf_your_key")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)What's next
- API Reference — Full endpoint documentation with all fields and error codes
- MCP integration — Connect webref to your AI agent in one paste