Skip to main content
GET
https://api.authiqa.com
/
parent
/
billing-history
Billing History
curl --request GET \
  --url https://api.authiqa.com/parent/billing-history \
  --header 'Authorization: <authorization>'

Overview

This endpoint allows parent accounts to retrieve their billing history with filtering capabilities by date range and pagination support. Supports both new credit-based billing records and legacy dollar-based records for backward compatibility. This endpoint is free and does not consume credits.

API Details

Authentication

Authorization
string
required
Bearer YOUR_JWT_TOKEN

Query Parameters

startDate
string
Start date in YYYY-MM format
endDate
string
End date in YYYY-MM format
limit
number
default:"10"
Number of records (max: 100)

Try It Out

Test the API by providing your parameters:

startDate
Start date (YYYY-MM)
endDate
End date (YYYY-MM)
limit
Records per page

Code Examples

curl -X GET \
  'https://api.authiqa.com/parent/billing-history?startDate=2024-01&endDate=2024-12' \
  -H 'Authorization: Bearer YOUR_JWT_TOKEN'

Response Examples

200: Success - Credit-Based Records
{
  "success": true,
  "data": {
    "billingRecords": [
      {
        "publicKey": "pk_123",
        "monthYear": "2024-01",
        "totalUsers": 3500,
        "freeUsers": 6000,
        "billableUsers": 0,
        "retentionCreditsCharged": 0,
        "operationCreditsUsed": 1200,
        "totalCreditsUsed": 1200,
        "creditBalance": 56800,
        "timestamp": 1704067200000
      }
    ],
    "summary": {
      "totalCreditsUsed": 1200,
      "averageMonthlyCredits": 1200,
      "recordType": "credit"
    }
  }
}
200: Success - Legacy Dollar Records
{
  "success": true,
  "data": {
    "billingRecords": [
      {
        "monthYear": "2024-01",
        "totalAccounts": 5,
        "costAssociatedWithAccounts": 0.15,
        "totalIOInteractions": 1000,
        "costAssociatedWithIO": 0.25,
        "totalFinalCost": 0.40,
        "timestamp": 1704067200000
      }
    ],
    "summary": {
      "totalCost": 0.40,
      "averageMonthlySpend": 0.40,
      "recordType": "dollar"
    }
  }
}
400: Invalid Date Format
{
  "success": false,
  "error": {
    "code": "INVALID_DATE_FORMAT",
    "message": "Start date must be in YYYY-MM format"
  }
}
401: Unauthorized
{
  "success": false,
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Only parent accounts can access billing history"
  }
}

Error Codes

400 Bad Request
  • INVALID_DATE_FORMAT - Date must be in YYYY-MM format
  • INVALID_DATE_RANGE - End date cannot be before start date
  • INVALID_LIMIT - Limit must be between 1 and 100
401 Unauthorized
  • UNAUTHORIZED - Missing/invalid token
  • UNAUTHORIZED_ACCESS - Only parent accounts can access

Usage Notes

Date Range

  • Dates must be in YYYY-MM format
  • Maximum range: 12 months
  • Default: Current month if no dates provided

Pagination

  • Default limit: 10 records
  • Maximum limit: 100 records
  • Records sorted by date (newest first)

Billing Record Types

Credit-Based Records

  • Total Users: Number of child accounts
  • Free Users: Free user quota from packages
  • Billable Users: Users above free tier
  • Retention Credits: Monthly charges (1 credit per billable user)
  • Operation Credits: Credits used for operations
  • Credit Balance: Remaining credits after charges

Legacy Dollar Records

  • Account Costs: Based on number of child accounts
  • I/O Costs: Database operation costs
  • Total Cost: Combined account and operation costs
  • Backward Compatibility: For accounts created before credit system

Credit System Features

Free Operation

No Credit Cost: Billing history retrieval is completely free and does not deduct credits from your account balance.

Dual System Support

Backward Compatible: Automatically detects and displays both credit-based and legacy dollar-based billing records.