> ## 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 Current Due Amount

> **Get Current Due Amount**

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

## Description

**Get Current Due Amount**

Retrieve a list of users with their current due amounts (excluding the tenant owner).
Supports pagination and sorting by various accounting fields.

**Method:** GET

**Query Parameters:**

| Parameter | Type    | Description                             |
| --------- | ------- | --------------------------------------- |
| q         | string  | Search query to filter users by name    |
| page      | integer | Page number for pagination (default: 1) |
| size      | integer | Number of items per page (default: 10)  |
| sort      | string  | Field to sort by (default: due)         |
| order     | string  | Sort order: ASC or DESC (default: DESC) |

**Sortable Fields:**

* `gross` - Total gross earnings
* `net` - Net earnings after deductions
* `paid` - Amount already paid
* `due` - Amount currently due (default)
* `lastCalculatedAt` - When accounting was last calculated

## Code Examples

<CodeGroup>
  ```javascript Node.js theme={null}
  const response = await fetch('https://api.royalti.io/accounting/getcurrentdue', {
    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/getcurrentdue',
    headers={
      'Authorization': f'Bearer {token}'
    },
  )

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

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

  ```
</CodeGroup>


## OpenAPI

````yaml get /accounting/getcurrentdue
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/getcurrentdue:
    get:
      tags:
        - Accounting
      summary: Get Current Due Amount
      description: >-
        **Get Current Due Amount**


        Retrieve a list of users with their current due amounts (excluding the
        tenant owner).

        Supports pagination and sorting by various accounting fields.


        **Method:** GET


        **Query Parameters:**

        | Parameter | Type | Description |

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

        | q | string | Search query to filter users by name |

        | page | integer | Page number for pagination (default: 1) |

        | size | integer | Number of items per page (default: 10) |

        | sort | string | Field to sort by (default: due) |

        | order | string | Sort order: ASC or DESC (default: DESC) |


        **Sortable Fields:**

        - `gross` - Total gross earnings

        - `net` - Net earnings after deductions  

        - `paid` - Amount already paid

        - `due` - Amount currently due (default)

        - `lastCalculatedAt` - When accounting was last calculated
      parameters:
        - name: q
          in: query
          required: false
          description: Search query to filter users by name or nickname
          schema:
            type: string
          example: John
        - name: page
          in: query
          required: false
          description: Page number for pagination
          schema:
            type: integer
            default: 1
            minimum: 1
          example: 1
        - name: size
          in: query
          required: false
          description: Number of items per page
          schema:
            type: integer
            default: 10
            minimum: 1
            maximum: 100
          example: 10
        - name: sort
          in: query
          required: false
          description: Field to sort by
          schema:
            type: string
            enum:
              - gross
              - net
              - paid
              - due
              - lastCalculatedAt
            default: due
          example: due
        - name: order
          in: query
          required: false
          description: Sort order
          schema:
            type: string
            enum:
              - ASC
              - DESC
            default: DESC
          example: DESC
      responses:
        '200':
          description: Current due amounts list retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: success
                  Users:
                    type: array
                    description: Array of users with accounting data
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          format: uuid
                          description: User ID
                        firstName:
                          type: string
                          description: User's first name
                          example: John
                        lastName:
                          type: string
                          description: User's last name
                          example: Doe
                        fullName:
                          type: string
                          description: User's full name
                          example: John Doe
                        email:
                          type: string
                          format: email
                          description: User's email address
                          example: john.doe@example.com
                        country:
                          type: string
                          description: User's country
                          example: US
                        TenantUserId:
                          type: string
                          format: uuid
                          description: TenantUser ID
                        Gross:
                          type: number
                          format: float
                          description: Total gross earnings (capitalized)
                          example: 1500.5
                        Net:
                          type: number
                          format: float
                          description: Net earnings after deductions (capitalized)
                          example: 1350.45
                        Paid:
                          type: number
                          format: float
                          description: Amount already paid (capitalized)
                          example: 1000
                        Due:
                          type: number
                          format: float
                          description: Amount currently due (capitalized)
                          example: 350.45
                        paymentRequested:
                          type: boolean
                          description: Whether user has a pending payment request
                          example: false
                        paymentRequestId:
                          type: string
                          nullable: true
                          description: Payment request ID if exists
                          example: null
                        metadata:
                          type: object
                          properties:
                            lastCalculatedAt:
                              type: string
                              format: date-time
                              description: When accounting was last calculated
                              example: '2024-08-11T10:30:00Z'
                            calculationMethod:
                              type: string
                              enum:
                                - cached
                                - bigquery
                                - hybrid
                              description: Method used for calculation
                              example: cached
                  totalUsers:
                    type: integer
                    description: Total number of users available
                    example: 125
                  count:
                    type: integer
                    description: Number of users returned in this page
                    example: 10
                  page:
                    type: integer
                    description: Current page number
                    example: 1
                  totalPages:
                    type: integer
                    description: Total number of pages
                    example: 13
              examples:
                defaultSort:
                  summary: Default sorting (due DESC)
                  value:
                    message: success
                    Users:
                      - id: 789e0123-e89b-12d3-a456-426614174002
                        firstName: John
                        lastName: Doe
                        fullName: John Doe
                        email: john.doe@example.com
                        country: US
                        TenantUserId: 456e7890-e89b-12d3-a456-426614174001
                        Gross: 2500.75
                        Net: 2250.68
                        Paid: 1500
                        Due: 750.68
                        paymentRequested: false
                        paymentRequestId: null
                        metadata:
                          lastCalculatedAt: '2024-08-11T10:30:00Z'
                          calculationMethod: cached
                    totalUsers: 125
                    count: 1
                    page: 1
                    totalPages: 13
                grossSort:
                  summary: Sorting by gross earnings (gross ASC)
                  value:
                    message: success
                    Users:
                      - id: 321e0987-e89b-12d3-a456-426614174005
                        firstName: Jane
                        lastName: Smith
                        fullName: Jane Smith
                        email: jane.smith@example.com
                        country: CA
                        TenantUserId: 654e3210-e89b-12d3-a456-426614174004
                        Gross: 125.5
                        Net: 112.95
                        Paid: 0
                        Due: 112.95
                        paymentRequested: true
                        paymentRequestId: payment-req-123
                        metadata:
                          lastCalculatedAt: '2024-08-10T15:45:00Z'
                          calculationMethod: bigquery
                    totalUsers: 125
                    count: 1
                    page: 1
                    totalPages: 13
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  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}"

````