Skip to main content
GET
/
accounting
/
gettotaldue
Get Total Due Amount
curl --request GET \
  --url https://server26-dot-royalti-project.uc.r.appspot.com/accounting/gettotaldue \
  --header 'Authorization: Bearer <token>'
{
"message": "success",
"totalGross": 150000.5,
"totalPaid": 100000,
"totalDue": 50000.5,
"userCount": 125,
"metadata": {
"calculationMethod": "cached",
"calculationTime": 45,
"dataAvailability": "complete",
"fallbackReason": null
}
}
Get Total Due Amount Retrieve the total amount due across all tenant users (excluding the tenant owner). This endpoint now supports multiple calculation methods for optimal performance:
  • cache: Uses the UserAccounting table cache for fast retrieval (10-50ms)
  • bigquery: Uses BigQuery for comprehensive calculation (500-2000ms)
  • auto: Automatically tries cache first, falls back to BigQuery if needed (default)
Performance Note: The cache method provides 95% faster response times compared to BigQuery, making it ideal for real-time dashboards and frequent queries. Method: GET Query Parameters:
ParameterTypeDescription
methodstringCalculation method to use (cache, bigquery, auto)

Authentication

This endpoint requires authentication. Include your bearer token in the Authorization header.

Query Parameters

ParameterTypeInRequiredDescription
methodstringqueryCalculation method to use for retrieving totals

Responses

✅ 200 - Total due amount retrieved successfully

cachedResponse

{
  "message": "success",
  "totalGross": 150000.5,
  "totalPaid": 100000,
  "totalDue": 50000.5,
  "userCount": 125,
  "metadata": {
    "calculationMethod": "cached",
    "calculationTime": 45,
    "dataAvailability": "complete",
    "fallbackReason": null
  }
}

bigqueryResponse

{
  "message": "success",
  "totalGross": 150000.5,
  "totalPaid": 100000,
  "totalDue": 50000.5,
  "userCount": 125,
  "metadata": {
    "calculationMethod": "bigquery",
    "calculationTime": 1523,
    "dataAvailability": "complete",
    "fallbackReason": "cache-failed-or-requested"
  }
}

⚠️ 400 - undefined

⚠️ 401 - undefined

❌ 500 - undefined

Tags

Accounting

Authorizations

Authorization
string
header
required

JWT Authorization header using the Bearer scheme. Format: "Bearer {token}"

Query Parameters

method
enum<string>
default:auto

Calculation method to use for retrieving totals

Available options:
cache,
bigquery,
auto

Response

Total due amount retrieved successfully

message
string
Example:

"success"

totalGross
number

Total gross earnings across all users

Example:

150000.5

totalPaid
number

Total amount already paid to users

Example:

100000

totalDue
number

Total amount currently due to users

Example:

50000.5

userCount
integer

Number of users included in the calculation

Example:

125

metadata
object

Additional information about the calculation

I