Install the SDK

Add platic-sdk to a Node.js project and make a first call with your API key.

Before you start

  • Node.js 20.3 or newer.
  • A server to run the SDK. The API key is sent with every request; the SDK does not start in a browser to keep it from being exposed (see The client).
  • An API key (pl_key_…) or an OAuth access token (pl_at_…). Create a key in API keys and read Authentication.
  1. npm install platic-sdk

    pnpm and yarn work the same way: pnpm add platic-sdk, yarn add platic-sdk.

  2. export PLATIC_API_KEY=pl_key_...

    Never put the key in your code or in a repository.

  3. import { Platic } from "platic-sdk";
    
    const platic = new Platic({ apiKey: process.env.PLATIC_API_KEY! });
    
    const { data } = await platic.agents.list({ limit: 5 });
    console.log(data.map((agent) => agent.name));

Check it worked

The script prints a list of agent names (an empty list if the workspace has none). A wrong key throws AuthenticationError, status 401. See Errors.

ESM and CommonJS

The package ships both builds, each with its declarations. In CommonJS:

const { Platic } = require("platic-sdk");

const platic = new Platic({ apiKey: process.env.PLATIC_API_KEY });

For TypeScript, the SDK is tested with TypeScript 5.9, strict, and module and moduleResolution set to nodenext.

Next steps