TypeScript SDK
Type-safe TypeScript client for the dscr.ai API.
The official TypeScript SDK provides type-safe access to the dscr.ai API with full IntelliSense support.
Installation
npm install @dscr/sdkQuick Start
import { DscrClient } from "@dscr/sdk";
const client = new DscrClient({
apiKey: process.env.DSCR_API_KEY,
});
const deals = await client.deals.list();
Configuration
| Property | Type | Description |
|---|---|---|
apiKeyrequired | string | Your dscr.ai API key (starts with sk_live_ or sk_test_) |
baseUrl | string | Override the API base URL. Defaults to https://pricingengine.pro |
timeout | number | Request timeout in milliseconds. Default: 30000 |
retries | number | Max automatic retries on 5xx errors. Default: 2 |
const client = new DscrClient({
apiKey: "sk_live_...",
baseUrl: "https://pricingengine.pro",
timeout: 15000,
retries: 3,
});
Available Methods
Error Handling
import { DscrClient, DscrError } from "@dscr/sdk";
try {
const deal = await client.deals.get("deal_invalid");
} catch (error) {
if (error instanceof DscrError) {
console.error(error.code); // "NOT_FOUND"
console.error(error.message); // "Deal not found"
console.error(error.status); // 404
}
}