Skip to main content

API Key & Usage Management (/key-usage-info)

What is it? The /key-usage-info endpoint acts as your programmatic dashboard. It provides real-time data on your subscription status, including how many requests you have remaining and when your current API key expires. Why use it?
  • Preventing Downtime: Monitor your credit balance to avoid unexpected 403 Forbidden errors once a limit is reached.
  • Auto-Scaling logic: If your application performs bulk operations, use this endpoint to throttle your requests or alert your team when credits are low.
  • Subscription Tracking: Keep track of your plan’s expiration date to ensure seamless renewal.
Python Implementation:
import requests

API_KEY = "YOUR_API_KEY"
URL = "https://api.sorsa.io/v3/key-usage-info"

headers = {"ApiKey": API_KEY}

response = requests.get(URL, headers=headers)
status = response.json()

if response.status_code == 200:
    print(f"Credits Remaining: {status.get('requests_left')}")
    print(f"Total Limit: {status.get('requests_total')}")
    print(f"Expires At: {status.get('expires_at')}")