DEVELOPER QUICKSTART
Start in 3 Minutes
Get your first AI agent payment authorized with just a few lines of code.
1. Get Your API Key
Create an API key from your Settings page. The key starts with ap_ and authenticates all SDK calls.
2. Install the SDK
pip install spendguard
3. Authorize a Payment
Create a spending mandate for your agent, then execute a payment against it. The mandate enforces limits automatically.
quickstart.py
from spendguard import SpendGuardClient
import uuid
management = SpendGuardClient(api_key="your_api_key")
capability = management.mint_execution_token(
agent_id="your_agent_id",
mandate_id="your_mandate_id",
)
agent_spend = SpendGuardClient(api_key=capability["executionToken"])
# Execute a payment with a short-lived token
payment = agent_spend.execute_payment(
mandate_id="your_mandate_id",
amount=4900, # $49.00
merchant="openai",
currency="usd",
description="Sandbox API usage",
idempotency_key=str(uuid.uuid4()),
)
print(f"Payment {payment.id}: {payment.status}")
4. See It in Your Dashboard
After running the code above, head to the dashboard to see your payment, agent activity, and risk monitoring in real-time.
Need an API Key?
Sign up and generate your key in the settings.