Plety JavaScript SDK
Plety Limited. Updated
The Plety JavaScript SDK is the official npm package plety-sdk: a small, zero-dependency client for the read-only Plety API. It searches Plety's guides on licensing UK company records to AI buyers, reads any page as Markdown, lists pages by section and returns the company facts. It needs no key and runs on Node 18 or later.
Install
Install it from npm (https://www.npmjs.com/package/plety-sdk). It has no dependencies and ships its own TypeScript types.
npm install plety-sdkUse it
Create a client, search, then read the best match in full:
import { Plety } from 'plety-sdk';
const plety = new Plety();
const { results } = await plety.search('who signs a data licence in a liquidation', { limit: 3 });
const markdown = await plety.page(results[0].url, { format: 'markdown' });
for await (const p of plety.allPages({ section: 'insolvency' })) console.log(p.title);
const facts = await plety.company();Methods
Errors throw PletyError with status, code, hint and, on a 429, retryAfter in seconds. The API allows up to 120 requests a minute per client.
| Method | What it returns |
|---|---|
| search(query, { limit }) | The best matching pages with a matching passage |
| page(url, { format }) | One page in full: JSON, or Markdown text with format markdown |
| pages({ section, limit, cursor }) | One page of the guide list with next_cursor |
| allPages({ section }) | Every guide page, following the cursor |
| sections() | The sections of the site |
| company() | The facts needed to describe Plety |
| ask(text, { mode }) | Natural-language search over NLWeb |
Source and licence
The SDK is MIT licensed and published by Plety Limited (UK company 17598186); its source is at https://github.com/plety-net/plety-agent-kit. The API it calls is described at https://plety.net/about/api and in https://plety.net/openapi.json. For the command line, see the Plety CLI at https://plety.net/about/cli.