Getting Started with c402 AI Agent Credit
An agent uses c402 when it must pay first and earn later.
1. Discover the service
curl https://c402.site/.well-known/c402.json
Use the catalog to find supported networks, assets, and endpoints.
2. Register a lender agent
curl -X POST https://c402.site/lenders/register \
-H 'content-type: application/json' \
-d '{
"availableLiquidityAtomic":"25000000",
"asset":"USDC",
"assets":{"base-sepolia":"USDC","flare-testnet":"USDT0"},
"networks":["base-sepolia","flare-testnet"],
"minFeeBps":300,
"maxDurationSeconds":86400,
"acceptedRiskBands":["A","B"]
}'
Registration returns a session key and one funding address per network. Fund the address, then submit the setup transactions returned for that network. The lender agent pays gas.
3. Fund and inspect the Safe
curl https://c402.site/lenders/0xLenderAgent/wallet
Fund each address with the network gas token and lender asset. Then submit the setup transactions and poll for supplier-payment actions.
4. Create or register a repayment source
Every mutation requires a signed C402-Authorization header. A funded job must reference a successful c402 funding transaction. Non-job backing sources are unavailable until a verifier adapter is configured.
curl -X POST https://c402.site/credit/backing-sources \
-H 'content-type: application/json' \
-d '{
"sourceId":"asset-source-1",
"productType":"asset-backed",
"agent":"0xBorrowerAgent",
"valueAtomic":"5000000",
"liquidationValueAtomic":"5000000",
"advanceRateBps":6500,
"evidenceId":"ftso-proof-1"
}'
5. Request credit
curl -X POST https://c402.site/credit/request \
-H 'content-type: application/json' \
-d '{
"agent":"0xBorrowerAgent",
"network":"flare-testnet",
"asset":"USDT0",
"productType":"asset-backed",
"amountAtomic":"1000000",
"purpose":"data",
"supplier":"Market Data API",
"supplierDomain":"data.example.com",
"repaymentSource":"asset-source-1",
"maximumFeeAtomic":"100000"
}'
6. Match a lender
curl -X POST https://c402.site/credit/match \
-H 'content-type: application/json' \
-d '{"offerId":"offer-id"}'
c402 selects the lowest-rate eligible lender. Reputation and liquidity are tie-breakers.
7. Lender wallet signs supplier payment
curl https://c402.site/lenders/0xLenderAgent/actions
The lender agent runner signs the returned transaction from the funded wallet. The borrower never receives the principal.
curl -X POST https://c402.site/credit/offers/offer-id/supplier-payment \
-H 'content-type: application/json' \
-d '{
"lender":"0xLenderAgent",
"supplierPaymentId":"0xSupplierPaymentTxHash"
}'
8. Repay or liquidate
When revenue arrives, repay the advance. If terms are broken, liquidation uses locked collateral, hard backing value, and reserve before recording shortfall.