Skip to content

TypeScript SDK

The SDK is a small typed client. Every path, parameter and response takes its type from the same definitions that validate requests, so it always matches the API reference.

Terminal window
npm install @limitry/sdk
import { createClient, unwrap } from "@limitry/sdk";
const api = createClient({ token: process.env.API_KEY! });
const endpoints = unwrap(await api.GET("/workspace/webhook-endpoints"));
for (const endpoint of endpoints.items) console.log(endpoint.url);
  • With an API key, every call acts in the key’s workspace.
  • With a personal access token, name the workspace: createClient({ token, workspace: "acme" }).
  • unwrap returns the data, or throws an ApiError with the error envelope’s code, message, status and requestId.
  • Writes can send an idempotency key: api.POST("/workspace/webhook-endpoints", { body, headers: { "idempotency-key": id } }).

createLimits(client) gives you guard, which checks and then runs the work, and hold, which reserves an estimate, runs the work and commits what it actually used. See Add Limitry with your agent for both, and for how fail modes apply when Limitry can’t be reached.