DEVELOPER TOOLS

Official Libraries & SDKs

Beta client libraries for Node.js and Python with execution-token-first payment examples.

Node.js / TypeScript

@spendguard/sdk
v1.2.0 GitHub

Installation

$ npm install @spendguard/sdk

Key Features

  • Full TypeScript support
  • Promise-based API
  • Automatic retries
  • Webhook signature verification
  • ESM & CJS support
quickstart.ts
import { SpendGuardClient } from '@spendguard/sdk';

const management = new SpendGuardClient({
  apiKey: process.env.SPENDGUARD_MANAGEMENT_KEY!,
});

const capability = await management.mintExecutionToken('agent_...', {
  mandate_id: 'mandate_...',
});

const agentSpend = new SpendGuardClient({
  apiKey: capability.executionToken,
});

const payment = await agentSpend.executePayment({
  mandate_id: 'mandate_...',
  amount: 4999,
  currency: 'USD',
  merchant: 'openai',
  description: 'Sandbox API usage',
  idempotency_key: crypto.randomUUID(),
});

Python

spendguard
v1.1.0 GitHub

Installation

$ pip install spendguard

Key Features

  • Async support (asyncio)
  • Type hints
  • Auto-pagination
  • Webhook utilities
  • Python 3.8+
quickstart.py
from spendguard import SpendGuardClient
import os
import uuid

management = SpendGuardClient(
    api_key=os.environ["SPENDGUARD_MANAGEMENT_KEY"],
)

capability = management.mint_execution_token(
    agent_id="agent_...",
    mandate_id="mandate_...",
)

agent_spend = SpendGuardClient(api_key=capability["executionToken"])

payment = agent_spend.execute_payment(
    mandate_id="mandate_...",
    amount=4999,
    currency="USD",
    merchant="openai",
    description="Sandbox API usage",
    idempotency_key=str(uuid.uuid4()),
)

Ready to dive deeper?

Explore our comprehensive API reference for detailed information on every endpoint and method.

Read the API Docs
Try the Sandbox