---
title: "Scraping vs API"
description: "Scraping pulls data out of web pages; an API hands over labelled data under the owner's terms and quotas. When to use which, and the rules."
url: https://ursy.com/wiki/scraping-vs-api/
updated: 2026-11-25T02:01:24+00:00
publisher: URSY (https://ursy.com/)
cite: Name URSY and link https://ursy.com/wiki/scraping-vs-api/
---

# Scraping vs API

> Scraping pulls data out of web pages; an API hands over labelled data under the owner's terms and quotas. When to use which, and the rules.

**Scraping vs API is the choice between pulling data out of web pages built for people and asking a service for the same data through an interface built for programs.** Scraping reads the HTML and picks out the parts you want. An API (application programming interface) hands you clean, labelled data under terms the owner sets. Most [SEO](https://ursy.com/wiki/seo-search-engine-optimisation/) and AI work uses both, and knowing which fits saves time, money and trouble.

## What is the difference? {#what-is-the-difference}

A [web scraper](https://ursy.com/wiki/web-scraping/) fetches a page the way a browser does, then parses the [HTML](https://ursy.com/wiki/html/) or the rendered [DOM](https://ursy.com/wiki/dom-document-object-model/) to find a price, a heading or a table. It works on almost any public page, but it breaks when the layout changes. An API answers a defined request with structured data, usually JSON, often after you sign in with a key. It is stable and documented, but it only gives what the owner chooses to share, at the rate they allow.

| Question | Scraping | API |
| --- | --- | --- |
| What you get | Whatever the page shows | What the owner exposes |
| Format | HTML you must parse | Structured JSON or XML |
| Stability | Breaks when the page changes | Versioned and documented |
| Permission | Unclear; robots.txt and terms apply | Written terms and keys |
| Limits | Blocks, 429 errors, [CAPTCHAs](https://ursy.com/wiki/captcha/) | Published quotas |
| Cost | Your own servers and fixes | Free tier or paid plan |

## Why does it matter for search? {#why-does-it-matter-for-search}

Two ways. First, as a data user. [Google](https://ursy.com/wiki/google/)’s [spam policies](https://developers.google.com/search/docs/essentials/spam-policies) list sending automated queries to Google, including scraping results for rank-checking, as machine-generated traffic that breaks its policies and terms. Its official route is the [Search Console](https://ursy.com/wiki/google-search-console/) API. Second, as a publisher. The same policies say that copying other sites’ content with little added value is scraping spam, even when the source is credited. See [scraped content](https://ursy.com/wiki/scraped-content/).

## Why does it matter for AI answers? {#why-does-it-matter-for-ai-answers}

[AI crawlers](https://ursy.com/wiki/ai-crawler/) are scrapers at huge scale: they fetch public pages to build [training data](https://ursy.com/wiki/training-data/) or to answer a question live. The new direction is the other path. Protocols such as [MCP](https://ursy.com/wiki/mcp/) and [WebMCP](https://ursy.com/wiki/webmcp/) let a site offer tools and data to an [AI agent](https://ursy.com/wiki/ai-agent/) directly, so the agent does not have to guess from the page layout. A site that publishes a clean feed, an API or an [llms.txt](https://ursy.com/wiki/llms-txt/) file gives machines a tidy door. One that does not will still be read, just less accurately. That is the heart of the [agentic web](https://ursy.com/wiki/agentic-web/).

## How does each one handle permission? {#how-does-each-one-handle-permission}

### Scraping and robots.txt {#scraping-and-robots-txt}

[RFC 9309](https://www.rfc-editor.org/rfc/rfc9309), the Robots Exclusion Protocol standard from September 2022, asks crawlers to honour the rules in [robots.txt](https://ursy.com/wiki/robots-txt/). It also says plainly that the file does not grant or deny access in any binding way. So robots.txt is a polite sign, not a lock. Well-behaved scrapers read it, cache it for no more than 24 hours and send an honest [user agent](https://ursy.com/wiki/user-agent/).

### APIs and quotas {#apis-and-quotas}

An API states its limits. Google’s [Search Console API limits](https://developers.google.com/webmaster-tools/limits) page, checked on 25 November 2026, gives 1,200 queries per minute per site for Search Analytics, and 2,000 [URL](https://ursy.com/wiki/url/) Inspection calls per day per site. The [query reference](https://developers.google.com/webmaster-tools/v1/searchanalytics/query) says each call returns 1,000 rows by default and up to 25,000, and that it returns top rows rather than promising every row.

### Rate limits on both {#rate-limits-on-both}

Ask too often and a server says no. [MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/429) describes the [status code](https://ursy.com/wiki/http-status-code/) 429 Too Many Requests and the optional Retry-After header that tells a client how long to wait. Our [rate limiting](https://ursy.com/wiki/rate-limiting/) entry explains the server side.

## Is scraping legal in the UK? {#is-scraping-legal-in-the-uk}

It depends on what you collect and how. Personal data is the big risk. The ICO’s [position on web scraping for generative AI](https://ico.org.uk/about-the-ico/what-we-do/our-work-on-artificial-intelligence/response-to-the-consultation-series-on-generative-ai/the-lawful-basis-for-web-scraping-to-train-generative-ai-models/) calls it a high-risk, invisible processing activity and says legitimate interests is the only lawful basis open to most developers. It also encourages them to look for other sources of data where they can. Scraping prices or headings is a lower risk than scraping names and emails, but site terms and copyright still apply. Read our [UK GDPR](https://ursy.com/wiki/uk-gdpr/) entry and take advice for anything large.

## When should you pick which? {#when-should-you-pick-which}

- **Use the API**  when one exists for your data: your own [performance report](https://ursy.com/wiki/search-console-performance-report/), your shop’s orders, your analytics.
- **Use a feed**  where the site offers one: an [RSS feed](https://ursy.com/wiki/rss-feed/), an [XML sitemap](https://ursy.com/wiki/xml-sitemap/) or a [shopping feed](https://ursy.com/wiki/shopping-feed/).
- **Read structured data**  in the page: [JSON-LD](https://ursy.com/wiki/json-ld/) is already labelled, so parsing it is far more reliable than guessing from layout.
- **Scrape**  only public pages, slowly, within robots.txt, when no other route exists, such as checking your own pages as a crawler sees them.

## Common mistakes {#common-mistakes}

- **Scraping Google’s results.**  It breaks Google’s policies; use the Search Console API for your own data.
- **Treating robots.txt as a fence.**  It keeps polite [bots](https://ursy.com/wiki/bot-web-robot/) out, nobody else. Use access control for private data.
- **Ignoring 429.**  Keep hammering and you will be blocked. Honour Retry-After.
- **Faking a browser user agent.**  It hides who you are and gets caught by bot checks, see [verified bots](https://ursy.com/wiki/verified-bots/).
- **Assuming the API gives everything.**  Search Console says it returns top rows, not all rows.
- **Storing keys in page code.**  An API key in JavaScript is public.

## A worked example {#a-worked-example}

A shop owner wants every [search query](https://ursy.com/wiki/search-query/) that brought clicks last month.

1. **Scraping route:**  log in to Search Console and copy the screen. The UI export stops at 1,000 rows, as Google’s [performance data deep dive](https://developers.google.com/search/blog/2022/10/performance-data-deep-dive) explains.
2. **API route:**  call Search Analytics with rowLimit 25,000 and page through with startRow. The same post says the daily ceiling through the API is 50,000 rows, counted per site and per search type.

The API is the clear winner: more rows, no fragile page parsing and within Google’s terms.

## How to check it {#how-to-check-it}

1. See what your robots.txt allows with our [Robots.txt Checker](https://ursy.com/robots-txt-checker/).
2. Check which AI bots your site lets in with the [AI Bot Checker](https://ursy.com/ai-bot-checker/), and test whether a visitor claiming to be a crawler is genuine with [Verify AI Bot](https://ursy.com/verify-ai-bot/).
3. See the status codes and headers a scraper gets with our [HTTP Header Checker](https://ursy.com/http-header-checker/).
4. Tidy an API reply with the [JSON Formatter](https://ursy.com/webmaster-tools/json-formatter/).
5. Read our [API](https://ursy.com/api/) and [MCP](https://ursy.com/mcp/) pages for the doors we offer machines.
6. Inside URSY Pro, watch for heavy fetchers with the [Scraper and flood detector](https://ursy.com/pro/scraper-and-flood-detector/) (Pro) and [Search Console forever](https://ursy.com/pro/search-console-forever/) (Pro).

## Questions {#questions}

### Is an API always better? {#is-an-api-always-better}

For data the owner offers, usually yes. But an API only shows what the owner chooses. To see a page exactly as a visitor or crawler does, you must fetch the page.

### Does robots.txt make scraping illegal? {#does-robots-txt-make-scraping-illegal}

No. RFC 9309 says the file is not a way of authorising access. Legal risk comes from data protection law, copyright and site terms.

## Related words {#related-words}

- [Web scraping](https://ursy.com/wiki/web-scraping/)
- [Scraped content](https://ursy.com/wiki/scraped-content/)
- [Rate limiting](https://ursy.com/wiki/rate-limiting/)
- [MCP](https://ursy.com/wiki/mcp/)
- [Robots.txt](https://ursy.com/wiki/robots-txt/)

## Sources {#sources}

- [RFC 9309: Robots Exclusion Protocol (September 2022)](https://www.rfc-editor.org/rfc/rfc9309), checked 25 November 2026
- [Google Search Central: Spam policies for Google web search](https://developers.google.com/search/docs/essentials/spam-policies), checked 25 November 2026
- [Google for Developers: Search Console API usage limits](https://developers.google.com/webmaster-tools/limits), checked 25 November 2026
- [Google for Developers: Search Analytics query reference](https://developers.google.com/webmaster-tools/v1/searchanalytics/query), checked 25 November 2026
- [Google Search Central Blog: A deep dive into Search Console performance data filtering and limits (19 October 2022)](https://developers.google.com/search/blog/2022/10/performance-data-deep-dive), checked 25 November 2026
- [MDN: 429 Too Many Requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/429), checked 25 November 2026
- [ICO: The lawful basis for web scraping to train generative AI models](https://ico.org.uk/about-the-ico/what-we-do/our-work-on-artificial-intelligence/response-to-the-consultation-series-on-generative-ai/the-lawful-basis-for-web-scraping-to-train-generative-ai-models/), checked 25 November 2026

*Updated 25 November 2026 by URSY.*
