> ## Documentation Index
> Fetch the complete documentation index at: https://apidocs.royalti.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Get User Accounting Statistics

> **Get User Accounting Statistics**

<Note>
  This endpoint requires authentication. Include your Bearer token in the Authorization header.
</Note>

## Description

**Get User Accounting Statistics**

Retrieve detailed accounting statistics for a specific user, including royalty shares,
amounts paid and due. Optionally includes detailed royalty summary data.

**Method:** GET

**Path Parameters:**

| Parameter | Type   | Description       |
| --------- | ------ | ----------------- |
| id        | string | The TenantUser ID |

**Query Parameters:**

| Parameter    | Type    | Description                                                            |
| ------------ | ------- | ---------------------------------------------------------------------- |
| include      | string  | Include additional data (e.g., 'royalty' for detailed royalty summary) |
| forceRefresh | boolean | Force recalculation even if cached data exists                         |

## Code Examples

<CodeGroup>
  ```javascript Node.js theme={null}
  const response = await fetch('https://api.royalti.io/accounting/example-id/stats', {
    method: 'GET',
    headers: {
      'Authorization': `Bearer ${token}`,
    },
  });

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

  ```python Python theme={null}
  import requests

  response = requests.get(
    'https://api.royalti.io/accounting/example-id/stats',
    headers={
      'Authorization': f'Bearer {token}'
    },
  )

  data = response.json()
  print(data)
  ```

  ```bash cURL theme={null}
  curl -X GET https://api.royalti.io/accounting/example-id/stats \
    -H "Authorization: Bearer YOUR_TOKEN" \

  ```
</CodeGroup>


## OpenAPI

````yaml get /accounting/{id}/stats
openapi: 3.0.0
info:
  title: Royalti.io API
  description: "# Royalti API\r\n\r\nThis is the Royalti music royalty management platform API server.\r\n\r\n## Overview\r\n\r\nThe Royalti API provides comprehensive music royalty management services including:\r\n- Music publishing and writer management\r\n- Royalty processing and analytics\r\n- DDEX integration for music industry standards\r\n- File processing and pattern recognition\r\n- Payment processing and distribution\r\n\r\n## Authentication\r\n\r\nThe API uses JWT-based authentication with multiple protection levels:\r\n- Public endpoints for basic operations\r\n- Protected endpoints requiring valid JWT tokens\r\n- Admin endpoints for administrative functions\r\n\r\n## Features\r\n\r\n- Multi-dimensional royalty analytics\r\n- CWR (Collective Works Registration) support\r\n- DDEX integration for music metadata\r\n- Advanced file processing with pattern recognition\r\n- Real-time data processing with queue system"
  version: 2.6.0
  contact:
    name: Royalti.io Support
    email: support@royalti.io
    url: https://royalti.io
  license:
    name: Proprietary
    url: https://royalti.io/terms
servers:
  - url: https://api.royalti.io
    description: Production server
  - url: https://api-dev.royalti.io
    description: Development server
  - url: http://localhost:8084
    description: Local development
security:
  - bearerAuth: []
tags:
  - name: Accounting
    description: Accounting and financial transaction operations
  - name: DDEX
    description: DDEX operations (ERN/MEAD, messages, delivery, providers)
  - name: Label
    description: Label management operations
  - name: Internal Webhooks
    description: Internal system webhooks for royalty processing and downloads
  - name: Payment Webhooks
    description: Payment processor webhook endpoints
  - name: Billing Webhooks
    description: Stripe billing and subscription webhooks
  - name: Infrastructure Webhooks
    description: Cloudflare domain and SSL webhooks
  - name: Distribution Webhooks
    description: Digital distribution platform webhooks (FUGA)
paths:
  /accounting/{id}/stats:
    get:
      tags:
        - Accounting
      summary: Get User Accounting Statistics
      description: >-
        **Get User Accounting Statistics**


        Retrieve detailed accounting statistics for a specific user, including
        royalty shares,

        amounts paid and due. Optionally includes detailed royalty summary data.


        **Method:** GET


        **Path Parameters:**

        | Parameter | Type | Description |

        | --- | --- | --- |

        | id | string | The TenantUser ID |


        **Query Parameters:**

        | Parameter | Type | Description |

        | --- | --- | --- |

        | include | string | Include additional data (e.g., 'royalty' for
        detailed royalty summary) |

        | forceRefresh | boolean | Force recalculation even if cached data
        exists |
      parameters:
        - name: id
          in: path
          required: true
          description: TenantUser ID
          schema:
            type: string
            format: uuid
        - name: include
          in: query
          required: false
          description: >-
            Include additional data (use 'royalty' for detailed royalty
            breakdown)
          schema:
            type: string
            enum:
              - royalty
          example: royalty
        - name: forceRefresh
          in: query
          required: false
          description: Force recalculation even if cached data exists
          schema:
            type: boolean
            default: false
      responses:
        '200':
          description: User accounting statistics retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  Royalty_Share:
                    type: number
                    format: float
                    description: Total royalty share amount for this user
                    example: 1135.28
                  paid:
                    type: number
                    format: float
                    description: Amount already paid to the user
                    example: 100
                  due:
                    type: number
                    format: float
                    description: Amount currently due to the user
                    example: 1035.28
                  royaltySummary:
                    type: object
                    description: Detailed royalty breakdown (included when include=royalty)
                    nullable: true
                  metadata:
                    type: object
                    description: Calculation metadata from enhanced accounting calculator
                    nullable: true
                    properties:
                      calculationMethod:
                        type: string
                        enum:
                          - simple
                          - enhanced
                          - cached
                        description: Method used for calculation
                        example: enhanced
                      lastCalculatedAt:
                        type: string
                        format: date-time
                        description: When this calculation was performed
                        example: '2024-08-11T10:30:00Z'
                      simpleSplitsPercentage:
                        type: number
                        format: float
                        description: Percentage of splits that are simple (no conditions)
                        example: 75.5
                      calculationTime:
                        type: number
                        description: Time taken for calculation in milliseconds
                        example: 234
                      simpleSplitsEarnings:
                        type: number
                        format: float
                        description: Earnings from simple splits
                        example: 850
                      complexSplitsEarnings:
                        type: number
                        format: float
                        description: Earnings from conditional/temporal splits
                        example: 285.28
              examples:
                basic:
                  summary: Basic statistics
                  value:
                    Royalty_Share: 1135.28
                    paid: 100
                    due: 1035.28
                withMetadata:
                  summary: With enhanced calculation metadata
                  value:
                    Royalty_Share: 1135.28
                    paid: 100
                    due: 1035.28
                    metadata:
                      calculationMethod: enhanced
                      lastCalculatedAt: '2024-08-11T10:30:00Z'
                      simpleSplitsPercentage: 75.5
                      calculationTime: 234
                      simpleSplitsEarnings: 850
                      complexSplitsEarnings: 285.28
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/ServerError'
      security:
        - bearerAuth: []
components:
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: error
              message:
                type: string
                example: Invalid request parameters
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: error
              message:
                type: string
                example: Unauthorized
    NotFound:
      description: Not found
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: error
              message:
                type: string
                example: Resource not found
    ServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            details:
              type: array
              items:
                type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT Authorization header using the Bearer scheme. Format: "Bearer
        {token}"

````