A web scraping API lets your software request website content or extracted data through a programmatic interface. It can save you from operating part of the retrieval infrastructure, but check what it actually returns before building around it: a fetched page, HTML after JavaScript runs, and application-ready records are different deliverables.
For authorized public-page HTML going into an existing data pipeline, SearchApi is a strong fit. If the publisher already offers the fields you need through an official API or feed, start there instead. And if you only need a small, straightforward static-page fetch, running it yourself may be enough.
The important boundary is between getting the page and accepting its data. Outsourcing the first job does not automatically outsource the second.
What does a web scraping API actually return?
A scraping API’s output depends on its contract. Some services expose extracted fields; others return page content that your application must interpret. A JSON response alone does not tell you which kind you are getting.
SearchApi’s Scrape API documentation describes a JSON envelope with three useful parts:
scrape_metadata: retrieval status, timing, and consumed credits, plus an identifier unless zero-retention mode removes it.target: the destination’s status code, final URL, response headers, and cookies.outputs.html: the retrieved page content, already decompressed.
That last field is the distinction that matters. Your application still needs to locate an event title, validate its date, and turn it into a record. The JSON is the shipping container; the HTML is the cargo.
Even the field name deserves attention. In SearchApi’s documented target-POST example, the destination answers with JSON, and that response appears as text inside outputs.html. You then use a JSON parser for that content rather than treating it as HTML.
Choose a scraping API by the data it hands your application, not by the format of the outer envelope.
Web scraping vs. an official API, a simple fetch, or a search API
Use the smallest authorized interface that supplies the required information. These approaches solve different problems, so choosing between them comes before choosing a provider.
| Approach | What goes in and comes back | When it fits | Work that remains |
| Publisher’s official API or feed | Documented queries or a feed subscription; structured records | The fields, coverage, and permitted use meet your needs | Pagination, request limits, normalization, deduplication, and freshness |
| Lightweight in-house retrieval | A known URL; response text for your parser | A small, simple, authorized static-page task | Hosting, scheduling, retries, parsing, layout changes, and monitoring |
| Managed web scraping API | A URL and retrieval settings; page content or service-specific extraction output | Managed fetching or rendering is useful and your application can process the response | Contract-specific limits, billing, and downstream data processing |
| Search/SERP API | A search query; result links and search-result fields | Finding candidate pages or monitoring search results | Retrieving destination content when snippets and result metadata are insufficient |
A SERP is a search engine results page. A search API can help you discover URLs; a URL-retrieval API obtains the content at those destinations. SearchApi offers distinct products for those jobs. Its specialized engines are also third-party services, not the destination publishers’ own official APIs.
The Library of Congress’s JSON/YAML API shows why checking the publisher first can pay off: its own applications use the interface to build website pages. Public access does not require an API key. Coverage still matters, though: the interface generally excludes library-catalog records, while digitized items are retrievable.
An official API therefore changes the extraction problem; it does not remove the need to check what the source actually covers.
When SearchApi is a good fit
We recommend SearchApi’s Web Scraping API for teams that want managed retrieval of authorized public-page HTML and already have somewhere to parse, validate, store, and monitor it. Its documented HTML output, optional browser rendering, and diagnostic metadata fit that division of work.
On December 3, 2026, SearchApi described the service as beta, with access on request and activation per account. Its documentation warns that some sites can fail or respond slowly, and that parameters and response fields can change. Those terms matter if you are connecting it to a production pipeline: keep contract checks around the fields you consume.
SearchApi is a less suitable choice when an official feed already covers the task, a small static fetch is easy to maintain, or you need normalized records delivered without building an extraction layer. Browser mode also has specific input restrictions that can rule it out for a particular integration.
HTTP or browser rendering?
Start with HTTP retrieval when the required content is present in the original response. Use browser rendering when JavaScript builds information that is missing from that response.
SearchApi documents this distinction with the serde package page on crates.io. In its example, HTTP mode contains a general title but lacks package details; browser mode includes the package name and description. The example illustrates the rendering boundary, rather than a rule that every page on the site needs a browser.
| Capability | HTTP mode | Browser mode |
| Content returned | Original response without executing JavaScript | HTML after JavaScript runs |
| Target method | GET or POST | GET only |
| Custom target headers | Supported, subject to restrictions | Not supported |
| Target request body | Supported for POST, within the size limit | Not supported |
| Cookies, country, and session parameters | Supported | Supported |
| Credits for a billable retrieval | 1 | 5 |
Browser mode is not simply HTTP mode with every option plus JavaScript. Sending custom target headers, a body, or target POST returns invalid_parameter.
Browser waits also need a purpose. wait_until supports load, the default, along with domcontentloaded and network_idle. You can then wait for a CSS selector with wait_for, up to 1,000 characters, and add wait_ms, an integer from 1 to 15,000 milliseconds, after the other waits. A delay is still just a delay; required-field validation decides whether your data is ready.
What your integration must handle
SearchApi exposes its general retrieval endpoint at https://www.searchapi.io/api/v1/scrape. Keep two request layers separate: your application calls SearchApi, and SearchApi requests the destination.
A POST to the provider with a JSON body accepts all parameters. A GET with query parameters returns the same kind of response at the same cost, but excludes method and body and always sends GET to the target. A provider POST can still configure a target GET—or a target POST in HTTP mode.
The documented constraints are concrete enough to check before integration:
| Area | Documented behavior | Practical implication |
| Authentication | Authorization: Bearer YOUR_API_KEY; provider GET also accepts api_key in the query | Prefer the header. Provider POST requires header authentication. |
| Destination URL | Full HTTPS URL, up to 8 KB, port 80 or 443, without an embedded username or password | Redirects to HTTP are not followed; the redirect itself is returned. |
| HTTP request body | Text up to 1 MB, for target POST | Set the target’s Content-Type through its headers. |
| Target headers | Up to 100; provider-controlled headers such as User-Agent and Accept-Encoding cannot be overridden | Unsupported headers produce invalid_parameter. |
| Headers and cookies | Combined maximum of 64 KB; cookies use the separate cookies parameter | Do not substitute a literal Cookie header for that parameter. |
| Request origin | country uses a lowercase two-letter code and defaults to us | This sets the request origin, not your account’s billing market. |
| Session identifier | Up to 255 characters without spaces; IP affinity for up to 10 minutes | The initial country stays fixed for the session, and failures can interrupt continuity. |
| Response size | A page or JSON envelope over 20,000,000 bytes produces response_too_large | Scope oversized jobs to smaller pages. |
| Retrieval time | An 85-second limit; official Python examples use a 90-second client timeout | A client timeout that is too short can trigger unnecessary repeat requests. |
The ampersand mistake can cost credits
When calling the provider with GET, percent-encode the destination URL. Otherwise, an & inside that URL can end the outer url parameter.
SearchApi warns that the result can be invalid_parameter or, if the remaining text matches an API parameter such as country or url, a different retrieval that still incurs a charge. Use your HTTP client’s parameter serializer rather than assembling the query string by hand. A JSON POST also avoids manually mixing those two query layers.
Check automatic retries, too. SearchApi notes that some clients repeat a GET after a timeout, and each repeat is a new scrape.
An IP session is not a cookie jar
Reusing session_id provides temporary IP affinity, not complete browser-state management. A session lasts up to 10 minutes from its first request; afterward, the same identifier starts a new one. Changing its country causes an error. An unavailable session or some target failures can lead to a new IP session.
Your application manages cookie state separately. target.cookies lists cookies set by the final page, not cookies set on followed redirects. Merge new values into the cookies you retain, replace matching names, and remove deleted cookies using target.headers["set-cookie"]. Send the resulting values through the cookies parameter.
Why a 200 response can still be unusable
A reliable integration checks four things separately: whether the provider completed the request, what the destination returned, whether browser waits completed, and whether parsing produced acceptable records.
SearchApi can return an API-level 200 while target.status is 404. Browser mode can also return HTML with scrape_metadata.is_wait_complete=false when a wait expires. Neither case should silently become a fresh, accepted dataset.
Parsing introduces another failure class. Real Python demonstrates a title extractor that searches for the literal string <title> and fails on a practice page containing <title >. A single space exposes the weakness of the extraction rule. Managed retrieval does not repair it; an HTML parser such as Beautiful Soup addresses a different stage of the job.
A completed fetch is not a validated record. Keep retrieval status, parsing status, and data freshness separate.
Handle errors according to their cause
SearchApi’s error codes distinguish request construction, account conditions, destination failures, and temporary service problems. Treating all of them as “retry” wastes time and can hide the actual fault.
| Signal | Meaning | Application response |
400 invalid_parameter | Invalid request input | Correct the input before repeating it. |
400 blocked_destination | An excluded destination or redirect | Resolve the restriction with the provider rather than retrying unchanged. |
| 401 | Missing or invalid API key | Check authentication. |
403 not_enabled | Scrape API not activated for the account | Resolve account activation. |
403 zero_retention_forbidden | Retention entitlement or account configuration mismatch | Resolve the required account settings. |
| 429 | An account limit | Read the error: causes include exhausted credits, fewer than five browser credits, hourly or concurrency limits, or overdue payment. |
413 response_too_large | Page or envelope exceeds the size ceiling | Reduce the retrieval scope. |
500 internal_error | Provider-side internal failure | Use bounded retries and escalate persistent failures. |
502 target_blocked | Destination blocked the request | Pause and review access conditions. |
502 target_unreachable | Destination or redirect could not be reached | Check the destination and retry only when appropriate. |
502 target_unreadable | Non-text or undecodable content | Check the content type; this is not image or PDF extraction. |
502 upstream_error | Retrieval could not complete | Consider a bounded retry. |
503 service_unavailable or session_unavailable | Temporary service or session failure | Retry conservatively; session recovery starts a new session. |
504 timeout | Retrieval exceeded 85 seconds | Reassess the request and retry later when appropriate. |
Bounded retries and pauses are application policies, not automatic data-quality features of the service. A provider-account 429 is also a different signal from the destination website returning its own 429.
Illustrative example: public events to a dashboard
Suppose you are building a dashboard that aggregates public event listings. Begin with the publisher’s export options, not an HTML parser.
The Nashville Public Library calendar offers JSON, RSS, XML, iCalendar, jCal, xCal, CSV, and an HTML list. Its export controls specify a default of 10 events, a maximum of 200 events, and an event-count setting that takes precedence over the date range. Selecting a date range therefore does not automatically produce every matching event.
For this illustrative design, Nashville represents the publisher-feed route. A different public page whose automated access and intended reuse are authorized represents the HTML-retrieval route. The two routes converge after retrieval, when the application starts accepting records.
A useful feed-first principle also appears in a public CivicPulse implementation proposal:
“HTML scraping is a fallback after tested downloads or existing source adapters; unattended challenge bypass is not an acquisition plan.” — kerryhatcher, author of a CivicPulse implementation issue
That is a proposed acquisition policy, not an account of a completed deployment. Here is how to apply the same architectural distinction to the events example:
- Choose the authorized interface. Check fields, time coverage, export-count limits, pagination, and permitted use. Use the publisher’s API or feed when it covers the job. Keep the access decision separate from retrieval settings.
- Retrieve the content. Consume the feed directly, or send the authorized HTML URL from your server to SearchApi with header-based authentication. Start with HTTP; use browser mode when scripts supply required content absent from the initial response.
- Parse and validate. For the HTML route, check provider status,
target.status, final URL, and browser completion where applicable before parsingoutputs.html. An illustrative event record could contain the source identifier, source URL, title, start and end, known timezone, venue, and retrieval timestamp. Validate required fields, plausible dates, and expected page identity. - Normalize and deduplicate. Preserve original values and provenance. Derive comparable timestamps only when the timezone is known; do not guess it. Prefer a stable publisher identifier where available, or design a source-specific key.
- Store and monitor. Retain accepted records, parser version, provenance, last successful refresh, and the current ingestion result. Track provider and target errors, incomplete waits, missing fields, duplicates, accepted unique records, credits, latency, and data age. Keep the last good dataset separate from a failed or unexpectedly empty parse.
- Update the dashboard. Show accepted records alongside the last successful refresh and a visible stale/error state when needed. Reconcile removals or cancellations using source-specific rules: a failed fetch is not evidence that an event was canceled.
The validation rules, storage, scheduling, and dashboard behavior in this example belong to the application. HTML retrieval supplies an input to that system, not the entire system.
What does each useful result cost?
Measure cost against accepted output, not just completed requests. SearchApi documents one credit for a billable HTTP retrieval and five for browser mode, drawn from the same balance used for searches. Browser retrieval starts only when at least five credits remain.
The billing rules count a returned page, redirect, or request-caused client error such as a target 404. Failed scrapes and the destination’s own server errors are free. Your parser can still reject a response that incurred credits.
Consider an illustrative workload in which all 100 requests are billable and HTTP already supplies the required content for 80 of them:
| Retrieval strategy | Calculation | Total credits |
| HTTP for 80 requests; browser for 20 | 80 × 1 + 20 × 5 | 180 |
| Browser for all 100 requests | 100 × 5 | 500 |
| Difference | 500 − 180 | 320 |
Under those assumptions, selective rendering uses 64% fewer credits than rendering every request. That is a workload calculation, not an observed saving or a guarantee about the records returned.
For your application, a useful operating metric is:
credits per accepted unique record = total consumed credits / accepted unique records
Validate and deduplicate before counting the denominator. If no records are accepted, there is no finite ratio; record the failed run rather than reporting zero cost per result. Converting credits into a dollar cost also requires your actual subscription allocation and utilization.
Measure latency under your own workload, including rendering waits and retries. The documented 85-second ceiling is a timeout boundary, not a typical response time.
Permissions, privacy, and reasonable request rates
Public visibility does not settle automated-access permission or reuse rights. RFC 9309 defines crawler rules and explicitly distinguishes them from access authorization. Check site terms, permission, content rights, privacy implications, and intended reuse separately. Do not treat a robots allowance as a blanket collection or republication license.
Request rates are source-specific. The Library of Congress’s limits guidance documents 20 requests per minute and a one-hour block, with potentially lower effective limits during heavy traffic. It advises pausing for 429 responses or CAPTCHA HTML even below that rate. Those figures apply to that API, not other websites or SearchApi accounts. Its guidance also illustrates deduplication across overlapping queries using the source’s id field.
Keep secrets out of URLs and unnecessary logs. SearchApi recommends header authentication because query strings can enter logs and browser history; request headers and cookies placed in a GET URL have the same exposure problem.
For Enterprise accounts, zero_retention=true disables SearchApi’s logging and persistent storage of request parameters, HTML, and JSON responses. The response then lacks scrape_metadata.id, and support or debugging may be limited. Your own database and observability systems still need their own retention rules. Collect only the public fields your application needs and exclude private attendee information from the events pipeline.
Common questions about web scraping APIs
What is a web scraping API?
A web scraping API exposes website retrieval or extraction through a software interface. Its output is service-specific: SearchApi’s general Scrape API returns page content and metadata, with application records still to be extracted.
How is scraping different from a site’s official API?
Scraping derives information from page content; a publisher’s official API exposes a documented machine-readable interface directly. An official API can remove HTML parsing, but its coverage and request limits still determine whether it meets your needs.
Does JSON output mean the fields are already extracted?
No. SearchApi returns a JSON envelope containing outputs.html, which the application must parse. If the destination itself returns another format, such as JSON, use the corresponding parser for that text.
Is a search API the same as a scraping API?
No. A search API supplies search-result information, while URL retrieval supplies destination content. Use search for discovery and retrieve the destination when result fields or snippets do not answer the task.
When is JavaScript rendering necessary?
Use rendering when scripts build required information that is absent from the original response. SearchApi recommends trying HTTP first and documents a crates.io example in which browser mode supplies missing package details.
Does “pay only for success” mean every charge yields usable data?
No. SearchApi’s billable conditions include request-caused client errors such as a target 404. A retrieved page can also fail your application’s required-field checks.
Can a free official API be enough?
Yes, when its coverage and permitted use fit the task. The Library of Congress provides public API access without an API key, subject to its documented coverage and request limits.
Does managed retrieval make a dashboard automatically current?
No. Refresh scheduling, parsing, validation, storage, and stale-data handling remain application responsibilities. Layout changes, failed requests, and incomplete browser waits can all interrupt a refresh.
How to choose a web scraping API for your pipeline
The best web scraping API for your project is the one whose output and operating constraints match the work you need to delegate. Evaluate a provider against your actual destinations and acceptance rules:
- Output contract: Does the service return HTML, rendered HTML, or the exact fields your application needs?
- Authorized coverage: Can it retrieve the permitted destinations and content types involved in your workload?
- Rendering and inputs: Do the supported methods, headers, cookies, waits, URL lengths, and response sizes fit? Check browser restrictions separately from HTTP features.
- Useful yield and billing: Count accepted unique records and consumed credits, including billable responses that your parser rejects.
- Latency and limits: Measure the workload with its waits and retries, and check the account’s credit, hourly, and concurrency conditions.
- Retention and access terms: Confirm activation requirements and whether the available retention controls meet your needs.
- Operational ownership: Assign responsibility for parser changes, failed refreshes, and source reconciliation. Set a maximum data age that triggers a visible stale warning.