Skip to main content

Balance API

Check your account credit balance using your API key.

Endpoint

GET /api/v1/balance

Authentication

Send your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY

Example Request

curl -X GET "https://aitutor-api.vercel.app/api/v1/balance" \
  -H "Authorization: Bearer sk_xxxxxxxxxxxxxxxxxxxxxxxx"

Success Response (200)

{
  "success": true,
  "credits": 1234
}
FieldTypeDescription
successbooleanAlways true on success
creditsnumberCurrent credit balance

Error Responses

401 Unauthorized — Missing or invalid API key.
{
  "error": "Unauthorized. Please provide a valid secret key.",
  "success": false
}
429 Too Many Requests — Rate limit exceeded.
{
  "error": "Rate limit exceeded",
  "success": false
}
500 Internal Server Error — Server error.
{
  "error": "Failed to retrieve balance, please try again or contact support.",
  "success": false,
  "code": "internal_server_error"
}

Response Headers

HeaderDescription
x-ratelimit-limitRate limit per window
x-ratelimit-remainingRemaining requests in window