Get Started
Install the SDK, create a client, and choose the integration path for your application.
Install
pnpm add @openpermit/sdk @openpermit/typesThe SDK is ESM-only and targets universal Fetch runtimes: Node 20+, browsers, edge workers, Hono, and modern full-stack frameworks.
Create a client
import { createOpenPermitClient } from '@openpermit/sdk';
const openpermit = createOpenPermitClient({
baseUrl: process.env.OPENPERMIT_API_URL ?? 'http://localhost:9999',
apiKey: process.env.OPENPERMIT_API_KEY,
organizationId: process.env.OPENPERMIT_ORGANIZATION_ID,
});OpenPermit accepts service-account keys through the Authorization: Bearer header. The SDK adds that header automatically when apiKey is provided.
Pick your path
Buyer agent
Use `wrapFetch` when your agent calls paid APIs that return HTTP 402 challenges.
Paid seller API
Use seller middleware to protect a resource and verify payment credentials.
Control plane
Use the client or generated API reference to manage mandates, receipts, resources, and webhooks.
Local development
For local development, run the API on port 9999 and point the SDK at http://localhost:9999. The API exposes generated reference docs through this docs app and still serves its Scalar view from the API service.
const localOpenPermit = createOpenPermitClient({
baseUrl: 'http://localhost:9999',
apiKey: process.env.OPENPERMIT_BOOTSTRAP_TOKEN,
});Use the bootstrap token only for local development and initial provisioning. Production integrations should use scoped service-account keys.