NeuralBridge
Sign in Download IDE
NeuralBridge

Web Crawl

site crawling

Site crawl by links: collects the text of several pages starting from a start page. Runs in the background — start a job, then check when it is ready.

Specifications

Context window
—
Max tokens in response
—
Vendor
NeuralBridge
Release
—
Login
text
Output
text

Description

What it is

Web Crawl walks through a site: it opens the start page, finds links on it, follows them and collects the main text of every page. This is handy when you need several pages of one section at once: help articles, pages of a small site, materials of a category.

A crawl takes time, so it works in two steps:

  1. You start a crawl and immediately get a job number — id.
  2. From time to time you ask whether the job is ready. When the crawl is finished, the response contains the collected pages.

If you need just one page, Web Scrape is simpler and faster.

What you need

  • An API key. Create it in your account dashboard. Send the key with every request in the Authorization: Bearer YOUR_API_KEY header, replacing YOUR_API_KEY with your key. Do not publish the key or share it with anyone: requests made with it are paid from your balance.
  • Money on your balance. Every request is paid; the price is shown on this page.
  • A program that sends HTTP requests. The command line (curl), Python with the requests library or any API testing tool will do. Ready-made examples are in the "Code examples" block below: copy one, put in your key and run it.

How a request is built

  • The method and address are in the "Endpoints" block on this page.
  • Headers: Authorization: Bearer YOUR_API_KEY and Content-Type: application/json.
  • The request body is JSON: "name": value pairs in curly braces, separated by commas. Text goes in double quotes; numbers and true / false go without quotes.

Step 1. Start a crawl

Method POST, the address ends with /v1/crawl. In the example PAGE_URL is the full start page address starting with https://.

{"seed_url": "PAGE_URL", "max_pages": 5}

Parameters:

  • seed_url — required. The address of the page the crawl starts from. The field can also be called url.
  • max_pages — how many pages to collect, including the start page. Default: 5. Currently one crawl can collect up to 10 pages: if you ask for more, the service collects 10.
  • max_depth — how far to follow links. Currently only 1 is supported: the start page and the pages it links to. To read only the start page, set "max_pages": 1.
  • same_domain — true (default): only pages of the same site as the start page. false: links to other sites may be followed too. The service treats an address with www. and without it as different sites, so start from the address the site itself opens with.

The response comes immediately:

{"object": "web_crawl", "id": "0c1f75e0-ff84-4873-98db-5debce57d5ba", "status": "queued"}

Save the id: you will use it to get the result.

Step 2. Check the status and get the pages

Method GET, the address ends with /v1/crawl/{id}: replace {id} with the job number from step 1. Use the same Authorization header; no request body is needed.

While the crawl is running, the response looks like this:

{"object": "web_crawl", "id": "0c1f75e0-…", "status": "running", "pages_done": 3, "error": null}

status values:

  • queued — the job is waiting in the queue, the crawl has not started yet;
  • running — the crawl is in progress; pages_done shows how many pages are already collected;
  • done — finished, the pages are in the pages field;
  • error — the crawl failed, the reason is in the error field.

When status is done:

{
  "object": "web_crawl",
  "id": "0c1f75e0-…",
  "status": "done",
  "pages_done": 2,
  "error": null,
  "pages": [
    {"url": "PAGE_URL", "title": "Start page title", "content": "Page text in Markdown…", "depth": 0},
    {"url": "https://…", "title": "Another page title", "content": "…", "depth": 1}
  ]
}
  • url and title — the page address and title;
  • content — the main page text in Markdown (the same as in Web Scrape);
  • depth — 0 for the start page, 1 for pages found through its links.

The response also has service fields; you can ignore them.

Tips

  • Check the status every 3–5 seconds, not more often. A small crawl usually finishes within half a minute to a minute.
  • If a job stays queued for a long time, other crawls are ahead of it in the queue. Wait a little.
  • Pages that fail to open are skipped and the crawl goes on, so you may get fewer pages than max_pages.
  • Start from a contents page (a section, a list of articles): then its links lead to the materials you need rather than random pages.
  • A crawl does not collect page tables and data. If you need them, read the page with Web Scrape using include_tables and include_data.

Limits

The same as for Web Scrape: pages must open without signing in; the service does not click buttons or scroll; files (PDF, images) are not parsed; some sites block automated programs.

Pricing

Every collected page is paid; the price is shown on this page. If no page could be collected, one page is charged.

If you get an error

The server replies with an HTTP status code. 200 means everything is fine; any other code means an error:

  • 401 — the key is missing or wrong. Check the header: the word Bearer, a space and the whole key.
  • 402 — not enough money on your balance. Top it up in your account dashboard.
  • 403 — this key is not allowed to use the tool. Check the key permissions in your dashboard.
  • 429 — too many requests per minute. Wait a little and try again.
  • 503 — the service is temporarily unavailable. Try again in a minute.
  • Other codes usually mean the request is malformed: a required field is missing or the JSON has a mistake (an extra or missing comma, single quotes instead of double). Compare your request with the example on this page.

Endpoints

POSThttps://api.neuralbridge.ru/v1/crawlprimary
Crawl — Crawl a site by links. Starts a job and returns its id.
GEThttps://api.neuralbridge.ru/v1/crawl/{job_id}
Crawl — job status — State and result of a previously started crawl.

Code examples

python
import time
import requests

BASE = "https://api.neuralbridge.ru"
HEADERS = {"Authorization": "Bearer YOUR_API_KEY"}

# Шаг 1: запустить обход. PAGE_URL — адрес стартовой страницы.
job = requests.post(f"{BASE}/v1/crawl", headers=HEADERS,
                    json={"seed_url": "PAGE_URL", "max_pages": 5}, timeout=30)
job.raise_for_status()
job_id = job.json()["id"]

# Шаг 2: спрашивать состояние раз в 5 секунд, пока обход не закончится.
while True:
    state = requests.get(f"{BASE}/v1/crawl/{job_id}", headers=HEADERS, timeout=30)
    state.raise_for_status()
    data = state.json()
    if data["status"] in ("done", "error"):
        break
    time.sleep(5)

if data["status"] == "error":
    print("Обход не удался:", data["error"])
else:
    for page in data["pages"]:
        print(page["url"], "—", page["title"])
        print(page["content"][:500])
        print()
For OpenAI SDK, specify /v1 in base_url. For Anthropic SDK — without /v1.
Prices
Rate to be confirmed
The request cost in rubles — in the response, field usage.cost
Identifier
neuralbridge/web-crawl-00527
Get API key