API Keys vs Scoped AI Agent Grants

Use API keys as service credentials; use verifiable grants when a service must know which agent may do what for which principal.

API keys are not inherently unsafe. They are often the right credential for a tightly controlled service integration. Risk rises when a broad key is copied into autonomous agents, shared across agents, or used where a person expects explicit, revocable delegation.

What changes with an agent grant?

DecisionAPI keyGrantex grant
Identity representedUsually an account, project, or integrationAgent DID, principal, and grant identifiers in a signed token
PermissionsProvider-defined key roles or scopesNarrow grant scopes that the receiving service must enforce
LifetimeProvider-dependent; keys may be long-livedTime-limited JWT with explicit expiry
DelegationCopying a key does not attenuate authorityA child grant must be a narrower scope subset and records delegation depth
RevocationRotating a shared key affects every consumerRevoke a grant centrally; local verifiers still need current state
Audit contextProvider logs may identify the keyOptional audit records can attribute actions to agent, grant, and principal

When an API key is still appropriate

When to add Grantex

Incremental migration

  1. Keep provider secrets in the receiving backend rather than in the agent prompt or tool runtime.
  2. Register each agent and request only the scopes required for its task.
  3. Send the Grantex grant token to the service that owns the protected action.
  4. Verify the token signature and claims, then enforce the required scope before using the provider credential.
  5. Add online or synchronized grant-state checks where immediate revocation matters.
app.post(
  '/calendar/events',
  requireGrantToken({
    jwksUri: 'https://api.grantex.dev/.well-known/jwks.json',
  }),
  requireScopes('calendar:write'),
  createCalendarEvent,
);
Local JWT verification checks signatures and claims after JWKS retrieval. It does not prove current revocation unless the verifier performs an online state check or synchronizes revocation data.

Replace broad agent credentials one boundary at a time

Start with the action whose misuse would have the highest impact.

Open the quickstart

Technical review updated 12 July 2026.

Related implementation resources