Skip to main content
GET
https://api.authiqa.com
/
parent
/
credit-analysis
Credit Analysis
curl --request GET \
  --url https://api.authiqa.com/parent/credit-analysis \
  --header 'Authorization: <authorization>'
{
  "creditBalance": 123,
  "totalFreeUsers": 123,
  "totalChildAccounts": 123,
  "billableUsers": 123,
  "monthlyRetentionCredits": 123,
  "operationUsage": {},
  "totalCreditsUsed": 123,
  "projectedMonthlyUsage": 123,
  "alerts": {},
  "packageHistory": [
    {}
  ]
}

Overview

This endpoint provides comprehensive credit system analysis including current balance, usage breakdown, billable users calculation, and credit consumption projections. Only accessible to parent accounts with the new credit-based pricing system.

API Details

Authentication

Authorization
string
required
Bearer YOUR_JWT_TOKEN

Try It Out

Test the API using your JWT token:

Code Examples

curl -X GET https://api.authiqa.com/parent/credit-analysis \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Response Format

200: Success
{
  "creditBalance": 58000,
  "totalFreeUsers": 6000,
  "totalChildAccounts": 3500,
  "billableUsers": 0,
  "monthlyRetentionCredits": 0,
  "operationUsage": {
    "childSignups": 150,
    "signIns": 2500,
    "emailVerifications": 75,
    "socialSignIns": {
      "google": 800,
      "github": 200,
      "x": 100,
      "facebook": 50,
      "total": 1150
    }
  },
  "totalCreditsUsed": 4625,
  "projectedMonthlyUsage": 1200,
  "alerts": {
    "low": false,
    "critical": false,
    "depleted": false
  },
  "packageHistory": [
    {
      "packageType": "GROWTH",
      "purchaseDate": 1640995200000,
      "creditsAdded": 55000,
      "freeUsersAdded": 5000,
      "price": 50,
      "transactionId": "pi_xxx"
    }
  ]
}

Credit Operations

{
  "childSignup": 5,
  "signIn": 1,
  "emailVerification": 2,
  "googleAuth": 3,
  "githubAuth": 3,
  "xAuth": 3,
  "facebookAuth": 3,
  "userRetention": 1
}

Package Structure

STARTER

  • Price: $10
  • Credits: 10,000
  • Free Users: 1,000
  • Bonus: 0%

GROWTH

  • Price: $50
  • Credits: 55,000 (10% bonus)
  • Free Users: 5,000
  • Bonus: 10%

SCALE

  • Price: $100
  • Credits: 120,000 (20% bonus)
  • Free Users: 15,000
  • Bonus: 20%

Response Fields

creditBalance
number
Current available credits
totalFreeUsers
number
Cumulative free user quota from packages
totalChildAccounts
number
Total number of child accounts
billableUsers
number
Users above free tier (totalChildAccounts - totalFreeUsers)
monthlyRetentionCredits
number
Monthly retention cost (billableUsers × 1)
operationUsage
object
Breakdown of credit-consuming operations
totalCreditsUsed
number
Total credits consumed this month
projectedMonthlyUsage
number
Estimated monthly credit consumption
alerts
object
Credit balance alert status
packageHistory
array
History of package purchases

Error Codes

401 Unauthorized
  • No authorization token
  • Invalid token
  • Non-parent account access attempt
404 Not Found
  • USER_NOT_FOUND - Parent account not found
500 Internal Server Error
  • Failed to calculate credit analysis
  • Database operation errors

Credit Alert Thresholds

Low Credits

20% remaining
  • Warning notification
  • Recommend package purchase

Critical Credits

10% remaining
  • Urgent warning
  • Service interruption imminent

Depleted Credits

0 credits
  • Child access blocked
  • Parent access maintained

Calculation Details

1

Billable Users

Calculate users above free tier:
billableUsers = Math.max(0, totalChildAccounts - totalFreeUsers)
2

Monthly Retention

Calculate monthly retention cost:
monthlyRetentionCredits = billableUsers × 1
3

Operation Credits

Sum all operation credit usage:
totalCreditsUsed = (childSignups × 5) + (signIns × 1) + (emailVerifications × 2) + (socialSignIns × 3)

Notes

This endpoint provides real-time credit analysis and is free to use (does not consume credits).
This endpoint is restricted to parent accounts only. Child accounts will receive a 401 Unauthorized response.