> ## 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.

# List Tenant Sources

> Retrieves a paginated list of all sources associated with the current tenant.

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

## Description

### Required Permissions

* `sources:read`

### Query Parameters Behavior

**distinct=false (default)**: Returns paginated tenant source associations

* Response format: `{ count: number, rows: TenantSource[] }`
* Shows tenant's configured sources with settings and replacements
* Respects pagination parameters

**distinct=true**: Returns array of all available public sources

* Response format: `RoyaltySource[]` (direct array, not paginated)
* Shows all public sources available to add (not just tenant's sources)
* Only includes sources where `isActive=true` and `public=true`
* Pagination parameters are ignored

### Business Rules

* Only shows active sources (`isActive=true`)
* Tenant context automatically determined from authentication

## Code Examples

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

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

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

  ```
</CodeGroup>


## OpenAPI

````yaml get /sources
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:
  /sources:
    get:
      tags:
        - Sources
      summary: List Tenant Sources
      description: >-
        Retrieves a paginated list of all sources associated with the current
        tenant.


        ### Required Permissions

        - `sources:read`


        ### Query Parameters Behavior


        **distinct=false (default)**: Returns paginated tenant source
        associations

        - Response format: `{ count: number, rows: TenantSource[] }`

        - Shows tenant's configured sources with settings and replacements

        - Respects pagination parameters


        **distinct=true**: Returns array of all available public sources

        - Response format: `RoyaltySource[]` (direct array, not paginated)

        - Shows all public sources available to add (not just tenant's sources)

        - Only includes sources where `isActive=true` and `public=true`

        - Pagination parameters are ignored


        ### Business Rules

        - Only shows active sources (`isActive=true`)

        - Tenant context automatically determined from authentication
      parameters:
        - name: page
          in: query
          required: false
          description: Page number for pagination (ignored when distinct=true)
          schema:
            type: integer
            default: 1
            example: 1
        - name: size
          in: query
          required: false
          description: Page size for pagination (ignored when distinct=true)
          schema:
            type: integer
            default: 100
            example: 100
        - name: distinct
          in: query
          required: false
          description: >
            If 'true', returns array of all available public sources
            (non-paginated).

            If 'false', returns paginated tenant source associations.
          schema:
            type: string
            enum:
              - 'true'
              - 'false'
            default: 'false'
      responses:
        '200':
          description: List of tenant sources
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedTenantSources'
              example:
                count: 1
                rows:
                  - id: ts-1
                    settings: {}
                    replacements: {}
                    royaltySource:
                      id: src-1
                      name: Spotify
                      label: Spotify
                      type: DSP
                      format: csv
                      public: true
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
        - bearerAuth: []
components:
  schemas:
    PaginatedTenantSources:
      type: object
      properties:
        count:
          type: integer
          example: 1
        rows:
          type: array
          items:
            $ref: '#/components/schemas/TenantSource'
    TenantSource:
      type: object
      description: |-
        Association between a tenant and a royalty source.
        Note: The composite key is (TenantId, RoyaltySourceId).
      properties:
        TenantId:
          type: integer
          description: Tenant ID (automatically set from authenticated user)
          example: 1
        RoyaltySourceId:
          type: string
          description: Royalty source ID
          example: src-1
        isActive:
          type: boolean
          description: Whether this source association is active for the tenant
          default: true
          example: true
        settings:
          type: object
          description: Tenant-specific settings for this source
          example: {}
        replacements:
          type: object
          description: Tenant-specific field replacements/mappings
          example: {}
        royaltySource:
          $ref: '#/components/schemas/RoyaltySource'
    RoyaltySource:
      type: object
      properties:
        id:
          type: string
          example: src-1
        name:
          type: string
          description: Source name (automatically normalized to lowercase)
          example: spotify
        label:
          type: string
          description: Display label for the source
          example: Spotify
        type:
          type: string
          description: Source type (e.g., DSP, Publisher, Label)
          example: DSP
        format:
          type: string
          description: File format (csv, excel, json, etc.)
          example: csv
        public:
          type: boolean
          description: Whether this source is publicly available to all tenants
          example: true
        isActive:
          type: boolean
          description: Whether this source is currently active
          default: true
          example: true
        startDate:
          type: string
          format: date
          nullable: true
          description: Start date for source availability
          example: '2020-01-01'
        endDate:
          type: string
          format: date
          nullable: true
          description: End date for source availability
          example: '2025-01-01'
        dataQuery:
          type: object
          nullable: true
          description: JSONB object containing query configurations
          example:
            type: bigquery
            dataset: royalty_data
        fileNameFormat:
          type: string
          nullable: true
          description: >
            Template for expected file name format with period placeholders.

            Placeholders: {SALPER-FORMAT} (sale period), {ACCPER-FORMAT}
            (accounting period)

            Formats: YYYYMM, YYYY-MM, YYYY-MM-DD, MMM-YYYY, etc.
          example: '{ORG}_Snap_{SALPER-YYYYMM}_Monthly-Sales.csv'
        schema:
          type: string
          nullable: true
          description: Text representation of the file schema/structure
          example: artist_name,track_name,streams,revenue
        delimiter:
          type: string
          nullable: true
          description: Field delimiter for CSV files
          example: ','
        tableNameFormat:
          type: string
          nullable: true
          description: >-
            Template for BigQuery table name with period placeholders (SALPER,
            ACCPER)
          example: merlin_snap_SALPER_ACCPER
        columnFormat:
          type: string
          nullable: true
          description: >
            DSL for column semantic mappings. Defines how columns map to period
            types and formats.

            Format: ColumnName:TYPE-FORMAT;ColumnName2:TYPE-FORMAT;...

            Types: SALPER (sale period), ACCPER (accounting period), ISRC, UPC,
            CATNO, etc.

            Formats: YYYY-MM-DD, YYYYMM, YYYY-MM, etc.
          example: Start_Date:SALPER-YYYY-MM-DD;ISRC:ISRC
        headerRows:
          type: integer
          nullable: true
          description: Number of header rows to skip
          example: 1
        fileInfo:
          type: object
          nullable: true
          description: Additional file metadata and configuration
  responses:
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: error
              message:
                type: string
                example: Unauthorized
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: error
              message:
                type: string
                example: Internal server error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT Authorization header using the Bearer scheme. Format: "Bearer
        {token}"

````