Developer Quickstart

Get Started in 3 Minutes

Install the SDK, mint a short-lived execution token, and run a controlled sandbox payment through a mandate.

Integration

Interactive Guide

Use a management credential to mint scoped execution tokens, then let agent tools spend with the short-lived token.

1

Install the SDK

bash
npm install @spendguard/sdk
2

Mint an execution token

typescript
import { SpendGuardClient } from '@spendguard/sdk';

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

const capability = await spendguard.mintExecutionToken('agt_procurement_01', {
  mandate_id: 'mdt_99x_alpha',
  ttl_seconds: 300,
});
3

Create a sandbox payment

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

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

console.log(payment.status); // "authorized"

Ready to Start Building?

Join thousands of developers building autonomous stacks on SpendGuard.