websearch.fast
ConsoleGet a key

Quick start

Get a key, run a first search, read a page and handle errors.

1. Get a key

websearch.fast uses relay.fast accounts. Sign in to the console with your relay.fast account and create a key there, or create one on the relay.fast keys page. The same key calls the models and the Web API, and both are paid from the same balance.

export WEBSEARCH_API_KEY="sk-..."
curl https://api.websearch.fast/v1/web/search \
  -H "Authorization: Bearer $WEBSEARCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"q": "postgres 18 release notes", "num": 5}'
import os
import httpx

response = httpx.post(
    "https://api.websearch.fast/v1/web/search",
    headers={"Authorization": f"Bearer {os.environ['WEBSEARCH_API_KEY']}"},
    json={
        "q": "postgres 18 release notes",
        "num": 5,
    },
    timeout=60,
)
response.raise_for_status()
print(response.json())
const response = await fetch("https://api.websearch.fast/v1/web/search", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.WEBSEARCH_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    q: "postgres 18 release notes",
    num: 5,
  }),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());

Each result has position, title, url, domain, snippet and origin, and published_at when the page states a date. url is the address of the page itself. See search for every field.

3. Get the page text with the results

Add content to receive the cleaned text of the top pages in the same response, so the model does not need a second call to read them.

curl https://api.websearch.fast/v1/web/search \
  -H "Authorization: Bearer $WEBSEARCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "q": "postgres 18 release notes",
    "num": 5,
    "content": {"pages": 3, "max_chars_per_page": 4000}
  }'
import os
import httpx

response = httpx.post(
    "https://api.websearch.fast/v1/web/search",
    headers={"Authorization": f"Bearer {os.environ['WEBSEARCH_API_KEY']}"},
    json={
        "q": "postgres 18 release notes",
        "num": 5,
        "content": {"pages": 3, "max_chars_per_page": 4000},
    },
    timeout=60,
)
response.raise_for_status()
print(response.json())
const response = await fetch("https://api.websearch.fast/v1/web/search", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.WEBSEARCH_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    q: "postgres 18 release notes",
    num: 5,
    content: { pages: 3, max_chars_per_page: 4000 },
  }),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());

4. Read a page

curl https://api.websearch.fast/v1/web/fetch \
  -H "Authorization: Bearer $WEBSEARCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://docs.example.org/guide/install",
    "max_chars": 4000
  }'
import os
import httpx

response = httpx.post(
    "https://api.websearch.fast/v1/web/fetch",
    headers={"Authorization": f"Bearer {os.environ['WEBSEARCH_API_KEY']}"},
    json={
        "url": "https://docs.example.org/guide/install",
        "max_chars": 4000,
    },
    timeout=60,
)
response.raise_for_status()
print(response.json())
const response = await fetch("https://api.websearch.fast/v1/web/fetch", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.WEBSEARCH_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    url: "https://docs.example.org/guide/install",
    max_chars: 4000,
  }),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());

5. Handle errors

Errors have the same shape on every native path. Branch on the HTTP status first and on error.code second. The message is for people and can change. Quote request_id when you report a failure.

{
  "error": {
    "code": "fetch_failed",
    "message": "The page could not be read. (request id: 20261128120008123456789a1b2c3d4Kx7Qm2Ph)",
    "type": "invalid_request_error",
    "param": "url"
  },
  "request_id": "20261128120008123456789a1b2c3d4Kx7Qm2Ph"
}

Retry 429 after Retry-After, and 500, 503 and 504 with backoff and a cap. Do not retry other 4xx unchanged. The errors page lists every code.

Base URLs

HostBase URL
websearch.fasthttps://api.websearch.fast/v1/web
relay.fasthttps://relay.fast/v1/web
relay.fast reserve hosthttps://direct.relay-fast.com/v1/web

All hosts take the same relay.fast keys and serve the same paths. API paths never redirect, because a redirect can drop the Authorization header. A wrong path returns 404 invalid_endpoint.

For AI agents

What we do not promise