@royaltyport/sdk is the official Node.js client for the Royaltyport API. It provides access to projects, contracts, catalog data, CRM records, statements, and cross-resource search with built-in pagination, error handling, and automatic retries.
The SDK is written in TypeScript and ships with full type definitions — you get autocomplete and type checking out of the box.
Requirements
- Node.js >= 18.0.0
Installation
Quick Start
Configuration
TheRoyaltyport constructor accepts a configuration object:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
apiKey | string | Yes | — | API token (rp_ prefix) or OAuth access token |
baseUrl | string | No | https://api.royaltyport.com | Custom API base URL |
fetch | function | No | globalThis.fetch | Custom fetch implementation for testing or proxying |
Response Format
All methods return a response object containing the data and rate limit information:| Field | Description |
|---|---|
data | The response payload (type varies by method) |
rateLimit.limit | Maximum requests allowed per window |
rateLimit.remaining | Requests remaining in the current window |
rateLimit.reset | Unix timestamp when the window resets |
Automatic Retries
The SDK automatically retries requests that fail with429 (rate limit) or 5xx (server error) status codes, up to 3 times with exponential backoff. No configuration is needed.
Available Resources
Authentication
API tokens, OAuth tokens, and environment variables.
Error Handling
Error classes, retry behavior, and status codes.
Pagination
Paginated results and iteration patterns.
Projects
List and retrieve projects.
Artists
List and retrieve artists.
Writers
List and retrieve writers.
Recordings
List and retrieve recordings.
Compositions
List and retrieve compositions.
Entities
List and retrieve entities.
Relations
List and retrieve relations.
Contracts
List, retrieve, upload, download, and track contracts.
Statements
List, retrieve, upload, download, and track statements.
Search
Search across all resource types in a project.