Tollgate

Gateway

Paid sessions

Some agents call the same route dozens of times a minute. A session lets them settle once for a bundle of calls instead of signing every request.

Enable sessions on a route

tollgate.config.ts
"/x402/news": {
  price: usdg("0.01"),
  session: { calls: 50, ttl: "30m" }, // 50 calls for 0.50, valid 30 minutes
  upstream: "https://wire.internal/headlines",
}

Open a session

terminal
curl -s -X POST https://gateway.tollgate402.com/x402/sessions \
  -H "X-PAYMENT: $PAYMENT" \
  -d '{"route":"/x402/news"}'
201 Created
{
  "session": "ses_4kq2v9",
  "route": "/x402/news",
  "callsRemaining": 50,
  "expiresAt": 1792248000,
  "tx": "0x5d0e…91ab"
}

Send X-SESSION: ses_4kq2v9 on subsequent calls. Each response includes X-SESSION-REMAINING. When it reaches zero or the session expires, the next call returns a fresh 402.

Rules

  • Sessions are bound to the paying agent's API key and cannot be shared.
  • Unused calls are not refunded; size bundles to your agent's real cadence.
  • The console shows active sessions and their countdowns under Overview.