TypeScript SDK

The official TypeScript and JavaScript client library for the RevKeen API

The official Node.js and TypeScript client, published as @revkeen/sdk on npm from the reviewed release mirror.

Download

Requires Node.js 18+ (or any modern runtime with fetch). Ships with TypeScript definitions — no @types package needed. Packages publish only through a reviewed release; GitHub is the source of truth for tags. Publishing uses npm trusted publishing (OIDC) — there is no NPM_TOKEN in the public mirror.

Install

npm install @revkeen/sdk

Quick start

The published client is a single RevKeenClient (also exported as RevKeen) with typed resource properties such as customers, invoices, and subscriptions.

import { RevKeenClient } from "@revkeen/sdk";

const client = new RevKeenClient({
  apiKey: process.env.REVKEEN_API_KEY!,
  baseUrl: "https://staging-api.revkeen.com",
});

const listed = await client.customers.list({ limit: 10 });
console.log(listed.data);

const created = await client.customers.create({
  email: "ops@acme.example",
  name: "Acme Inc.",
});
console.log(created.data?.id);

Use https://api.revkeen.com and an rk_live_* key in production. Override baseUrl only when you need a non-default host. Every operation in the API reference maps to a resource on the client.

What's inside

  • Typed request and response models from the SDK OpenAPI contract
  • Explicit pagination parameters on list methods (limit, offset)
  • Webhook verification via constructEvent before JSON parsing
  • API-key (apiKey) or OAuth (oauth) configuration
  • Subpath exports: @revkeen/sdk/webhooks, @revkeen/sdk/auth, @revkeen/sdk/ai
  • Node.js, Bun, Deno, Cloudflare Workers, and Vercel Edge — not browsers with secret keys

Authentication

import { RevKeenClient } from "@revkeen/sdk";

const client = new RevKeenClient({
  apiKey: process.env.REVKEEN_API_KEY!,
  baseUrl: "https://staging-api.revkeen.com",
});

See the OAuth guide for authorization-code + PKCE and client credentials.

Verify a webhook

import {
  constructEvent,
  WebhookSignatureVerificationError,
} from "@revkeen/sdk";

export async function POST(request: Request) {
  const rawBody = await request.text();
  const signature = request.headers.get("revkeen-signature");
  const secret = process.env.REVKEEN_WEBHOOK_SECRET!;

  try {
    const event = constructEvent(rawBody, signature!, secret);
    if (event.type === "invoice.paid") {
      await fulfil(event.data.object);
    }
    return new Response(null, { status: 200 });
  } catch (err) {
    if (err instanceof WebhookSignatureVerificationError) {
      return new Response(err.code, { status: 400 });
    }
    throw err;
  }
}

See webhook signing for the wire format and replay protection.

Compatibility

RuntimeStatus
Node.js 18+Supported
Bun 1+Supported
Deno 1.40+Supported
Cloudflare WorkersSupported
Vercel Edge RuntimeSupported
BrowsersNot supported for secret keys — keep rk_live_* / rk_sandbox_* server-side

Resources

On this page