Skip to main content
The @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

npm install @royaltyport/sdk

Quick Start

1

Install the SDK

npm install @royaltyport/sdk
2

Create a client

import { Royaltyport } from '@royaltyport/sdk';

const royaltyport = new Royaltyport({
  apiKey: 'rp_your_token_here',
});
3

Make your first request

const { data: projects } = await royaltyport.projects.list();

for (const project of projects) {
  console.log(project.name);
}

Configuration

The Royaltyport constructor accepts a configuration object:
import { Royaltyport } from '@royaltyport/sdk';

const royaltyport = new Royaltyport({
  apiKey: 'rp_your_token_here',
  baseUrl: 'https://api.royaltyport.com', // optional
});
ParameterTypeRequiredDefaultDescription
apiKeystringYesAPI token (rp_ prefix) or OAuth access token
baseUrlstringNohttps://api.royaltyport.comCustom API base URL
fetchfunctionNoglobalThis.fetchCustom fetch implementation for testing or proxying

Response Format

All methods return a response object containing the data and rate limit information:
const response = await royaltyport.projects.list();

console.log(response.data);      // the requested data
console.log(response.rateLimit);  // { limit: 100, remaining: 99, reset: 1711929600 }
FieldDescription
dataThe response payload (type varies by method)
rateLimit.limitMaximum requests allowed per window
rateLimit.remainingRequests remaining in the current window
rateLimit.resetUnix timestamp when the window resets

Automatic Retries

The SDK automatically retries requests that fail with 429 (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.