@usethrottle/api-client
v2.6.1
Published
Typed REST client for the Throttle API (auto-generated from OpenAPI 3.1)
Readme
@usethrottle/api-client
Typed REST client for advanced Throttle API endpoints that are not covered by
one of the focused storefront SDKs. Auto-generated from the OpenAPI 3.1 spec at
https://api.usethrottle.dev/docs/json via
openapi-typescript-codegen.
Install
npm install @usethrottle/api-clientUsage
import { ApiKeysService, MerchantsService, OpenAPI } from '@usethrottle/api-client';
OpenAPI.BASE = 'https://api.usethrottle.dev';
OpenAPI.HEADERS = { 'X-API-Key': 'sk_xxx' };
const me = await MerchantsService.getMerchantsMe();
const keys = await ApiKeysService.getApiKeys();API keys are minted for a single workspace environment. Environment-scoped
dashboard or Clerk-authenticated calls that do not use an API key must also send
X-Throttle-Environment-Id:
OpenAPI.HEADERS = {
Authorization: `Bearer ${clerkToken}`,
'X-Throttle-Environment-Id': '8a5f2d1e-3d2a-4d24-93a1-fd3f9e1f37f0',
};Workspace-level management routes such as
GET /api/v1/workspaces/{workspaceId}/environments are selected by workspace id
and do not need an environment header.
Customer Payment Terms
The customer endpoints expose the nullable netN payment-terms override. Set
it to a whole number from 1 to 365, or null to use the merchant default.
import { CustomersService } from '@usethrottle/api-client';
const customer = await CustomersService.patchApiV1Customers('cus_123', {
netN: 45,
});For the latest service / type names, see src/generated/index.ts after pnpm generate.
Versioning
Pinned to a specific OpenAPI revision per release. Major bumps for breaking changes; minor for additive endpoints.
