Docs / UserInfo & Balance API
v1

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.

Note: Pre-signed URLs are not typically used with this endpoint since it contains account-sensitive information. Always use Basic Auth over HTTPS.

Basic Authentication Header

HEADER Authorization: Basic base64(access-key:secret-key)

For example, if your access key is c9542d01d69f and secret key is 17902c2c9b3a, the encoded value is:

Example
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.

GET https://api.webshrinker.com/userinfo/v1/balance

Request Headers

HeaderValue
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.

200 OK Success — remaining credits
Response Body
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.

401 Unauthorized application/json
JSON
{
    "error": {
        "message": "Invalid signed hash or no API key/secret given"
    }
}

4 HTTP Status Codes

CodeStatusDescription
200OKRequest successful. Balance returned as integer.
202AcceptedRequest accepted; processing on server.
400Bad RequestInvalid request parameters.
401UnauthorizedWrong or missing API credentials.
402Payment RequiredAccount balance depleted.
412Precondition FailedInsufficient information to process request.
429Too Many RequestsRate limit exceeded.
500Internal Server ErrorServer error. Retry the request.