Web Scraper API
The Web Scraper API provides web scraper services to retrieve HTML and plaintext data from any website URL.
To retrieve web page metadata and URL information, use the Webpage API instead.
From 2,209 users
Applications using this API
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 325ms | 355ms | 379ms | 633ms | 1082ms |
Similar APIs
Didn't find what you were looking for? Suggest an improvement
/v1/webscraper GET
https://api.api-ninjas.com/v1/webscraper
Returns the HTML or plaintext data scraped from a given URL. Maximum size of data returned is 2MB.
Parameters
urlrequiredURL to scrape.
text_onlyoptionalWhether to only extract visible text (ignores HTML tags and metadata). Must be either
trueorfalse. Default isfalse.user_agentoptionalUser-Agent string to use in the request header.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
A JSON object with the following fields or an error if the request is unsuccessful.
dataThe scraped HTML or extracted text, depending on the
text_onlyparameter.
The API may also include additional metadata fields in the future; refer to the sample response for the exact structure.
Sample Request Live Demo!
Try our APIs in the API playground
Sign up for a free API key to get started — no credit card required.
https://api.api-ninjas.com/v1/webscraper?url=https%3A%2F%2Fexample.comHeaders
X-Api-KeyLog in or sign up to get your API KeySample Response
Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/webscraper?url=https://example.com" \
-H "X-Api-Key: YOUR_API_KEY"If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.
Frequently Asked Questions
Can I use the Web Scraper API for commercial purposes?
Yes, but you must have a premium subscription. Commercial use of the Web Scraper API is not permitted on the free tier. See our pricing page to choose a plan that fits your needs.How do I get an API key and start using the Web Scraper API?
Sign up for a free account to instantly get your API key, then pass it in theX-Api-Keyheader on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.What happens if I exceed my quota for the month?
Your API requests will simply be denied once you hit your monthly quota — you will never be charged more than the plan you signed up for. To increase your quota, you can upgrade your plan any time on our pricing page.What happens if a request to the Web Scraper API fails?
The API responds with a standard HTTP status code and a JSON error message describing the problem. See our error codes reference for the full list of codes and how to resolve each one, or contact support if you need help.What are some use cases for the Web Scraper API?
The Web Scraper API retrieves the raw HTML or visible plaintext of any website URL, making it useful for content monitoring, data extraction, archiving, and feeding text into downstream tools. If you instead need structured page metadata such as title, description, and links, use the Webpage API.How do I get back only the visible text instead of full HTML?
Set the optionaltext_onlyparameter totrue, which strips HTML tags and metadata and returns only the visible text; it defaults tofalse, returning the full HTML. You can try both modes in the live demo on the API documentation page.What does the Web Scraper API response include?
The response is a JSON object with adatafield containing the scraped HTML or extracted text depending on thetext_onlyparameter, with a maximum returned size of 2MB. If a request is unsuccessful you will receive an error instead.Can I customize the request, for example to mimic a specific browser?
Yes, pass the optionaluser_agentparameter to set the User-Agent string sent in the request header, while the requiredurlparameter specifies the page to scrape. For extracting text from images rather than web pages, see the Image to Text API.