Skip to main content

Overview

Upload royalty files and let the API automatically detect the source (Spotify, Apple Music, etc.), accounting period, and file schema. The system uses intelligent pattern matching to identify files and provides confidence scores so you know when to review manually versus auto-process.

Key Features

  • Automatic source detection from filename and content patterns
  • Confidence scoring (0-1 scale) for detection accuracy
  • Period extraction from filenames like spotify_2024-01.csv
  • Manual confirmation workflow for low-confidence matches
  • Auto-processing for trusted sources with high confidence
  • Real-time status polling to track detection progress

Prerequisites

Authentication

All requests require a valid API token:

Quick Start

1

Request Upload URL

Get a pre-signed URL for uploading your file with detection enabled.
Node.js
Save the sessionId - you’ll need it to check detection status.
2

Upload File

Upload your file to the signed URL using a PUT request.
Node.js
The detection process starts automatically after upload completes.
3

Check Detection Status

Poll the detection endpoint to get results.
Node.js
Files with confidence scores above 0.8 can be auto-processed if you enable that feature. See Auto-Processing Configuration below.

Understanding Confidence Scores

The API returns three confidence scores for each file:

Confidence Levels

What it means: Detection is highly reliableAction: File can be auto-processedExample:

Dual-Period Sources

Some royalty sources (like Merlin aggregator sources) require both a sale period and an accounting period. These are called “dual-period sources.”

How to Identify Dual-Period Sources

When you upload a file, check the detection response for requiresAccountingPeriod:
When requiresAccountingPeriod: true, you must provide both accountingPeriod and salePeriod when confirming. The system will block auto-processing until both periods are provided.

Common Dual-Period Sources

Understanding Sale Period vs Accounting Period

For most files, these periods are the same. But some distributors report sales with a delay, so the accounting period may be different from the sale period.

Detection Workflow

Polling for Detection Results

Detection typically completes within 2-10 seconds. Poll every 2 seconds until status is detected:

Detection Response Format

Key Response Fields


Confirming Detection

When to Confirm Manually

Manual confirmation is required when:
  • Any confidence score < 0.8
  • Auto-processing is disabled
  • You want to review before processing
  • Detection identified an unexpected source
  • Dual-period sources require both accountingPeriod and salePeriod

Confirmation Endpoints

There are two endpoints for confirming detection:

Option 1: Quick Confirmation (by Source ID)

Use this when you have the source UUID and want simple confirmation.
The confirm: true flag is required to trigger processing. Without it, the file is marked for manual review but not processed.

Option 2: Full Confirmation (by Source Name)

Use this for the complete workflow with correction tracking and learning.
This endpoint also:
  • Records corrections if you change detected values (for learning)
  • Tracks period mapping corrections (salePeriod vs accountingPeriod)
  • Updates cloud storage metadata
  • Supports ZIP file confirmations

Getting Source ID

You need the source ID to confirm detection. Retrieve it from the sources endpoint:
Node.js

Monitoring Processing

After confirmation, track processing progress:

Processing Status Values


Auto-Processing

Enable auto-processing to automatically process files with high confidence scores.

Enable Auto-Processing

Set thresholds carefully. Higher thresholds (0.9+) are safer but require more manual confirmations. Start with 0.85 and adjust based on accuracy.

Check Auto-Processing Config

Node.js

Complete Example

Here’s a full workflow from upload to processing:

Best Practices

File Naming

Use consistent naming for better detection accuracy:
Pattern: {source}_{period}.{ext}

Error Handling

Always handle errors gracefully:
Node.js

Timeout Handling

Don’t poll indefinitely:
Node.js

Troubleshooting

Problem: Detection confidence is consistently below 0.8Solutions:
  • Use standard filename format: {source}_{period}.{ext}
  • Ensure column headers match expected schema
  • Check file isn’t corrupted or empty
  • Contact support to create custom patterns for your files
Problem: Error “Detection session expired after 24 hours”Solutions:
  • Process files within 24 hours of upload
  • Enable auto-processing for faster handling
  • Re-upload the file to create a new session
Problem: System detects incorrect sourceSolutions:
  • Check filename doesn’t contain misleading keywords
  • Manually confirm with correct source ID
  • Contact support to improve detection patterns for your file format
Problem: Job never progresses from waiting to activeSolutions:
  • Check queue health (if you have admin access)
  • Wait up to 5 minutes during high load
  • Contact support if stuck longer than 10 minutes

API Reference

Related endpoints:

Next Steps


Support

Need help? Contact us: