What are Macaroons?
Macaroons are bearer tokens with embedded caveats — conditions that must be satisfied for the token to be valid. Unlike JWTs, macaroons support attenuation: anyone holding a macaroon can add restrictions (narrow scope, reduce budget, shorten TTL) but can never remove them. This makes delegation safe by default.
SatGate uses macaroons as the native credential format. Every API request through the gateway carries a macaroon that encodes who the agent is, what it can do, and how much it can spend.
Caveat Types
scope = api:readAccess ControlRestricts which API operations the token can access. Supports wildcards: api:* grants all API scopes.budget = 100EconomicMaximum credits this token can spend. Enforced in real-time by the gateway. When exhausted, requests return HTTP 402.expires = 2026-03-01T12:00:00ZTemporalToken expiry timestamp. After this time, the token is rejected automatically.ttl = 1hTemporalRelative expiry. Converted to an absolute timestamp at mint time.tenant_id = abc-123IdentityBinds the token to a specific tenant. Used in multi-tenant deployments to isolate data and config.subject = research-botIdentityIdentity binding. Links the token to the agent that requested it.delegation = trueDelegationWhether this token can create child tokens. Set to false to prevent sub-delegation.max_depth = 3DelegationMaximum delegation depth. Prevents unbounded delegation chains.cost_center = engineeringGovernanceAccounting label for spend attribution. Appears in Shadow Report.department = ai-researchGovernanceOrganizational label for spend attribution. Used in delegation tree reporting.Delegation
Macaroons support hierarchical delegation. A parent token can mint child tokens with additional restrictions. Children can never exceed the parent's budget, scope, or TTL.
Root Token (admin)
└─ scope = api:*, budget = 1000, ttl = 24h
│
├─ Agent Alpha (delegated)
│ └─ scope = api:read, budget = 200, ttl = 4h
│ │
│ └─ Sub-Agent (delegated)
│ └─ scope = api:read:subset, budget = 50, ttl = 1h
│
└─ Agent Bravo (delegated)
└─ scope = api:write, budget = 500, ttl = 12hCascade revocation: Revoking a parent token immediately invalidates all of its children. No propagation delay — the gateway checks revocation status on every request.
Macaroons vs JWTs
| Feature | Macaroons | JWTs |
|---|---|---|
| Attenuation | ✓ Add caveats anytime | ✗ Immutable after signing |
| Delegation | ✓ Native parent→child | ✗ Requires new token from IdP |
| Revocation | ✓ Instant cascade | ~ Requires blocklist |
| Budget enforcement | ✓ Embedded in caveats | ✗ External system needed |
| Offline verification | ~ Needs spend ledger | ✓ Signature only |
| Ecosystem | ~ Growing (Lightning, SatGate) | ✓ Universal |
SatGate Token Lifecycle
Authorization: Bearer on every request. Gateway verifies signature, checks caveats, deducts budget.