SDK installation
Install the inventra TypeScript SDK and instantiate the client.
The inventra SDK is a dependency-free TypeScript package that wraps the REST API. It gives you typed methods for every resource, plus optional integrations for React and Next.js.
Install
npm install inventra
# or
yarn add inventra
# or
pnpm add inventra
# or
bun add inventraThe SDK ships both ESM and CommonJS builds. Works in Node.js 18+, Bun, Deno (via npm compat), and modern browsers — though you should not instantiate the SDK with an API key in the browser (see Production setup).
Instantiate the client
import { Inventra } from 'inventra';
const inventra = new Inventra({
apiKey: process.env.INVENTRA_API_KEY!,
orgId: process.env.INVENTRA_ORG_ID!
});Constructor options
| Option | Type | Required | Description |
|---|---|---|---|
apiKey |
string |
yes | Your API key (from dashboard → Settings → API keys). |
orgId |
string |
yes | Your organization ID. |
fetch |
typeof globalThis.fetch |
no | Inject a custom fetch implementation (useful for proxying, caching, or testing). |
Resources
Once instantiated, the client exposes typed resources:
inventra.blocks // reusable content blocks
inventra.contents // blog posts & articles
inventra.categories // content taxonomy
inventra.contacts // contact form submissions
inventra.organizations // org metadata & public integrations
inventra.sitemaps // indexable URL listEach resource has the methods described on its own page — see the sidebar.
Sub-exports
The SDK is split into focused sub-paths to keep your bundle small:
| Import | What it provides |
|---|---|
inventra |
Core client and types. Zero dependencies. |
inventra/schema |
JSON-LD schema builders for SEO. |
inventra/llms |
LLM-friendly content extraction helpers. |
inventra/react |
React components (JsonLd, Markdown, AutoBreadcrumbSchema). |
inventra/next |
Next.js helpers (ISR directives, sitemap helper, route handlers). |
inventra/og |
Branded OpenGraph image generation — theme, Satori templates, metadata builders. Bundles sharp + date-fns. |
Only import what you use. The core inventra export is ~2KB gzipped.