Getting Started
Welcome to the Subcent documentation. Subcent is the payments infrastructure for autonomous AI agents -- giving them policy-controlled wallets to transact on blockchains. This guide walks you through installing the SDK, authenticating, and making your first payment.
Installation#
TypeScript
Authentication#
Subcent uses Bearer token authentication. There are three token types:
| Prefix | Type | Purpose |
|---|---|---|
| sc_live_ | Live key | Production transactions on mainnet |
| sc_test_ | Test key | Testnet transactions, no real funds |
| sc_agent_ | Agent key | Issued per-agent, scoped to a single vault |
All API requests require the Authorization header:
Authorization: Bearer sc_test_abc123...
Agent keys (sc_agent_) are returned once when you register an agent. Store them securely -- they cannot be retrieved again.
Quick Walkthrough#
This walkthrough creates a vault, registers an agent, sets a spending policy, and makes a payment. All examples use the testnet.
Step 1: Initialize the Client#
TypeScript
Step 2: Create a Vault#
A vault is a smart-contract wallet that holds funds on-chain. Each vault is bound to an owner wallet and a specific chain.
TypeScript
After creating a vault, fund it by sending USDC to the returned vault_address on the chosen chain.
Step 3: Register an Agent#
An agent represents an AI system authorized to spend from a vault. Registration returns a one-time api_key that the agent will use for payments.
TypeScript
Step 4: Set a Spending Policy#
Policies control what your agent can spend. Every payment is evaluated against the active policy before execution.
TypeScript
Step 5: Make a Payment#
With the agent's API key, the AI agent can now request payments. Each request is evaluated against the policy engine in real time.
TypeScript
Payment Outcomes#
The policy engine evaluates every payment request and returns one of three decisions:
| Status | Meaning | What Happens |
|---|---|---|
| completed | Auto-approved by policy | Funds transferred on-chain immediately |
| pending_approval | Requires human review | An approval_url is returned; payment waits for approve/reject |
| rejected | Policy violation | No funds move; reason is included in the response |
If a payment is pending_approval, approve or reject it:
TypeScript
Next Steps#
- API Reference -- Full endpoint documentation
- TypeScript SDK -- Complete SDK reference
- Python SDK -- Python client and LangChain integration
- Policy Engine Guide -- Design spending policies
- Webhooks Guide -- Real-time event notifications
- Escrows Guide -- Conditional payment flows
- Merchant Integration -- Accept payments from agents
- Smart Contracts -- On-chain architecture