SDKs

Official Spendaq SDKs for Node.js and Python. The SDKs handle authentication, retries, and response parsing — letting you focus on your integration logic.

Node.js SDK

Installation

npm install @spendaq/node

Basic usage

import Spendaq from '@spendaq/node';

const client = new Spendaq({ apiKey: process.env.SPENDAQ_API_KEY });

const result = await client.classify({
  account_id: 'acct_kst_8841',
  transactions: [
    {
      id: 'txn_001',
      amount_cents: 8499,
      date: '2026-06-10',
      merchant_name: 'AMZN*MKTP',
      raw_category: 'DEBIT_MISC',
    },
  ],
});

console.log(result.results[0].corrected_category);
// → "Office Supplies"

console.log(result.forecast_signal);
// → "stable_positive"

TypeScript types

The SDK ships with full TypeScript types. The main types you'll use:

  • ClassifyRequest — input payload shape
  • ClassifyResponse — response including results and forecast
  • ClassificationResult — per-transaction result object
  • ForecastSignal — enum of possible signal values

Python SDK

Installation

pip install spendaq

Basic usage

from spendaq import Spendaq

client = Spendaq(api_key="spq_live_YOUR_KEY")

result = client.classify(
    account_id="acct_kst_8841",
    transactions=[
        {
            "id": "txn_001",
            "amount_cents": 8499,
            "date": "2026-06-10",
            "merchant_name": "AMZN*MKTP",
            "raw_category": "DEBIT_MISC",
        }
    ]
)

print(result.results[0].corrected_category)
# → "Office Supplies"

print(result.forecast_signal)
# → "stable_positive"

Async support

from spendaq.async_client import AsyncSpendaq
import asyncio

async def main():
    async with AsyncSpendaq(api_key="spq_live_...") as client:
        result = await client.classify(
            account_id="acct_kst_8841",
            transactions=[...]
        )
        return result

asyncio.run(main())

Automatic retries

Both SDKs automatically retry on 429 (rate limit) and 5xx responses with exponential backoff. Configure retry behavior:

// Node.js
const client = new Spendaq({
  apiKey: process.env.SPENDAQ_API_KEY,
  maxRetries: 3,          // default: 2
  timeout: 30_000,        // ms, default: 10_000
});

Need help? Email [email protected].