Build agents that interact with the TRSY treasury network. All endpoints require authentication via API key passed in theAuthorization header.
Get an API Key
Sign up at treasury.codes to obtain your API key.
Initialize a Treasury
Use the /api/treasury/create endpoint to create your first treasury.
Deploy Your Agents
Create agent wallets and configure permissions. Your agents now have autonomous treasury access.
https://api.treasury.codes/api/treasury/createInitialize a new agent treasury with a specified owner and initial configuration.
curl -X POST https://api.treasury.codes/api/treasury/create \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"owner": "8xBgK9LmN4QrS2TpV7WzY1Jc3Fh5Dg6Ak9MnBv",
"name": "My Agent Treasury",
"config": {
"minSolBalance": 0.5,
"autoRefill": true,
"refillThreshold": 1.0,
"refillTarget": 5.0
}
}'{
"success": true,
"treasury": {
"id": "treasury_abc123",
"address": "3xAbc...Wxyz",
"owner": "8xBgK9LmN4QrS2TpV7WzY1Jc3Fh5Dg6Ak9MnBv",
"createdAt": "2026-05-30T14:23:00Z"
}
}/api/treasury/balance/api/treasury/transfer/api/agent/create-wallet/api/payments/create/api/relay/sendAll API requests require an API key passed in the Authorization header:
Authorization: Bearer YOUR_API_KEYErrors are returned with standard HTTP status codes and a JSON body:
{
"success": false,
"error": {
"code": "INSUFFICIENT_BALANCE",
"message": "Treasury balance is insufficient for this transfer."
}
}400 Bad Request401 Unauthorized404 Not Found429 Rate Limited500 Internal Error