@distyra/sdk
v0.5.0
Published
TypeScript SDK for the Distyra Transaction Enrichment & SME Underwriting API. Generated from the committed OpenAPI spec; thin, typed wrapper around openapi-fetch.
Maintainers
Readme
@distyra/sdk
TypeScript client for the Distyra Transaction Enrichment & SME Underwriting API.
Type-safe by construction: the types are generated from the same committed OpenAPI spec that powers the API and the public reference, so requests and responses never drift from the live API.
Install
npm i @distyra/sdkNode 20+. The package ships ESM + CommonJS types and depends only on openapi-fetch.
Quickstart
Get a free sandbox key (10,000 calls/month, no card) at distyra.com.
import { createDistyraClient } from '@distyra/sdk';
const distyra = createDistyraClient({ apiKey: process.env.DISTYRA_KEY! });
const { data, error } = await distyra.POST('/v1/enrich', {
body: {
descriptor: 'CARREFOUR MARKET 75011 PARIS FR 14/03',
amount: -23.47,
currency: 'EUR',
country_hint: 'FR',
mcc: '5411',
},
});
if (error) {
// `{ error, detail? }` envelope on 4xx/5xx
throw new Error(error.detail ?? error.error);
}
// `data` is fully typed against the EnrichResponse schema
console.log(data.merchant.name, data.category.primary);Options
createDistyraClient(options):
| Option | Type | Default | Notes |
|---|---|---|---|
| apiKey | string | — | Required. Your API key (sk_…). |
| baseUrl | string | https://api.distyra.com | Override for local dev / staging. |
| headers | Record<string, string> | — | Extra headers merged on every request. |
The returned client is a typed openapi-fetch client — use .GET, .POST, etc. against any path in the spec, with full request/response typing.
Lower-level access
The generated paths and operations types are re-exported if you want to build your own openapi-fetch client or reference response shapes directly:
import type { operations } from '@distyra/sdk';
type EnrichResponse =
operations['enrichSingle']['responses']['200']['content']['application/json'];Reference
Full API reference (every endpoint, live parameters, response schemas): https://api.distyra.com/docs
License
MIT
