Define what each agent is allowed to spend, with whom, and under what conditions. Every x402 payment is policy-enforced and cryptographically signed before it clears.
import { KyaPaymentsClient } from '@mandate/sdk'
const kya = new KyaPaymentsClient({
apiKey: process.env.KYA_API_KEY,
})
const res = await kya.fetchWithPayment(
'https://api.example.com/research',
{
agentId: 'agt_research_bot',
mandateId: 'mnd_web_data_50usd',
}
)
// 402 → policy check → signed
// proof → retry, all automaticimport { requireKyaPayment } from '@mandate/middleware'
app.get(
'/research',
requireKyaPayment({
price: '0.25',
currency: 'USDC',
category: 'research',
kyaApiKey: process.env.KYA_API_KEY,
}),
(c) => {
const agentId = c.get('kyaAgentId')
return c.json({
results: [...],
billed_to: agentId,
})
}
)Designed for agents built on

