Skip to main content
The search() method lives on the Royaltyport client directly (not on a resource accessor). It searches across recordings, compositions, contracts, entities, artists, and writers in a single request.

Signature

royaltyport.search(projectId, query)

Parameters

ParameterTypeRequiredDescription
projectIdstringYesThe project to search within
querystringYesThe search term

Example

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

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

const { data: results } = await royaltyport.search('project-id', 'Sony');

console.log(`Found ${results.entities.length} entities`);
console.log(`Found ${results.artists.length} artists`);
console.log(`Found ${results.contracts.length} contracts`);

for (const match of results.entities) {
  console.log(`${match.name} (rank: ${match.rank})`);
  console.log('  Matched keywords:', match.matched_keywords.join(', '));
  console.log('  Metadata match:', match.is_metadata_match);
}

Response

The result contains arrays of matches grouped by resource type: recordings, compositions, contracts, entities, artists, and writers. Each match includes:
FieldTypeDescription
idnumberThe resource ID
namestringThe resource name
matched_keywordsstring[]Keywords from the query that matched
is_metadata_matchbooleanWhether the match was found in metadata
ranknumberRelevance ranking score