AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
icon: 🗝️
API Keys
Long-lived platform service credentials (prefixed sk-) for machine-to-machine API calls on behalf of a platform. Each key is 64 chars, stored only as a SHA-256 hash — the plaintext is returned once on creation and never again. Gated by platform.plan.apiKeysEnabled (EE/Cloud).
Entity
api_key: id, platformId (FK, CASCADE), displayName, hashedValue (SHA-256, looked up every request), truncatedValue (last 4 chars for display), lastUsedAt (updated on each authenticated request).
How it works
- Endpoints under
/v1/api-keys, allplatformAdminOnly:POST(create, returnsApiKeyResponseWithValuewith raw value once),GET(list,SeekPagewithout value),DELETE /:id. - Service:
add(generates key, stores hashed/truncated),getByValue(lookup by SHA-256 hash, updateslastUsedAt— used by auth middleware),list,delete.
Gotchas
- A route is only reachable with an API key if its
securitylistsPrincipalType.SERVICE. Otherwise the key gets 403. To publish an endpoint: addSERVICEto itssecurityAccesscall, give ittagsand adescription(nohide: true) so Fastify Swagger puts it in the OpenAPI spec, add adocs/endpoints/<area>/<action>.mdxpage withopenapi: <METHOD> <path>, and test it with a key. From then on its shape is a public contract. Every AI Center route (providers, tiers, capabilities, usage) isUSER-only as of 2026-10-29, so none of it is public yet. - Key generated with
secureApId(61)+sk-prefix = 64 chars; hashed withcryptoUtils.hashSHA256. - Plaintext is only ever available at creation time.
Key files
Entry point: apiKeyModule, registered on the Fastify app in packages/server/api/src/app/app.ts.
packages/server/api/src/app/ee/api-keys/— the whole backend slice: module (routes + feature gate), TypeORM entity, servicepackages/server/api/src/app/core/security/v2/authn/— wheregetByValueis called to authenticate an incoming keypackages/core/shared/src/lib/ee/api-key/— sharedApiKeytypes and request/response contractspackages/web/src/features/platform-admin/api/api-key-api.ts— frontend API clientpackages/web/src/features/platform-admin/hooks/api-key-hooks.ts— React Query hookspackages/web/src/app/routes/platform/security/api-keys/— platform admin UI page and create dialog
Paths verified 2026-07-17.