Updated
API Keys
ProCustomize
All
Installation
ProAPI Keys is a Pro component
Sign in to see the source, or install it with a license key. The live preview and props above are free to explore.
Install with a key
- Add the Pro registry to
components.json:components.json { "registries": { "@uibrik-pro": { "url": "https://uibrik.com/r/pro/{name}.json", "headers": { "Authorization": "Bearer ${UIBRIK_LICENSE}" } } } } - Put your key in
.env.localand add that file to.gitignore:.env.local UIBRIK_LICENSE=your-license-key - Install it:
Terminal npx shadcn@latest add @uibrik-pro/api-keys
Loading your installation…
Usage
import { ApiKeys } from "@/components/uibrik/api-keys/api-keys";const resources = ["Customers", "Payments", "Invoices", "Webhooks", "Reports"];<ApiKeys defaultEnv="all" resources={resources} onCreate={(key) => {}} onRoll={(id) => {}} onReveal={(id) => {}} onRevoke={(id) => {}} onUpdatePermissions={(id, permissions) => {}} // keys={[{ id: "…", name: "…", env: "live", last4: "…", createdOn: "…" }]}/>Where to use API Keys
Developer platforms
Live and test keys, scoped permissions and a show-once secret cover what a public API's dashboard needs on day one.
Pairs with Code Block
Security reviews
Traffic, error rate, allowed IPs and expiry on every key make stale or over-scoped keys easy to spot and roll.
Pairs with Permissions Matrix and Activity Log
Integrations and webhooks
Restricted keys scoped per resource let customers hand a third party only the access it needs.
Pairs with MCP Connectors
Props
ApiKeys- defaultEnv
- Type "all" | "live" | "test"
- "all"
- Environment filter shown first.
- resources
- Type string[]
- ["Customers","Payments","Invoices","Webhooks","Reports"]
- Resources a restricted key can be scoped to.
- keys
- Type { id: string; name: string; env: "live" | "test"; last4: string; createdOn: string; createdBy?: string; lastUsedMinutesAgo?: number; expiresInDays?: number; permissions?: Record<string, "none" | "read" | "write">; requests?: number[]; errors?: number; allowedIps?: string[] }[]
- –
- Existing keys. Leave permissions out for full access; requests is 14 daily counts, oldest first.
- onCreate
- Type (key: { name, env, permissions?, expiresInDays? }) => string | Promise<string>
- –
- Creates a key and returns its full secret, shown once.
- onRoll
- Type (id: string) => string | Promise<string>
- –
- Replaces a key's secret and returns the new one, shown once.
- onReveal
- Type (id: string) => string | Promise<string>
- –
- Fetches a key's full secret for the copy button next to the masked secret.
- onRevoke
- Type (id: string) => void | Promise<void>
- –
- Called after a revoke is confirmed.
- onUpdatePermissions
- Type (id: string, permissions: Record<string, ApiAccess> | undefined) => void | Promise<void>
- –
- Saves a key's permissions. Undefined means full access.
- className
- Type string
- –
- Classes for the root.