Cost control | cURL
Learn how to set cost limits for each scrape using ScraperAPI’s parameters in cURL. Prevent overspending on premium requests in both sync and async modes.
ScraperAPI helps you control and manage your costs efficiently. By using the max_cost
parameter with your requests, you instruct the API to set a limit on the maximum API credits you'd like to spend per each individual scrape. This helps prevent overspending, ensuring you stay within your individual project's budget.
API REQUEST
curl "https://api.scraperapi.com/?api_key=API_KEY&premium=true&max_cost=5&url=https://example.com/"
ASYNC REQUEST
curl -X POST \
-H "Content-Type: application/json" \
-d '{
"apiKey": "API_KEY",
"url": "https://example.com/",
"apiParams": {
"premium": "true",
"max_cost": "5"
}
}' \
"https://async.scraperapi.com/jobs"
PROXY MODE
curl -x "http://scraperapi.premium=true.max_cost=5:[email protected]:8001" -k "https://example.com/"
If the scrape cost exceeds your limit, a 403
status code will be returned for the request, with the following error message:
"This request exceeds your max_cost. You can view the cost per request in your response header or in the API Playground on the dashboard."
Last updated
Was this helpful?