Skip to main content
Most list() methods return paginated results. The SDK uses a page-based pagination model.

Pagination Options

Pass page and perPage to control pagination:
import { Royaltyport } from '@royaltyport/sdk';

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

const { data } = await royaltyport.artists.list('project-id', {
  page: 1,
  perPage: 50,
});
OptionTypeDefaultDescription
pagenumber1Page number (1-indexed)
perPagenumber20Items per page (max: 100)

Paginated Result

Paginated responses include the items and metadata for navigating pages:
FieldTypeDescription
itemsarrayThe items on the current page
total_countnumberTotal number of items across all pages
pagenumberCurrent page number
per_pagenumberItems per page
import { Royaltyport } from '@royaltyport/sdk';

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

const { data } = await royaltyport.artists.list('project-id');

console.log(data.items);       // the artists on this page
console.log(data.total_count); // 150
console.log(data.page);        // 1
console.log(data.per_page);    // 20

Iterating All Pages

To fetch all items across pages:
import { Royaltyport } from '@royaltyport/sdk';

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

const allArtists = [];
let page = 1;
const perPage = 100;

while (true) {
  const { data } = await royaltyport.artists.list('project-id', { page, perPage });
  allArtists.push(...data.items);

  if (allArtists.length >= data.total_count) break;
  page++;
}

console.log(`Fetched ${allArtists.length} artists`);
The projects.list() method returns an array directly (not paginated), since projects are typically few.