CDPGuidesSupport
SDKsPlatform

Node.js SDK (platform)

Install and use the Ours Privacy Node.js platform SDK to manage sources, destinations, consent settings, and more from your server-side code.

Use this page to install the Ours Privacy Node.js platform SDK (@oursprivacy/platform-sdk) and make your first call. The SDK is fully typed and runs on Node.js 20 or later.


Installation

npm install @oursprivacy/platform-sdk

Usage

Create a Platform API key and set it as OURS_PRIVACY_API_KEY. The client reads that variable by default.

import OursPrivacyPlatform from '@oursprivacy/platform-sdk';

const client = new OursPrivacyPlatform({
  apiKey: process.env['OURS_PRIVACY_API_KEY'], // This is the default and can be omitted
});

const page = await client.sources.list();

for (const source of page.entities) {
  console.log(source.id, source.name);
}

Pagination

List methods return one page at a time, with the results in entities. To walk every page, iterate the list call directly:

for await (const source of client.sources.list()) {
  console.log(source.id, source.name);
}

Next Steps

How is this guide?

On this page