Checking API requests usage
In the API, we also expose /usage
endpoind to let you check the status of active request packs associated with your account.
Each successful request to Scraping Fish API is worth exactly one API request regardless of query parameters or other options.
To get the current status of API requests available for your account, you can call /usage
endpoint with api_key
query parameter as follows:
- Python
- NodeJS
- cURL
import requests
response = requests.get("https://scraping.narf.ai/api/v1/usage/?api_key=[your API key]")
print(response.content)
const axios = require("axios");
const response = await axios.get("https://scraping.narf.ai/api/v1/usage/?api_key=[your API key]");
console.log(response.data);
curl -G 'https://scraping.narf.ai/api/v1/usage/?api_key=[your API key]'
In the response, you get a list of your valid API request packs sorted in ascending order by expiration date, for example:
[
{
"total": 100000,
"left": 69420,
"expires": "24 Feb 2024 20:00:00 GMT"
}
]
where
total
: the total number of API requests you purchased in this pack,left
: the number of API requests left in this pack,expires
: API requests pack expiration date in UTC.
This information is also available in the Scraping Fish dashboard after you log in to your account.
If you currently do not have any API requests available, the list in the response will be empty.
API requests are always subtracted from the request pack with the earliest expiration date.
Obviously, calling /usage
endpoint does not affect your available API requests.