Introduction
Netthouse is a clearing and cost-attribution layer for AI agents. It gives you a double-entry ledger, HTTP-native payments (x402), and automatic netting of opposing money flows — so agents can pay for resources without invoices, sessions, or manual wiring.
Core concepts: Organization (your workspace), Agent (an AI actor), Account (a balance in one currency), Transaction (a balanced set of ledger entries), Clearing (netting of opposing flows between two accounts).
Quickstart
Everything below works against the live sandbox API. Four steps to your first cleared payment.
1. Create an organization
curl -X POST https://netthouse-api.onrender.com/organizations -H "Content-Type: application/json" -d '{"name":"Acme","slug":"acme"}'2. Create an agent and two accounts
curl -X POST https://netthouse-api.onrender.com/agents -H "Content-Type: application/json" -d '{"orgId":"ORG_ID","name":"My Agent"}'curl -X POST https://netthouse-api.onrender.com/accounts -H "Content-Type: application/json" -d '{"orgId":"ORG_ID","agentId":"AGENT_ID","currency":"USD"}'curl -X POST https://netthouse-api.onrender.com/accounts -H "Content-Type: application/json" -d '{"orgId":"ORG_ID","currency":"USD"}'3. Post a balanced transaction
curl -X POST https://netthouse-api.onrender.com/transactions -H "Content-Type: application/json" -d '{"orgId":"ORG_ID","description":"API usage","entries":[{"accountId":"ACC_1","direction":"debit","amount":"25.00"},{"accountId":"ACC_2","direction":"credit","amount":"25.00"}]}'4. See the clearing proposal
curl "https://netthouse-api.onrender.com/clearing?orgId=ORG_ID"The response shows gross flow, net flow and how much you save by netting opposing transfers instead of executing them one by one.
x402 payments
x402 turns HTTP 402 «Payment Required» into a machine-readable payment protocol. Flow:
- Agent calls a paid resource.
- Server responds 402 with payment requirements (amount, currency, recipient).
- Agent retries with an X-PAYMENT header carrying the payment payload.
- Server verifies, settles on the ledger, and serves the resource.
curl https://your-paid-resource.example/data -H "X-PAYMENT: <payload>"Settlement is a single balanced ledger transaction — no external rails, no floats, no reconciliation at the end of the month.
API reference
| Method | Path | Description |
|---|---|---|
| POST | /organizations | Create organization |
| GET | /organizations | List organizations |
| POST | /agents | Create agent |
| POST | /accounts | Create account |
| GET | /accounts?orgId= | List accounts |
| GET | /accounts/:id/balance | Account balance |
| POST | /transactions | Post balanced transaction |
| GET | /transactions?orgId= | List transactions |
| GET | /clearing?orgId= | Clearing proposal |
| POST | /api-keys | Issue API key (admin) |
| GET | /api-keys?orgId= | List API keys (admin) |
| POST | /api-keys/:id/revoke | Revoke key (admin) |