relayto is RELAYTO's official JavaScript and TypeScript SDK and command-line tool for the public site API. It reads the pages, hubs and documents of any site published with RELAYTO. No API key, no runtime dependencies.
Install
npm install relayto
Or run the CLI without installing:
npx relayto --help
CLI
npx relayto search "open enrollment" --site benefits.relayto.com
npx relayto hubs --site benefits.relayto.com
npx relayto get https://benefits.relayto.com/e/what-is-open-enrollment-4uoe8tjxhumq6
| Command | What it returns |
|---|---|
relayto search <query> | pages, hubs and documents matching the words, best first |
relayto hubs | the site's hubs |
relayto pages | the site's own pages |
relayto contents | the documents in the site's library |
relayto get <url-or-slug> | a document or page as Markdown; for a hub, its items |
relayto export <slug>… | the Markdown of up to 10 documents |
relayto site | the site's name, description, API, OpenAPI, llms.txt and MCP addresses |
SDK
import { RelaytoSite } from 'relayto';
const site = new RelaytoSite('benefits.relayto.com');
const results = await site.search('wellness', { kind: 'content', limit: 5 });
for (const item of results.data) console.log(item.title, item.url);
for await (const hub of site.allHubs()) console.log(hub.title, hub.slug);
const doc = await site.getContent('what-is-open-enrollment-4uoe8tjxhumq6');
Typed errors (NotFoundError, NotPublicError, rate limits) and automatic retry on 429 are built in. The full reference is in the package README.
Need to create or change content?
The SDK reads published sites. To publish, organize and measure content in your own workspace from an AI agent, use the RELAYTO MCP server.