Skip to main content

list()

Returns a paginated list of statements for a project.

Signature

royaltyport.statements.list(projectId, options?)

Parameters

ParameterTypeRequiredDefaultDescription
projectIdstringYesThe project ID
options.pagenumberNo1Page number
options.perPagenumberNo20Items per page (max: 100)

Example

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

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

const { data } = await royaltyport.statements.list('project-id', {
  perPage: 50,
});

for (const statement of data.items) {
  console.log(`${statement.file_name}${statement.status}`);
}

get()

Returns a single statement by ID.

Signature

royaltyport.statements.get(projectId, statementId)

Parameters

ParameterTypeRequiredDescription
projectIdstringYesThe project ID
statementIdnumberYesThe statement ID

Example

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

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

const { data: statement } = await royaltyport.statements.get('project-id', 456);

console.log(statement.file_name);
console.log('Status:', statement.status);
console.log('Currency:', statement.currency);

upload()

Uploads a statement PDF to a project. The file is stored and queued for processing.

Signature

royaltyport.statements.upload(projectId, file, options?)

Parameters

ParameterTypeRequiredDefaultDescription
projectIdstringYesThe project ID
fileBuffer, Uint8Array, Blob, or stringYesThe file to upload. Pass a file path as a string to read from disk.
options.fileNamestringNoInferred from path or upload.pdfThe file name
options.fileTypestringNoapplication/pdfMIME type
options.onProgressfunctionNoUpload progress callback

Examples

Upload from file path:
import { Royaltyport } from '@royaltyport/sdk';

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

const { data } = await royaltyport.statements.upload('project-id', './statement.pdf');

console.log(`Staging ID: ${data.staging_id}`);
console.log(`Stage: ${data.staging_stage}`);
Upload with progress tracking:
import { Royaltyport } from '@royaltyport/sdk';

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

const { data } = await royaltyport.statements.upload('project-id', './statement.pdf', {
  onProgress: (event) => {
    console.log(`Upload progress: ${event.percent}%`);
  },
});
The onProgress callback receives an object with bytesUploaded, bytesTotal, and percent fields. Upload from Buffer:
import { readFileSync } from 'node:fs';
import { Royaltyport } from '@royaltyport/sdk';

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

const buffer = readFileSync('./statement.pdf');

const { data } = await royaltyport.statements.upload('project-id', buffer, {
  fileName: 'Q4-2025-statement.pdf',
});

download()

Returns a pre-signed download URL for a statement file.

Signature

royaltyport.statements.download(projectId, statementId)

Parameters

ParameterTypeRequiredDescription
projectIdstringYesThe project ID
statementIdnumberYesThe statement ID

Example

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

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

const { data } = await royaltyport.statements.download('project-id', 456);

console.log('Download URL:', data.url);
console.log('Expires:', data.expires_at);

processes()

Returns the processing status for a statement, including staging and processing progress.

Signature

royaltyport.statements.processes(projectId, statementId)

Parameters

ParameterTypeRequiredDescription
projectIdstringYesThe project ID
statementIdnumberYesThe statement ID

Example

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

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

const { data: status } = await royaltyport.statements.processes('project-id', 456);

console.log('Staging done:', status.staging_done);
console.log('Processing done:', status.processing_done);
console.log('Stage:', status.staging_processes.stage);