Skip to content

@riposte.co/sdk

The Riposte SDK wraps every OpenAPI endpoint with strongly typed methods so you can call the platform without hand-writing fetch logic. Each operation lives in an intuitive namespace (for example sdk.accounts.list) and the responses mirror the server’s OpenAPI schema.【F:product/sdk/README.md†L1-L69】

import { createRiposteSdk, RiposteRequestError } from '@riposte.co/sdk';
const sdk = createRiposteSdk({
apiKey: process.env.RIPOSTE_API_KEY!,
baseUrl: process.env.RIPOSTE_API_URL,
});
const accounts = await sdk.accounts.list({ page: 1, limit: 20 });

【F:product/sdk/README.md†L19-L58】

The instantiated client exposes every generated operation plus the underlying RiposteClient as sdk.client for advanced scenarios such as custom request signatures.【F:product/sdk/README.md†L61-L65】

createRiposteSdk accepts either an API key string or a configuration object with apiKey, optional baseUrl, and custom fetch or header overrides.【F:product/sdk/src/sdk.ts†L71-L126】

  • The helper falls back to RIPOSTE_API_URL / NEXT_PUBLIC_RIPOSTE_API_URL / VITE_RIPOSTE_API_URL when baseUrl is omitted, trimming trailing slashes in the process.【F:product/sdk/src/sdk.ts†L8-L53】
  • Authorization headers are injected automatically unless you pass includeApiKey: false; in that case provide your own Authorization and x-api-key headers.【F:product/sdk/src/sdk.ts†L55-L103】
  • Passing an existing RiposteClient instance reuses its fetch implementation and configuration.【F:product/sdk/src/sdk.ts†L106-L126】

For lower-level access you can import createRiposteClient directly and work with raw request builders; both factories are exported from the package entry point.【F:product/sdk/src/index.ts†L1-L12】

The SDK throws RiposteRequestError whenever the server responds with a non-2xx status. The error object includes the HTTP status, parsed error payload, failed method, and request path so you can surface precise failures in your application.【F:product/sdk/src/sdk.ts†L128-L157】

try {
await sdk.accounts.delete({ accountId: 'acct_123' });
} catch (error) {
if (error instanceof RiposteRequestError) {
console.error(error.status, error.message);
}
}

【F:product/sdk/README.md†L51-L59】

Every resource tag in the OpenAPI document becomes a namespace on the SDK. Here are some of the most common helpers and the response documentation they map to:

NamespaceSignatureResponse documentation
sdk.accounts.list({ page?, limit?, pageToken?, cursor? })Lists accounts with optional pagination filters.【F:product/sdk/src/generated/operations.ts†L40-L123】Returns AccountListResponse – see the Accounts API.【F:product/api-types/src/generated.ts†L4-L35】
sdk.authentication.createSession({ provider?, redirectUri?, customUserId?, email?, expiresInMinutes?, forceConsent? })Creates a hosted OAuth session and returns the URL for your end user.【F:product/sdk/src/generated/operations.ts†L3155-L3226】Yields session metadata with code, authUrl, and expiresAt – review the Authentication API.【F:product/api-types/src/generated.ts†L958-L965】
sdk.messages.list({ accountId, page?, limit?, labelId?, mailbox?, maxResults?, cursor? })Pulls a paginated slice of messages for the selected account.【F:product/sdk/src/generated/operations.ts†L1745-L1820】Returns MessageListResponse from the Messages API.【F:product/api-types/src/generated.ts†L130-L201】
sdk.webhooks.createEndpoint({ id?, url, secret?, isActive?, retryCount?, timeoutMs?, retryDelayMs?, eventTypes?, headers? })Registers a webhook endpoint and optional delivery tuning parameters.【F:product/sdk/src/generated/operations.ts†L6415-L6459】Receives the persisted endpoint configuration described in the Webhooks API.【F:product/api-types/src/generated.ts†L1961-L1999】

Because the SDK re-exports the generated type definitions, you can import any schema or response type alongside the runtime helpers for full end-to-end TypeScript coverage.【F:product/sdk/src/index.ts†L1-L12】