All blocks

Platform

API keys

Hashed API keys for tenants and users with scopes, expiry, rotation with a grace period, a per-key rate limit and throttled last-used tracking. verify_api_key() backs apiKeyResolver; has_scope() and api_key_tenant() go in policies.

DocsModes:managedcustom
terminal
npx better-supabase sql add api-keys
better-supabase.config.ts
import { defineConfig } from "better-supabase/config";

export default defineConfig({
  sql: {
    modules: {
      // Required by api-keys; sql add installs them too.
      "updated-at": {},
      tenant: {},
      access: {},
      // Modes: "managed", "custom". The default is "managed".
      "api-keys": { mode: "managed" },
    },
  },
});