UserInfo & Balance API
Check your account's remaining API credits and monitor billing cycle consumption in real time. The response is a simple integer representing your available credit balance.
1 Authentication
All requests to the UserInfo API must be authenticated using
Basic HTTP Authentication. Pass your access key
and secret key base64-encoded in the
Authorization header.
Basic Authentication Header
For example, if your access key is c9542d01d69f
and secret key is 17902c2c9b3a, the encoded value is:
Authorization: Basic Yzk1NDJkMDFkNjlmOjE3OTAyYzJjOWIzYQ==
2 Balance Endpoint
Returns the current number of remaining API credits for the billing cycle as a plain integer in the response body.
Request Headers
| Header | Value |
|---|---|
Accept |
application/json |
Authorization |
Basic <base64-encoded-credentials> |
Example Request
curl -u "access-key:secret-key" \
-H "Accept: application/json" \
"https://api.webshrinker.com/userinfo/v1/balance"
import requests
access_key = "your access key"
secret_key = "your secret key"
response = requests.get(
"https://api.webshrinker.com/userinfo/v1/balance",
auth=(access_key, secret_key),
headers={"Accept": "application/json"}
)
if response.status_code == 200:
remaining_credits = response.text.strip()
print(f"Remaining credits: {remaining_credits}")
elif response.status_code == 401:
print("Unauthorized - check your access and secret key")
elif response.status_code == 402:
print("Account request limit reached")
else:
print("An error occurred, try the request again")
<?php
$access_key = "your access key";
$secret_key = "your secret key";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.webshrinker.com/userinfo/v1/balance");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERPWD, $access_key . ":" . $secret_key);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Accept: application/json"]);
$response = curl_exec($ch);
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
switch($status_code) {
case 200:
echo "Remaining credits: " . trim($response) . "\n";
break;
case 401:
echo "Unauthorized - check your access and secret key\n";
break;
case 402:
echo "Account request limit reached\n";
break;
}
?>
3 Response Format
A successful response returns a plain integer representing the number of remaining API credits for the current billing cycle.
99
This means 99 API credits remain for the current billing cycle.
Error Response
On failure, the API returns a JSON object with an error message.
{
"error": {
"message": "Invalid signed hash or no API key/secret given"
}
}
4 HTTP Status Codes
| Code | Status | Description |
|---|---|---|
| 200 | OK | Request successful. Balance returned as integer. |
| 202 | Accepted | Request accepted; processing on server. |
| 400 | Bad Request | Invalid request parameters. |
| 401 | Unauthorized | Wrong or missing API credentials. |
| 402 | Payment Required | Account balance depleted. |
| 412 | Precondition Failed | Insufficient information to process request. |
| 429 | Too Many Requests | Rate limit exceeded. |
| 500 | Internal Server Error | Server error. Retry the request. |