Crawl is New. Any active Zenrows API key can use it. The client is the module
github.com/zenrows/zenrows-go-sdk/service/crawl at v1.0.0, separate from the Fetch client in service/api. Go 1.25 or later is required.Install and authenticate
NewClient also reads ZENROWS_API_KEY when you omit WithAPIKey. WithBaseURL defaults to https://api.zenrows.com/v1. WithRetries defaults to 3, and WithTimeout defaults to 30 seconds per request.
Quickstart
Create returns as soon as the crawl is accepted, with StatusRunning. Wait polls until the crawl ends, or until WaitOptions.Timeout runs out (default 600 seconds). On timeout it returns the crawl still StatusRunning, without an error. A crawl that ends StatusFailed is returned too, with Error set. Results follows the cursor and does not poll, so call Wait first to read every URL.
Depth is optional. Leave it at 0 and the crawl follows links until MaxItems or MaxPages stops it. Both default to 100 and cap at 100,000. A response crawl’s Depth is nil when the create left it out.
IncludePatterns chooses which links Crawl opens, not only which URLs it returns. A homepage crawl with only /product/ skips listing paths that lack that text, such as /page/. See Crawl setup.CreateParams.IdempotencyKey so a retry with the same key and body returns the crawl the first request created. Create retries transient failures only when that key is set, and it never retries 429.
Get returns the crawl and one page of results. GetOptions.Limit is 1 to 10,000 (default 1,000). NextCursor is nil only once the crawl has ended and you have read its last results.
Read the pages
SetOutputFormat to crawl.OutputFormatHTML to also fetch the page of every kept URL. Content takes a content id or a result’s ContentURL. Download streams every result as NDJSON. DownloadLine.HTML decodes the page when the line carries HTML.
Download holds only the results kept so far. Call Wait first for the full file.
With OutputFormatHTML, each kept page is one more fetch, and MaxPages counts it. Each page a crawl fetches is one Fetch (formerly, Universal Scraper API) request. See Crawl pricing.
List and stop
List returns one page of the account’s crawls, newest first, without their results. Stop is safe to repeat: a crawl that already ended answers as it ended. Read the final counts with Get.
page.NextCursor as ListOptions.Cursor for the next page. It is empty on the last page.
Errors
A non-2xx response is anAPIError. Match it with errors.As. Code is the problem code, StatusCode is the HTTP status, and RetryAfter is the Retry-After header. A crawl that ended StatusFailed is not an APIError: read Error.Code and Error.Detail on it. A missing API key is a NotConfiguredError.
429 too_many_crawls. Create does not retry that response. The other codes are in the endpoint reference.