API Basics
All you need to know for start using ScrapingAnt API.
Start using API
The only 2 things needed to start working with ScrapingAnt API: URL you'd like to scrape, and the API key. The second one can be found at the user's dashboard.
API info
ScrapingAnt Web Scraping API is available at the following endpoint:
https://api.scrapingant.com/v2/general
It supports all the following methods: GET
, POST
, PUT
and DELETE
, so every API consumer could perform requests using the described methods.
The endpoint requires 2 parameters: x-api-key
with API key and url
with the URL to scrape.
Both of them should be provided as a query parameters.
Below you can find example.com
scraping requests example using CURL.
curl --request GET \
--url 'https://api.scrapingant.com/v2/general?url=https%3A%2F%2Fexample.com&x-api-key=<YOUR-API-KEY>'
This request would return the content of example.com
website:
<!DOCTYPE html><html><head>
<title>Example Domain</title>
<meta charset="utf-8">
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
body {
background-color: #f0f0f2;
margin: 0;
padding: 0;
font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
div {
width: 600px;
margin: 5em auto;
padding: 2em;
background-color: #fdfdff;
border-radius: 0.5em;
box-shadow: 2px 3px 7px 2px rgba(0,0,0,0.02);
}
a:link, a:visited {
color: #38488f;
text-decoration: none;
}
@media (max-width: 700px) {
div {
margin: 0 auto;
width: auto;
}
}
</style>
</head>
<body>
<div>
<h1>Example Domain</h1>
<p>This domain is for use in illustrative examples in documents. You may use this
domain in literature without prior coordination or asking for permission.</p>
<p><a href="https://www.iana.org/domains/example">More information...</a></p>
</div>
</body></html>
To know more about optional parameters, and the response format, please, follow the Request and Response Format page.
Other Available endpoints
ScrapingAnt API provides a few more endpoints for different purposes:
- Markdown Transformation/Extraction -
/markdown
- to extract a web page and convert HTML to Markdown. - AI Data Extraction -
/extract
- to extract structured data from web pages using AI models. - Extended JSON output -
/extended
- to get extended JSON output with additional data like cookies, headers, XHRs, etc.
Execution time
Maximum page load time is restricted to 60 seconds (1 minute), so each URL that failed will be tried as many times as possible for 60 seconds.
Generate API request via request generator
The simplest way to generate required code snippet for starting consuming API is to use ScrapingAnt's request generator. You can find it at the user dashboard and just fill the form with required parameters to get code samples for CURL, Python and NodeJS. Also, the direct execution function is available, so you will be able to execute request right from the user's admin panel.