### Install and start self-hosted CRW Source: https://github.com/fastcrw/crw/blob/main/blog/browser-automation-ai-agents.md Install the CRW static binary on any Linux server and start it on http://localhost:3000. No API key required for the local API. ```bash curl -fsSL https://fastcrw.com/install | bash crw # starts on http://localhost:3000 ``` -------------------------------- ### Set up JS rendering with LightPanda Source: https://github.com/fastcrw/crw/blob/main/docs/docs/installation.md Automatically downloads LightPanda and creates config.local.toml, then starts LightPanda and crw. The setup command detects your platform (Linux x86_64, macOS aarch64) and downloads the appropriate binary to ~/.local/bin/lightpanda. ```bash # Automatic setup (downloads LightPanda + creates config.local.toml) crw-server setup # Start LightPanda lightpanda serve --host 127.0.0.1 --port 9222 --block-private-networks & # Start crw crw-server ``` -------------------------------- ### crawl() Source: https://github.com/fastcrw/crw/blob/main/docs/sdk-examples/index.html Starts an async crawl job, polls for completion, and returns all page results as a list. Available in Python and TypeScript SDKs, with a curl fallback for starting and polling the crawl. ```APIDOC ## crawl() ### Description Starts an async crawl job, polls for completion, and returns all page results as a list. ### Method POST ### Endpoint https://api.fastcrw.com/v1/crawl ### Parameters #### Request Body - **url** (string) - Required - The starting URL to crawl. - **maxDepth** (integer) - Optional - Maximum depth to crawl. - **maxPages** (integer) - Optional - Maximum number of pages to crawl. ### Response #### Success Response (200) - **id** (string) - The crawl job ID. - **status** (string) - Current status: `scraping`, `completed`, or `failed`. ### Request Example ``` # 1. Start the crawl CRAWL=$(curl -s -X POST https://api.fastcrw.com/v1/crawl \ -H "Authorization: Bearer $CRW_API_KEY" \ -H "Content-Type: application/json" \ -d '{"url":"https://example.com/docs","maxDepth":3,"maxPages":50}') ID=$(echo $CRAWL | jq -r '.id') # 2. Poll until status is "completed" or "failed" curl -s https://api.fastcrw.com/v1/crawl/$ID \ -H "Authorization: Bearer $CRW_API_KEY" | jq '.status' ``` ``` -------------------------------- ### Install CRW binary and run server Source: https://github.com/fastcrw/crw/blob/main/blog/crw-vs-crawl4ai.md Downloads the CRW install script, reviews it, then installs and runs CRW. The binary is statically linked with no runtime dependencies. Verify the installation with `crw --version` before starting the server with `crw serve`. ```bash # Linux / macOS — download and inspect first curl -fsSL https://fastcrw.com/install -o install.sh cat install.sh # review before running sh install.sh # Verify and run crw --version crw serve ``` -------------------------------- ### Start crw-browse with Lightpanda and separate Chrome for screenshots Source: https://github.com/fastcrw/crw/blob/main/docs/crw-browse/index.html Starts crw-browse with Lightpanda as the interactive browser (--ws-url) and a separate Chrome instance for screenshots (--chrome-ws-url). This setup provides fast interactive tools and working screenshots. ```bash # Lightpanda as interactive browser + separate Chrome for screenshots crw-browse \ --ws-url ws://lightpanda:9222 \ --chrome-ws-url ws://chrome:9223 ``` -------------------------------- ### Colly Quickstart: Install and Crawl with Callback Source: https://github.com/fastcrw/crw/blob/main/blog/best-open-source-web-scraping-libraries.md Install Colly v2 and run a Go collector that prints the text of each h1 element on a page. Requires Go and a main package. ```bash go get github.com/gocolly/colly/v2 ``` ```go package main "fmt" "github.com/gocolly/colly/v2" ) func main() { c := colly.NewCollector() c.OnHTML("h1", func(e *colly.HTMLElement) { fmt.Println(e.Text) }) c.Visit("https://example.com") } ``` -------------------------------- ### Install and Start CRW Binary Source: https://github.com/fastcrw/crw/blob/main/blog/web-search-api-for-ai-agents.md Installs the CRW binary via the install script and starts the server. CRW is a small static Rust binary with a tiny footprint, suitable for low-resource environments like a Raspberry Pi. ```bash # macOS / Linux curl -fsSL https://fastcrw.com/install | bash # Start the server crw ``` -------------------------------- ### Install with Cloud API key Source: https://github.com/fastcrw/crw/blob/main/README.md Installs the binary, connects the provided Cloud API key, and registers the MCP server with existing AI coding tools. The key is stored in ~/.config/crw/config.toml. Add CRW_NO_AGENTS=1 to skip agent setup, or run 'crw setup' to choose interactively. ```bash curl -fsSL https://fastcrw.com/install | CRW_API_KEY=crw_live_... sh ``` -------------------------------- ### Crawl4AI Quickstart: Install and Async Crawl Source: https://github.com/fastcrw/crw/blob/main/blog/best-open-source-web-scraping-libraries.md Install Crawl4AI and its Chromium dependency, then run an async crawl that prints the page's markdown. Requires Python and asyncio. ```bash pip install crawl4ai playwright install chromium ``` ```python from crawl4ai import AsyncWebCrawler async def main(): async with AsyncWebCrawler() as crawler: result = await crawler.arun("https://example.com") print(result.markdown) asyncio.run(main()) ``` -------------------------------- ### Puppeteer Quickstart (Node) Source: https://github.com/fastcrw/crw/blob/main/blog/best-open-source-web-scraping-libraries.md Install puppeteer, then launch a browser, navigate to example.com, and log the page content. Requires Node.js and the puppeteer package. ```bash npm install puppeteer ``` ```javascript const browser = await puppeteer.launch(); const page = await browser.newPage(); await page.goto("https://example.com"); console.log(await page.content()); await browser.close(); ``` -------------------------------- ### Install and Set Up CRW with LightPanda Source: https://github.com/fastcrw/crw/blob/main/blog/bypass-cloudflare-scraping.md Complete setup for stealth scraping: install CRW, set up JS rendering (downloads LightPanda), start LightPanda in the background, then start CRW. Stealth injection is enabled by default whenever CRW uses the browser renderer. ```bash # Install CRW cargo install crw-server # Set up JS rendering (downloads LightPanda) crw-server setup # Start LightPanda in the background lightpanda serve --host 127.0.0.1 --port 9222 --block-private-networks & # Start CRW crw-server ``` -------------------------------- ### Install crw-browse from crates.io Source: https://github.com/fastcrw/crw/blob/main/docs/crw-browse/index.html Installs crw-browse from crates.io using cargo install. Prebuilt binaries are also available from the v0.4.0 GitHub release and later. ```bash # From crates.io cargo install crw-browse ``` -------------------------------- ### Manually add APT repository and install crw Source: https://github.com/fastcrw/crw/blob/main/docs/docs/installation.md Adds the CRW APT repository by hand using the GPG key and sources list, then installs crw. Use if you prefer manual setup over the setup script. ```bash curl -fsSL https://apt.fastcrw.com/gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/crw.gpg echo "deb [signed-by=/usr/share/keyrings/crw.gpg] https://apt.fastcrw.com stable main" \ | sudo tee /etc/apt/sources.list.d/crw.list sudo apt update && sudo apt install crw ``` -------------------------------- ### Start server and enable JS rendering Source: https://github.com/fastcrw/crw/blob/main/crates/crw-server/README.md Start the server with `crw-server` and enable JS rendering by downloading LightPanda with `crw-server setup`. ```bash # Start the server crw-server # Enable JS rendering (downloads LightPanda) crw-server setup ``` -------------------------------- ### Selenium Quickstart (Python) Source: https://github.com/fastcrw/crw/blob/main/blog/best-open-source-web-scraping-libraries.md Install selenium and webdriver-manager, then launch a Chrome driver, navigate to example.com, and print the page source. Requires Chrome and the webdriver-manager package. ```bash pip install selenium webdriver-manager ``` ```python from selenium import webdriver from selenium.webdriver.chrome.service import Service from webdriver_manager.chrome import ChromeDriverManager driver = webdriver.Chrome(service=Service(ChromeDriverManager().install())) driver.get("https://example.com") print(driver.page_source) driver.quit() ``` -------------------------------- ### Verify installation with health check Source: https://github.com/fastcrw/crw/blob/main/docs/docs/installation.md Starts the server and checks the health endpoint. The server starts on http://localhost:3000. ```bash crw-server # Server starts on http://localhost:3000 curl http://localhost:3000/health ``` -------------------------------- ### Playwright Quickstart (Python) Source: https://github.com/fastcrw/crw/blob/main/blog/best-open-source-web-scraping-libraries.md Install Playwright and its Chromium browser, then launch a browser, navigate to example.com, and print the page content. Requires the playwright package and a Chromium binary. ```bash pip install playwright playwright install chromium ``` ```python from playwright.sync_api import sync_playwright with sync_playwright() as p: browser = p.chromium.launch() page = browser.new_page() page.goto("https://example.com") print(page.content()) browser.close() ``` -------------------------------- ### Install crw via APT setup script Source: https://github.com/fastcrw/crw/blob/main/docs/docs/installation.md Adds the signing key and CRW repository, then installs crw. Upgrades arrive with the rest of the system through apt upgrade. ```bash curl -fsSL https://apt.fastcrw.com/setup.sh | sudo sh ``` -------------------------------- ### Start a crawl with curl POST to /v1/crawl Source: https://github.com/fastcrw/crw/blob/main/docs/agent-onboarding/index.html Sends a POST request to start an asynchronous crawl. Returns a job ID immediately. Requires an API key in the Authorization header. ```bash curl -X POST https://api.fastcrw.com/v1/crawl \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{"url": "https://example.com", "maxPages": 50, "formats": ["markdown"]}' ``` -------------------------------- ### BeautifulSoup Quickstart (Python) Source: https://github.com/fastcrw/crw/blob/main/blog/best-open-source-web-scraping-libraries.md Install beautifulsoup4 and requests, then parse a page's HTML and print the text of the first h1 tag. Requires an internet connection to fetch example.com. ```bash pip install beautifulsoup4 requests ``` ```python from bs4 import BeautifulSoup html = requests.get("https://example.com").text soup = BeautifulSoup(html, "html.parser") print(soup.h1.text) ``` -------------------------------- ### Scrapy quickstart commands Source: https://github.com/fastcrw/crw/blob/main/blog/best-open-source-web-scraping-libraries.md Installs Scrapy, creates a new project, generates a spider for example.com, and runs the crawl. Requires Python and pip; the commands are executed in sequence from the project directory. ```bash pip install scrapy ``` ```bash scrapy startproject myproject ``` ```bash cd myproject ``` ```bash scrapy genspider example example.com ``` ```bash scrapy crawl example ``` -------------------------------- ### Install to custom directory with CRW_INSTALL_DIR Source: https://github.com/fastcrw/crw/blob/main/docs/docs/installation.md Installs the binary to a custom directory by setting the CRW_INSTALL_DIR environment variable. Example installs to ~/.local/bin. ```bash # Install to a custom directory: curl -fsSL https://fastcrw.com/install | CRW_INSTALL_DIR=~/.local/bin sh ``` -------------------------------- ### Response from POST /v1/crawl Source: https://github.com/fastcrw/crw/blob/main/docs/agent-onboarding/index.html Example JSON response containing a success flag and the crawl job ID. ```json { "success": true, "id": "3f2a1b4c-8e9d-4f7a-b6c5-2d1e0f9a8b7c" } ``` -------------------------------- ### Start Lightpanda CDP server Source: https://github.com/fastcrw/crw/blob/main/docs/crw-browse/index.html Starts the Lightpanda server on 127.0.0.1:9222 with private network blocking. Lightpanda is faster and lighter than Chrome but does not support screenshots. ```bash # Lightpanda (faster and lighter — no screenshots) lightpanda serve --host 127.0.0.1 --port 9222 --block-private-networks ``` -------------------------------- ### Setup Python environment and verify scorer Source: https://github.com/fastcrw/crw/blob/main/bench/README.md Creates a virtual environment, installs pinned dependencies, runs a self-check of the scorer with zero setup, and executes the offline test suite before any locked run. ```bash # Python env (no repo-wide pyproject; bench pins its own deps) uv venv bench/.venv uv pip install --python bench/.venv/bin/python -r bench/requirements.txt # Prove the scorer works with ZERO setup (no server/LLM/network): uv run python bench/map_recall.py --selfcheck # → product recall ~0.71 # Run the whole OFFLINE test suite before any locked run: bash bench/verify.sh ``` -------------------------------- ### POST /v1/map Source: https://github.com/fastcrw/crw/blob/main/docs/agent-onboarding/index.html Discovers URLs from a given starting URL. Returns a list of discovered URLs up to the specified limit. ```APIDOC ## [POST] /v1/map ### Description Discovers URLs from a given starting URL. Returns a list of discovered URLs up to the specified limit. ### Method POST ### Endpoint /v1/map ### Parameters #### Request Body - **url** (string) - Required - The starting URL. - **limit** (number) - Optional - Maximum number of URLs to discover, e.g., 50. ### Response #### Success Response (200) - **success** (boolean) - Indicates success. - **data** (array) - List of discovered URLs. ### Request Example ``` POST /v1/map {"url":"...","limit":50} ``` ``` -------------------------------- ### Map Source: https://github.com/fastcrw/crw/blob/main/docs/sdk-examples/index.html Discovers all URLs on a site without downloading page content. Supports depth control and sitemap usage. ```APIDOC ## Map ### Description Discovers all URLs on a site without downloading page content. Supports depth control and sitemap usage. ### Method POST ### Endpoint https://api.fastcrw.com/v1/map ### Parameters #### Request Body - **url** (string) - Required - The URL of the site to map. - **maxDepth** (integer) - Optional - Maximum depth to crawl. - **useSitemap** (boolean) - Optional - Whether to use the site's sitemap. ### Response #### Success Response (200) - **urls** (array) - List of discovered URLs. - **sitemaps** (array) - List of sitemaps used. ### Request Example ``` curl -X POST https://api.fastcrw.com/v1/map \ -H "Authorization: Bearer $CRW_API_KEY" \ -H "Content-Type: application/json" \ -d '{"url":"https://example.com","maxDepth":2,"useSitemap":true}' ``` ### Response Example (No response example provided in source) ``` -------------------------------- ### Start Chrome/Chromium with CDP on Linux Source: https://github.com/fastcrw/crw/blob/main/docs/crw-browse/index.html Launches Chrome/Chromium on Linux with remote debugging on port 9222, headless mode, and a temporary user data directory. Required before starting crw-browse because crw-browse does not launch a browser itself. ```bash # Chrome/Chromium — Linux google-chrome \ --remote-debugging-port=9222 \ --headless=new \ --user-data-dir=/tmp/crw-chrome ``` -------------------------------- ### POST /v1/crawl Source: https://github.com/fastcrw/crw/blob/main/docs/agent-onboarding/index.html Starts an asynchronous multi-page crawl of a website. Returns a crawl ID that can be polled for status and results. ```APIDOC ## [POST] /v1/crawl ### Description Starts an asynchronous multi-page crawl of a website. Returns a crawl ID that can be polled for status and results. ### Method POST ### Endpoint /v1/crawl ### Parameters #### Request Body - **url** (string) - Required - The starting URL. - **maxPages** (number) - Optional - Maximum number of pages to crawl, e.g., 5. ### Response #### Success Response (200) - **success** (boolean) - Indicates success. - **id** (string) - Crawl ID for polling. ### Request Example ``` POST /v1/crawl {"url":"...","maxPages":5} ``` ``` -------------------------------- ### POST /v1/crawl Source: https://github.com/fastcrw/crw/blob/main/docs/docs/agent-onboarding.md Start an async recursive crawl job. This endpoint initiates a crawl of a website, following links recursively. ```APIDOC ## POST /v1/crawl ### Description Start an async recursive crawl job. ### Method POST ### Endpoint /v1/crawl ``` -------------------------------- ### crawl() Source: https://github.com/fastcrw/crw/blob/main/docs/docs/sdk-examples.md Starts an async crawl job, polls for completion, and returns all page results as a list. Available in Python, TypeScript, and via curl. ```APIDOC ## crawl() ### Description Starts an async crawl job, polls for completion, and returns all page results as a list. ### Method POST ### Endpoint `/v1/crawl` ### Parameters #### Request Body - `url` (string) - Required - The starting URL to crawl. - `maxDepth` (integer) - Optional - Maximum depth to crawl. - `maxPages` (integer) - Optional - Maximum number of pages to crawl. ### Response #### Success Response (200) - `id` (string) - The crawl job ID. - `status` (string) - Status of the crawl: `scraping`, `completed`, or `failed`. ### Request Example ```bash curl -X POST https://api.fastcrw.com/v1/crawl \ -H "Authorization: Bearer $CRW_API_KEY" \ -H "Content-Type: application/json" \ -d '{"url":"https://example.com/docs","maxDepth":3,"maxPages":50}' ``` ### Response Example ```json { "id": "...", "status": "scraping" } ``` ### Polling Endpoint #### Method GET #### Endpoint `/v1/crawl/{id}` #### Path Parameters - `id` (string) - Required - The crawl job ID. #### Response #### Success Response (200) - `status` (string) - Status of the crawl: `scraping`, `completed`, or `failed`. #### Request Example ```bash curl -s https://api.fastcrw.com/v1/crawl/$ID \ -H "Authorization: Bearer $CRW_API_KEY" | jq '.status' ``` #### Response Example ```json { "status": "completed" } ``` ``` -------------------------------- ### POST /v1/crawl Source: https://github.com/fastcrw/crw/blob/main/docs/agent-onboarding/index.html Starts an asynchronous crawl of a given URL. Returns a job ID immediately, which you can use to poll for results. ```APIDOC ## POST /v1/crawl ### Description Starts an asynchronous crawl of a given URL. Returns a job ID immediately, which you can use to poll for results. ### Method POST ### Endpoint /v1/crawl ### Parameters #### Request Body - `url` (string) - Required - The URL to crawl. - `maxPages` (number) - Optional - Maximum number of pages to crawl. - `formats` (array of strings) - Optional - Desired output formats (e.g., "markdown"). ### Response #### Success Response (200) - `success` (boolean) - Indicates if the request was successful. - `id` (string) - The crawl job ID. ### Request Example ``` curl -X POST https://api.fastcrw.com/v1/crawl \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{"url": "https://example.com", "maxPages": 50, "formats": ["markdown"]}' ``` #### Response Example ``` { "success": true, "id": "3f2a1b4c-8e9d-4f7a-b6c5-2d1e0f9a8b7c" } ``` ``` -------------------------------- ### Structured Extraction Source: https://github.com/fastcrw/crw/blob/main/docs/sdk-examples/index.html Pass a JSON schema to scrape and return structured JSON in one call. Requires an LLM provider configured on the engine. ```APIDOC ## Structured Extraction ### Description Pass a JSON schema to scrape and return structured JSON in one call. Requires an LLM provider configured on the engine. ### Method POST ### Endpoint (No explicit endpoint provided in source) ### Parameters #### Request Body - **url** (string) - Required - The URL to scrape. - **json_schema** (object) - Required - JSON schema for structured output. ### Response #### Success Response (200) - **json** (object) - The structured JSON result. ### Request Example ``` (No request example provided in source) ``` ### Response Example (No response example provided in source) ``` -------------------------------- ### LightPanda setup commands Source: https://github.com/fastcrw/crw/blob/main/docs/docs/js-rendering.md Commands to install and start the LightPanda server for CDP-based JS rendering. Auto-install via `crw-server setup` or manually start `lightpanda serve` on 127.0.0.1:9222 with private networks blocked. ```bash # Auto-install crw-server setup # Manual start lightpanda serve --host 127.0.0.1 --port 9222 --block-private-networks & ``` -------------------------------- ### Start Chrome/Chromium with CDP on macOS Source: https://github.com/fastcrw/crw/blob/main/docs/crw-browse/index.html Launches Chrome/Chromium on macOS with remote debugging on port 9222, headless mode, and a temporary user data directory. Required before starting crw-browse because crw-browse does not launch a browser itself. ```bash # Chrome/Chromium — macOS /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \ --remote-debugging-port=9222 \ --headless=new \ --user-data-dir=/tmp/crw-chrome ``` -------------------------------- ### Run live tracks with server Source: https://github.com/fastcrw/crw/blob/main/bench/README.md Starts the CRW server on port 3000 and runs the map recall benchmark against it, honoring CRW_API_URL. ```bash cargo run -p crw-cli -- serve # port 3000 (CRW_PORT/--port) CRW_API_URL=http://localhost:3000 uv run python bench/map_recall.py ``` -------------------------------- ### curl: Start and poll a crawl job Source: https://github.com/fastcrw/crw/blob/main/docs/docs/sdk-examples.md Starts a crawl via POST to /v1/crawl, extracts the job ID with jq, then polls GET /v1/crawl/$ID until status is 'completed' or 'failed'. Requires CRW_API_KEY and jq. ```bash # 1. Start the crawl CRAWL=$(curl -s -X POST https://api.fastcrw.com/v1/crawl \ -H "Authorization: Bearer $CRW_API_KEY" \ -H "Content-Type: application/json" \ -d '{"url":"https://example.com/docs","maxDepth":3,"maxPages":50}') ID=$(echo $CRAWL | jq -r '.id') # 2. Poll until status is "completed" or "failed" curl -s https://api.fastcrw.com/v1/crawl/$ID \ -H "Authorization: Bearer $CRW_API_KEY" | jq '.status' ``` -------------------------------- ### GET /v1/crawl/:id Source: https://github.com/fastcrw/crw/blob/main/docs/docs/agent-onboarding.md Poll status of a crawl job. Use this endpoint to check the progress and results of a previously started crawl. ```APIDOC ## GET /v1/crawl/:id ### Description Poll status of a crawl job. ### Method GET ### Endpoint /v1/crawl/:id ``` -------------------------------- ### GET /v1/crawl/:id Source: https://github.com/fastcrw/crw/blob/main/docs/agent-onboarding/index.html Poll the status of a crawl job. Use this endpoint to check the progress and results of a previously started crawl job. ```APIDOC ## [GET] /v1/crawl/:id ### Description Poll status of a crawl job. ### Method GET ### Endpoint /v1/crawl/:id ``` -------------------------------- ### CLI: scrape and search commands Source: https://github.com/fastcrw/crw/blob/main/README.md Use `crw ` to scrape a page immediately after installation. Use `crw search "query"` after running `crw setup` to enable search. ```bash crw https://example.com # scrape, works right after install crw search "rust async runtime" # search, after `crw setup` ``` -------------------------------- ### Quickest self-hosted setup — boot the bundled search sidecar Source: https://github.com/fastcrw/crw/blob/main/docs/docs/troubleshooting.md Run `crw setup --local` to boot the bundled search sidecar, the quickest self-hosted fix for `search_disabled`. ```bash crw setup --local ``` -------------------------------- ### Crawl4AI Docker and pip Setup Source: https://github.com/fastcrw/crw/blob/main/blog/best-open-source-web-crawlers.md Two setup options for Crawl4AI: run the Docker image on port 11235, or install via pip and install the Chromium browser for Playwright. ```bash # Docker docker run -p 11235:11235 unclecode/crawl4ai:latest # Or pip pip install crawl4ai playwright install chromium ``` -------------------------------- ### Start CRW with configuration Source: https://github.com/fastcrw/crw/blob/main/blog/crw-on-5-dollar-vps.md Starts the CRW server using the configuration file at /etc/crw/config.local.toml via the CRW_CONFIG environment variable. ```bash CRW_CONFIG=/etc/crw/config.local.toml crw-server ``` -------------------------------- ### Search Endpoint - Find Pages Source: https://github.com/fastcrw/crw/blob/main/docs/agent-onboarding/index.html POST to /v1/search to search the web and return results with content. Use a query and limit. ```bash curl -X POST https://api.fastcrw.com/v1/search \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{"query": "your search query", "limit": 5}' ``` -------------------------------- ### Start CRW self-hosted (Option A) Source: https://github.com/fastcrw/crw/blob/main/blog/langchain-crw-rag-tutorial.md Install and start CRW locally, either via the install script or Docker, then set the CRW_API_URL environment variable to point the loader at it. ```bash # Install and start CRW curl -fsSL https://fastcrw.com/install | bash crw serve # runs on http://localhost:3000 # Or Docker docker run -p 3000:3000 ghcr.io/fastcrw/crw:latest # Point the loader at it export CRW_API_URL=http://localhost:3000 ``` -------------------------------- ### crw doctor command examples Source: https://github.com/fastcrw/crw/blob/main/docs/crates/index.html Run read-only diagnostics. Bare `crw doctor` auto-resolves the backend from config.toml; `--target` forces a backend, `--json` gives machine-readable output. Never installs, starts, repairs, or rewrites anything. ```bash crw doctor # diagnose whatever config.toml resolves to crw doctor --target cloud # force the cloud-API checks crw doctor --json # machine-readable output ``` -------------------------------- ### Verify crw-browse installation with initialize request Source: https://github.com/fastcrw/crw/blob/main/docs/crw-browse/index.html Sends a JSON-RPC initialize request to crw-browse via stdin, discarding stderr. Expected output is a JSON-RPC response with protocolVersion 2024-11-05, empty tools capabilities, serverInfo name 'crw-browse', and instructions for using the goto and tree tools. ```bash echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"clientInfo":{"name":"test"},"protocolVersion":"2024-11-05"}}' \ | crw-browse 2>/dev/null ``` ```json { "jsonrpc": "2.0", "id": 1, "result": { "protocolVersion": "2024-11-05", "capabilities": {"tools": {}}, "serverInfo": {"name": "crw-browse", "version": ""}, "instructions": "Interactive browser automation over CDP. Call `goto` to navigate, then `tree` to inspect the rendered accessibility tree." } } ``` -------------------------------- ### cURL crawl example Source: https://github.com/fastcrw/crw/blob/main/docs/crawling/index.html cURL command to start a crawl job with the same parameters as the Python and Node.js examples. ```bash curl -X POST https://api.fastcrw.com/v1/crawl \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://docs.example.com", "maxDepth": 1, "maxPages": 5, "formats": ["markdown"] }' ``` -------------------------------- ### Rate Limit and Error Handling Guide Source: https://github.com/fastcrw/crw/blob/main/docs/rate-limits/index.html This documentation describes the rate limits and error handling for the cloud API, including concurrency limits, 429 and 402 error responses, and recommended retry strategies. It provides guidance on how to handle rate limiting and credit exhaustion scenarios. ```APIDOC ## Rate Limits and Error Handling ### Description This section explains the concurrency limits for different plans and how to handle 429 (rate limit) and 402 (payment required) responses from the cloud API. It includes guidance on retry strategies and credit exhaustion handling. ### Concurrency Limits | Plan | Concurrent requests | | --- | --- | | FREE | 3 | | HOBBY | 10 | | STANDARD | 50 | | GROWTH | 100 | | SCALE | 150 | A batch request (for example a batch scrape) counts as one POST for this limit: it does not itself grant extra parallelism beyond what the plan allows for other in-flight requests. ### Error Responses | Status | `errorCode` | Cause | Retry? | | --- | --- | --- | --- | | `429` | none | Request-rate guard exceeded | Yes, after `Retry-After` | | `429` | none | Concurrency cap reached | Yes, once an in-flight request completes | | `402` | `insufficient_credits` | Credit balance cannot cover the request | No | | `402` | `llm_not_available` | Managed-LLM feature requested on the FREE plan | No | ### Cause 1: Request-rate guard exceeded You exceeded the Cloud request-rate guard. The response includes `Retry-After`, `X-RateLimit-Limit`, and `X-RateLimit-Remaining` headers. Treat those response headers as the authority for that request; do not hard-code an internal threshold. **Action:** back off and retry. Apply exponential backoff starting at 1 second: ``` async function callWithRetry(fn: () => Promise, maxRetries = 5): Promise { for (let attempt = 0; attempt < maxRetries; attempt++) { const res = await fn(); if (res.status === 402) { // Out of credits or a plan gate: no retry can succeed. Halt. const { errorCode, error } = await res.json(); throw new Error(`${errorCode}: ${error}`); } if (res.status !== 429) return res; // Legacy /v2 surface only: an exhausted balance there is still a 429, // recognisable by the X-FASTCRW-Credits-Available header. Do not retry it. if (res.headers.has("X-FASTCRW-Credits-Available")) { throw new Error("Credit balance exhausted, top up at fastcrw.com/billing"); } const retryAfter = Number(res.headers.get("Retry-After")); const backoffMs = retryAfter > 0 ? retryAfter * 1000 : Math.min(1000 * 2 ** attempt, 30_000); await new Promise(r => setTimeout(r, backoffMs)); } throw new Error("Max retries exceeded"); } ``` ### Cause 2: Concurrency cap reached You already have as many requests in flight as your plan allows. The response includes a `Retry-After` header and an `X-Concurrency-Limit` header naming your plan's cap. **Action:** retry once an in-flight request completes, or reduce your worker pool's parallelism to stay under the cap. This is not a request-rate problem, so simply slowing down your request rate without also lowering concurrency will not fix it. ### `402` with `insufficient_credits`: credits exhausted Once your available balance cannot cover a request, the API returns `402` with `errorCode: "insufficient_credits"`. This covers a FREE account that has spent its lifetime 500 credits (plus up to 500 more from onboarding tasks), and a paid account that is out of included and top-up credits. The response includes `X-FASTCRW-Credits-Available`, `X-FASTCRW-Included-Remaining`, `X-FASTCRW-Purchased-Remaining`, and `X-FASTCRW-Upgrade-Url` headers. When an enabled auto-recharge could not run (card declined, bank confirmation required, no payment method on file), the same `402` also carries `X-FASTCRW-Stop-Reason` naming why. There is no `Retry-After` and no reset header: a refill depends on a payment, not on the clock, and a FREE account's credits are a one-time lifetime grant. **Action:** do NOT retry. Retrying burns no credits (the request is rejected before processing) but creates noise in your logs and may hide the real cause. Alert or pause your pipeline, then top up, upgrade, or fix the payment method named in `X-FASTCRW-Stop-Reason`. On the legacy `/v2` surface (root `/v2`, `/firecrawl/v2`, `compat.fastcrw.com`) the same condition still answers `429` without an `errorCode`, with the same `X-FASTCRW-*` headers; an auto-recharge stop there is a `402`. ``` if (res.status === 402) { const body = await res.json(); if (body.errorCode === "insufficient_credits") { // Alert your team, halt the pipeline. throw new Error(`Out of credits: ${body.error}`); } throw new Error(`${body.errorCode}: ${body.error}`); } // Otherwise a 429 is request-rate or concurrency: backoff and retry (see above). ``` ``` -------------------------------- ### Scrape with JS rendering (Python) Source: https://github.com/fastcrw/crw/blob/main/docs/sdk-examples/index.html Scrapes with JavaScript rendering enabled, waiting 1500 ms for the page to render. Returns markdown and HTML formats. ```python result = client.scrape( "https://example.com", formats=["markdown", "html"], render_js=True, wait_for=1500, # ms ) ``` -------------------------------- ### MCP: install CRW skill and server Source: https://github.com/fastcrw/crw/blob/main/README.md Run `npx -y crw-mcp@latest install` to install the CRW skill and MCP server in detected AI tools. `crw setup` can also perform this step. ```bash npx -y crw-mcp@latest install ``` -------------------------------- ### Login flow using individual tool calls Source: https://github.com/fastcrw/crw/blob/main/docs/crw-browse/index.html Step-by-step agent flow for navigating to a login page, filling credentials, clicking submit, waiting for the dashboard, and reading content. Each step uses a separate tools/call request with the tool name in the 'name' field. The tree snapshot returns an accessibility tree with input refs. ```json // 1. Navigate to login page {"method": "tools/call", "params": {"name": "goto", "arguments": {"url": "https://example.com/login"}}} // → {"ok": true, "session": "a3f1", "url": "https://example.com/login", "data": {"status": 200}} // 2. Snapshot accessibility tree to find input refs {"method": "tools/call", "params": {"name": "tree", "arguments": {"max_nodes": 50}}} // → data.tree = "[1] WebArea: Login\n [2] textbox: Email\n [3] textbox: Password\n [4] button: Sign in\n..." // 3. Fill the email field by CSS selector {"method": "tools/call", "params": {"name": "fill", "arguments": {"selector": "input[type=email]", "value": "user@example.com"}}} // 4. Fill the password field {"method": "tools/call", "params": {"name": "fill", "arguments": {"selector": "input[type=password]", "value": "secret"}}} // 5. Click Sign in {"method": "tools/call", "params": {"name": "click", "arguments": {"selector": "button[type=submit]"}}} // 6. Wait for the dashboard to appear {"method": "tools/call", "params": {"name": "wait", "arguments": {"selector": "#dashboard", "condition": "visible"}}} // 7. Read the authenticated content {"method": "tools/call", "params": {"name": "text", "arguments": {}}} ``` -------------------------------- ### POST /v1/crawl - Start response Source: https://github.com/fastcrw/crw/blob/main/docs/llms-full.txt Response from starting a crawl job. Contains a unique id for polling with GET /v1/crawl/{id}. ```json {"success": true, "id": "550e8400-e29b-41d4-a716-446655440000"} ``` -------------------------------- ### Install Python dependencies for CRW stock monitor Source: https://github.com/fastcrw/crw/blob/main/blog/ecommerce-stock-monitoring-crw.md Install the required Python packages for the CRW stock monitoring example. Uses pip to install firecrawl-py and requests. ```bash pip install firecrawl-py requests ``` -------------------------------- ### One-line install with wget Source: https://github.com/fastcrw/crw/blob/main/docs/docs/installation.md Alternative to the curl install script using wget. Same functionality: downloads and installs the latest binary. ```bash wget -qO- https://fastcrw.com/install | sh ``` -------------------------------- ### Python: crawl() with max_depth and max_pages Source: https://github.com/fastcrw/crw/blob/main/docs/docs/sdk-examples.md Starts an async crawl job, polls until completion, and returns all page results as a list. Prints each page's URL and the first 80 characters of its markdown content. ```python pages = client.crawl( "https://example.com/docs", max_depth=3, max_pages=50, ) for page in pages: print(page.get("url"), page.get("markdown", "")[:80]) ``` -------------------------------- ### Build crw-browse from workspace Source: https://github.com/fastcrw/crw/blob/main/docs/docs/crw-browse.md Build the crw-browse binary from the workspace. Output at target/release/crw-browse. ```bash cargo build -p crw-browse --release # Binary: target/release/crw-browse ``` -------------------------------- ### Install and run Langflow locally Source: https://github.com/fastcrw/crw/blob/main/blog/langflow-rag-crw.md Install Langflow via pip and start it with the `langflow run` command. This is the self-hosted option for Langflow. ```bash pip install langflow && langflow run ``` -------------------------------- ### POST /v1/crawl Source: https://github.com/fastcrw/crw/blob/main/docs/agent-onboarding/index.html Start an asynchronous recursive crawl job. This endpoint initiates a crawl of a website, following links recursively to discover and extract content. ```APIDOC ## [POST] /v1/crawl ### Description Start an async recursive crawl job. ### Method POST ### Endpoint /v1/crawl ``` -------------------------------- ### fill Source: https://github.com/fastcrw/crw/blob/main/docs/crw-browse/index.html Set an input's value and dispatch `input` + `change` events. Pass `selector` or `ref`. ```APIDOC ## fill ### Description Set an input's value and dispatch `input` + `change` events. Pass `selector` or `ref`. ### Parameters - **selector** (string) - Optional - CSS selector of the input element - **ref** (string) - Optional - `@e` ref token from `tree` - **value** (string) - Required - The value to set ``` -------------------------------- ### Start crw-browse with default CDP endpoint Source: https://github.com/fastcrw/crw/blob/main/docs/crw-browse/index.html Starts crw-browse using the default CDP WebSocket endpoint ws://localhost:9222. This is the simplest way to run crw-browse after starting a browser. ```bash # Default: CDP at ws://localhost:9222 crw-browse ``` -------------------------------- ### Crawl an entire site (start + poll) Source: https://github.com/fastcrw/crw/blob/main/docs/choose-endpoint/index.html Start a crawl with POST to /v1/crawl, then poll the returned job ID with GET /v1/crawl/{id} until completion. ```bash # Start curl -X POST https://api.fastcrw.com/v1/crawl \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"url":"https://example.com"}' # Poll with the returned job ID curl https://api.fastcrw.com/v1/crawl/{id} \ -H "Authorization: Bearer YOUR_API_KEY" ``` -------------------------------- ### Scrape with JS rendering (TypeScript) Source: https://github.com/fastcrw/crw/blob/main/docs/sdk-examples/index.html Scrapes with JavaScript rendering enabled, waiting 1500 ms for the page to render. Returns markdown and HTML formats. ```typescript const result = await client.scrape("https://example.com", { formats: ["markdown", "html"], renderJs: true, waitFor: 1500, }); ``` -------------------------------- ### Python SDK: set API key and install Source: https://github.com/fastcrw/crw/blob/main/README.md For Cloud usage, obtain an API key and export it as `CRW_API_KEY` before installing the `crw` package. ```bash export CRW_API_KEY="crw_live_..." pip install crw ``` -------------------------------- ### REST: Start, poll, and cancel crawl Source: https://github.com/fastcrw/crw/blob/main/skills/crw-crawl/SKILL.md Async REST API. POST to start, GET to poll, DELETE to cancel. Uses $CRW_API_URL and $CRW_API_KEY environment variables. ```bash # Start curl -X POST "$CRW_API_URL/v1/crawl" -H "Authorization: Bearer $CRW_API_KEY" \ -H 'Content-Type: application/json' \ -d '{"url":"https://docs.example.com","maxDepth":2,"maxPages":50}' # → {"id":"a1b2c3d4-..."} # Poll curl "$CRW_API_URL/v1/crawl/a1b2c3d4-..." \ -H "Authorization: Bearer $CRW_API_KEY" # → {"status":"completed","data":[...]} # Cancel curl -X DELETE "$CRW_API_URL/v1/crawl/a1b2c3d4-..." \ -H "Authorization: Bearer $CRW_API_KEY" ``` -------------------------------- ### Install and configure prerequisites Source: https://github.com/fastcrw/crw/blob/main/docs/docs/recipe-product-catalog.md Install the crw package and set the API key. Requires an LLM provider configured on the engine or pass llmApiKey per request; the managed cloud has one preconfigured. ```bash pip install crw export CRW_API_KEY="crw-..." # Also requires an LLM provider configured on the engine (or pass llmApiKey per request). # The managed cloud (api.fastcrw.com) has one preconfigured. ``` -------------------------------- ### Trace agent run with Agents SDK tracing Source: https://github.com/fastcrw/crw/blob/main/blog/openai-agents-sdk-crw.md Uses the built-in tracing feature to debug agent behavior. The trace context 'research-session' wraps a Runner.run call that scrapes a URL and summarizes a getting started guide. The trace output shows each tool call, token usage per step, handoff decisions, and total execution time. ```python from agents import Runner, trace with trace("research-session"): result = await Runner.run( web_agent, "Scrape https://docs.example.com and summarize the getting started guide", ) # Traces show: # - Each tool call (which URLs were scraped) # - Token usage per step # - Handoff decisions # - Total execution time ``` -------------------------------- ### POST /v1/search Source: https://github.com/fastcrw/crw/blob/main/docs/agent-onboarding/index.html Performs a web search and returns top results with titles, URLs, and snippets. Accepts a query and optional parameters like limit, language, time range, and sources. ```APIDOC ## [POST] /v1/search ### Description Performs a web search and returns top results with titles, URLs, and snippets. Accepts a query and optional parameters like limit, language, time range, and sources. ### Method POST ### Endpoint /v1/search ### Parameters #### Request Body - **query** (string) - Required - The search query. - **limit** (number) - Optional - Default 5, max 20. Number of results to return. - **lang** (string) - Optional - Language filter, e.g., "en". - **tbs** (string) - Optional - Time range filter: "qdr:d|w|m|y" (day, week, month, year). - **sources** (array of strings) - Optional - Allowed values: "web", "news", "images". ### Response #### Success Response (200) - **success** (boolean) - Indicates success. - **data** (array) - List of result objects. - **url** (string) - Result URL. - **title** (string) - Result title. - **description** (string) - Result description. - **snippet** (string) - Result snippet. - **position** (number) - Position in results. - **score** (number) - Relevance score. ### Request Example ``` curl -X POST https://api.fastcrw.com/v1/search \ -H "Authorization: Bearer $CRW_API_KEY" \ -H "Content-Type: application/json" \ -d '{"query":"renewable energy trends 2024","limit":3}' ``` #### Response Example ``` { "success": true, "data": [ {"url": "https://...", "title": "...", "description": "...", "snippet": "...", "position": 1, "score": 9.5} ] } ``` ``` -------------------------------- ### Start response Source: https://github.com/fastcrw/crw/blob/main/docs/crawling/index.html Example response from POST /v1/crawl containing the crawl job ID. ```json { "success": true, "id": "550e8400-e29b-41d4-a716-446655440000" } ```