> ## Documentation Index
> Fetch the complete documentation index at: https://docs.royaltyport.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Compositions

> List and retrieve compositions for a project with the SDK.

## list()

Returns a paginated list of compositions for a project.

### Signature

```js theme={null}
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

```js theme={null}
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

```js theme={null}
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

```js theme={null}
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);
```

<Note>
  The `products` array only appears when `includeProducts` is set to `true`.
</Note>
