Skip to main content
The Agent Sentinel platform uses two authentication methods:
  • API keys - For SDK integration (recommended)
  • JWT tokens - For web console access (automatic via Clerk)
Both are passed as HTTP headers:

API keys (for SDK)

API keys are long-lived credentials for authenticating SDK requests to the platform.

Generate an API key

Via web console (recommended):
  1. Log in to console.agentsentinel.dev
  2. Navigate to Settings → API Keys
  3. Click Generate New Key
  4. Copy the key immediately (shown only once)
  5. Store it securely (password manager, secrets vault)
Via API:
Response:
The full API key value (as_...) is only shown once at creation time. Copy and store it immediately - you cannot retrieve it later.

Agent-bound keys

A key can optionally be bound to a single agent, scoped, and given an expiry:
  • agent_id - When set, this key can only be used to ingest logs for that agent. If a POST /ingest request presents a different agent_id (at the payload or entry level), the request is rejected with 403 and detail agent_id does not match the bound key. If the request omits agent_id entirely, the bound value is used automatically. Keys without agent_id set are unrestricted, matching prior behavior.
  • Management writes - A key with agent_id set gets 403 with reason_code agent_bound_key_forbidden when it tries to change governance configuration: creating, updating, deleting or testing escalation rules and notification channels, updating compliance mappings, updating agent metadata, deleting action definitions, and reviving a kill-switch target. It can still call POST /kill-switch/kill, so an agent can always halt itself. Unbound keys and user sessions are unaffected.
  • scopes - Permission scopes granted to the key. Defaults to ["ingest"].
  • expires_at - Optional expiration timestamp. Once passed, the key fails verification with 401 and detail API key has expired, distinct from a revoked (deactivated) key.

Use an API key in SDK

Manage API keys

List your keys:
Revoke a key:

JWT tokens (for web console)

JWT tokens are automatically managed by the web console via Clerk authentication. You don’t need to handle these manually for SDK usage.

When you need a JWT

JWTs are required for:
  • Accessing the web console
  • Making API calls from the browser
  • Programmatic API access (e.g., scripts, CI/CD)

Get a JWT token

Via web console: JWTs are automatically included in all web console requests - no action needed. Programmatic access: If you need a JWT for API scripts, use Clerk’s session tokens:
  1. Log in to the web console
  2. Open browser DevTools → Console
  3. Run:
  4. Copy the token (valid for 1 hour)

JWT expiration

  • Web console: Tokens auto-refresh - you stay logged in
  • Programmatic: Tokens expire after 1 hour - regenerate as needed

Best practices

Use API keys for agents: API keys are long-lived and designed for server-side usage. JWTs expire and are meant for user sessions.
Rotate keys regularly: Generate new API keys every 90 days and delete old ones.
Never commit keys to git: Use environment variables or secrets management (AWS Secrets Manager, HashiCorp Vault, etc.).
Use separate keys per environment: Different API keys for dev, staging, and production.

Troubleshooting

“401 Unauthorized”
  • Verify API key is correct (starts with as_)
  • Check key is still active (not revoked)
  • Check key has not passed its expires_at (detail: “API key has expired”)
  • Ensure you’re using Authorization: Bearer <key> header
“403 agent_id does not match the bound key”
  • The key is bound to a specific agent_id; the ingest payload (or an entry within it) specified a different agent_id
  • Either omit agent_id in the request (the bound value is used automatically) or use a key that isn’t bound to an agent
“API key not working after creation”
  • Keys may take up to 30 seconds to propagate
  • Verify you copied the full key including as_ prefix
  • Test with a simple API call to verify

See also

  • Quickstart - Get your first API key and connect to the platform
  • Settings - Manage API keys in the web console