Check Credits
Endpoint
Section titled “Endpoint”GET https://api.visionati.com/api/creditsReturns your current credit balance. Useful for checking your balance before making requests, building dashboards, or monitoring usage programmatically.
Request
Section titled “Request”No parameters required. Just authenticate with your API key.
curl "https://api.visionati.com/api/credits" \ -H "X-API-Key: Token YOUR_API_KEY"Response
Section titled “Response”{ "credits": 4500}| Field | Description |
|---|---|
credits | Your remaining credit balance. One credit equals one cent. |
Code Examples
Section titled “Code Examples”Python
Section titled “Python”import requests
response = requests.get( "https://api.visionati.com/api/credits", headers={"X-API-Key": "Token YOUR_API_KEY"},)data = response.json()print(f"Remaining credits: {data['credits']}")JavaScript (Node.js)
Section titled “JavaScript (Node.js)”const response = await fetch("https://api.visionati.com/api/credits", { headers: { "X-API-Key": "Token YOUR_API_KEY" },});const data = await response.json();console.log(`Remaining credits: ${data.credits}`);$ch = curl_init("https://api.visionati.com/api/credits");curl_setopt($ch, CURLOPT_HTTPHEADER, ["X-API-Key: Token YOUR_API_KEY"]);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);$response = curl_exec($ch);curl_close($ch);
$data = json_decode($response, true);echo "Remaining credits: " . $data["credits"];Errors
Section titled “Errors”| Error | Description |
|---|---|
Access denied. | Invalid or missing API key. |
See Errors for all possible error responses.
- The
creditsfield is also included in every analyze response as well as completed async responses, so you can track your balance without making a separate call. - This endpoint is lightweight and can be polled frequently without concern.