Skip to main content
All protected InfraAudit API endpoints require a Bearer token in the Authorization header. This page explains how to obtain a token, how to use it, and how long-lived API keys work.

Pass the token

Include your token on every request:

Get a token

InfraAudit uses Supabase Auth. Your access token is a signed JWT issued by your Supabase project. There are three ways to obtain one.
1

Option 1: Sign in via the Supabase client

Use the Supabase JavaScript SDK if you’re building a browser or Node.js integration:
2

Option 2: Sign in via the InfraAudit API

POST your credentials to /api/login to receive a token directly:
Response:
3

Option 3: Use the CLI

The CLI stores the token automatically after login:
The token is saved to ~/.infraudit/config.yaml and used by all subsequent CLI commands.

Use the token in requests

API keys

For non-interactive use cases such as CI/CD pipelines and automated scripts, create a long-lived API key instead of using a session token. Create an API key in the web UI: navigate to Settings → API Keys and click New key. Create an API key via the API:
Response:
The full API key value is returned only at creation time. Store it in your secrets manager immediately — it cannot be retrieved again.
API keys use the same Authorization: Bearer header as session tokens.

Token format

Tokens are Supabase JWTs signed with either:
  • ES256 — ECDSA with a key pair managed by Supabase, verified via JWKS at {SUPABASE_URL}/auth/v1/.well-known/jwks.json
  • HS256 — HMAC using SUPABASE_JWT_SECRET
The auth middleware accepts both formats.

SSE / EventSource requests

For server-sent events endpoints, pass the token as a query parameter instead of a header:

401 vs 403