list()
Returns a paginated list of compositions for a project.
Signature
royaltyport.compositions.list(projectId, options?)
Parameters
| Parameter | Type | Required | Default | Description |
|---|
projectId | string | Yes | — | The project ID |
options.page | number | No | 1 | Page number |
options.perPage | number | No | 20 | Items per page (max: 100) |
options.includeProducts | boolean | No | false | Include product (release) data for each composition |
Example
import { Royaltyport } from '@royaltyport/sdk';
const royaltyport = new Royaltyport({
apiKey: 'rp_your_token_here',
});
const { data } = await royaltyport.compositions.list('project-id', {
perPage: 50,
includeProducts: true,
});
for (const composition of data.items) {
console.log(`${composition.name} (${composition.iswc ?? 'no ISWC'})`);
console.log(' Writers:', composition.writers.map(w => w.name).join(', '));
}
get()
Returns a single composition by ID.
Signature
royaltyport.compositions.get(projectId, compositionId, options?)
Parameters
| Parameter | Type | Required | Default | Description |
|---|
projectId | string | Yes | — | The project ID |
compositionId | number | Yes | — | The composition ID |
options.includeProducts | boolean | No | false | Include product (release) data |
Example
import { Royaltyport } from '@royaltyport/sdk';
const royaltyport = new Royaltyport({
apiKey: 'rp_your_token_here',
});
const { data: composition } = await royaltyport.compositions.get('project-id', 77);
console.log(composition.name);
console.log('ISWC:', composition.iswc);
The products array only appears when includeProducts is set to true.