Skip to main content
GET
/
accounting
/
refreshstats
Refresh Stats and Accounting Pipeline (Async)
curl --request GET \
  --url https://api.royalti.io/accounting/refreshstats \
  --header 'Authorization: Bearer <token>'
{
  "message": "Stats and accounting refresh queued successfully",
  "flowId": "flow-uuid-789",
  "tenantId": 123,
  "status": "queued",
  "info": {
    "triggeredBy": "manual",
    "executionOrder": "Product Stats → Asset Stats → Artist Stats → Accounting",
    "deduplication": "enabled",
    "delay": "0ms"
  }
}
This endpoint requires authentication. Include your Bearer token in the Authorization header.

Description

Refresh Stats and Accounting Pipeline Queue a comprehensive stats and accounting refresh pipeline using BullMQ. This operation triggers an asynchronous workflow that updates product, asset, and artist statistics followed by accounting recalculation. Method: GET Note: This operation is asynchronous and returns immediately with a flow ID for tracking. The actual processing happens in the background via BullMQ queues. Pipeline Steps:
  1. Product stats queue
  2. Asset stats queue
  3. Artist stats queue
  4. Accounting queue
All steps are deduplicated to prevent redundant processing.

Code Examples

const response = await fetch('https://api.royalti.io/accounting/refreshstats', {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${token}`,
  },
});

const data = await response.json();
console.log(data);

Authorizations

Authorization
string
header
required

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

Response

Stats and accounting refresh queued successfully

message
string
Example:

"Stats and accounting refresh queued successfully"

flowId
string

BullMQ flow ID for tracking the pipeline

Example:

"flow-uuid-789"

tenantId
integer

The tenant ID for which refresh was queued

Example:

123

status
enum<string>
Available options:
queued
Example:

"queued"

info
object