API Keys And Access
Create Odock API keys and control model and MCP access.
API Keys And Access
Client applications authenticate to odock-server with Odock API keys. These keys are separate from provider API keys.
API Key Types
An API key can be scoped to:
| Type | Required owner | Forbidden owners |
|---|---|---|
ORGANISATION | none beyond organisation | teamId, userId |
TEAM | teamId | userId |
USER | userId | teamId |
Fields:
key: generated by the UI API for normal creates.type: organisation, team, or user.organisationIdteamIduserIdexpirytimezonerevealedrevokedpolicies
Authentication Headers
The gateway accepts:
Authorization: Bearer <odock-api-key>or:
X-API-Key: <odock-api-key>Gemini-compatible clients can also use:
x-goog-api-key: <odock-api-key>or the Gemini key query parameter.
Auth Cache
The gateway stores API key cache entries in Redis by SHA-256 hash of the raw key. It does not use the raw key as the Redis key.
Cache behavior:
- positive key cache uses
AUTH_CACHE_TTL, capped by key expiry; - negative cache uses
AUTH_NEGATIVE_CACHE_TTL; - after a successful database lookup, policy and model access caches are warmed.
Reveal, Copy, Rotate, Revoke
The UI supports API key actions:
- Reveal: shows the full key only when it has not been revealed before, then marks it revealed.
- Copy: copies the displayed key value.
- Rotate: creates a replacement key with similar ownership and revokes the previous one.
- Revoke: disables the key for future gateway requests.
Because the gateway caches auth results, mutating API keys should trigger cache invalidation. The UI Prisma extension sends invalidation commands when configured.
Model Access
Use model access grants to allow an API key to call a model.
An API key can be linked to one or more models through ApiKeyModelAccess. At runtime:
- Gateway authenticates the API key.
- Gateway loads the model access set for the key.
- Gateway checks that the requested model belongs to the key's organisation.
- Gateway denies with
model_not_allowedif the grant is missing.
MCP Access
MCP access uses ApiKeyMcpAccess:
- one API key,
- one MCP server.
At runtime, the gateway:
- Authenticates the API key.
- Resolves the MCP server by ID or slug from the URL.
- Checks that the server exists, is enabled, and belongs to the organisation.
- Checks whether the API key has explicit MCP access.
- Applies server allowed and blocked tool rules.
Access Design Recommendations
Use organisation keys for:
- shared internal services,
- central automation,
- platform-level integrations.
Use team keys for:
- product teams,
- business units,
- separate environments,
- clear usage ownership.
Use user keys for:
- personal developer usage,
- temporary testing,
- low-volume experimentation.
For production applications, prefer team or organisation keys with explicit model and MCP grants.