Skip to content

Client Keys

Client keys are user-scoped API keys that provide programmatic access to the Fluxbase API. They are distinct from service keys and JWT tokens, offering fine-grained scope control and per-key rate limiting.

Client keys enable:

  • Scoped access - Each key has specific permission scopes (e.g., clientkeys:read, clientkeys:write)
  • Rate limiting - Per-key rate limits configurable at creation time
  • User isolation - Regular users can only see and manage their own keys; admins can see all
  • Revocation - Keys can be revoked (deactivated) without deleting them
  • Expiration - Optional expiry time for temporary access
FeatureClient KeysService Keys
ScopePer-user, configurable scopesPer-tenant, full tenant access
Rate limitingPer-key configurableGlobal tenant limits
ManagementUsers manage their own keysAdmin-only management
Auth headerX-Client-KeyX-Service-Key
ExpirationOptionalNo expiration
MethodEndpointDescriptionScope
GET/api/v1/client-keysList client keysclientkeys:read
GET/api/v1/client-keys/:idGet a client keyclientkeys:read
POST/api/v1/client-keysCreate a client keyclientkeys:write
PATCH/api/v1/client-keys/:idUpdate a client keyclientkeys:write
DELETE/api/v1/client-keys/:idDelete a client keyclientkeys:write
POST/api/v1/client-keys/:id/revokeRevoke a client keyclientkeys:write

When the system setting app.auth.allow_user_client_keys is disabled, only admins can access these endpoints.

Terminal window
curl -X POST \
-H "Authorization: Bearer <jwt-token>" \
-H "Content-Type: application/json" \
-d '{
"name": "My CI/CD Key",
"description": "Used for automated deployments",
"scopes": ["clientkeys:read"],
"rate_limit_per_minute": 100
}' \
http://localhost:8080/api/v1/client-keys

The raw key is returned only on creation. Store it securely — it cannot be retrieved later.

Request fields:

FieldTypeRequiredDescription
namestringYesDescriptive name
descriptionstringNoOptional details
scopesstring[]NoPermission scopes
rate_limit_per_minuteintNoPer-key rate limit
expires_atstringNoISO 8601 expiration timestamp
Terminal window
curl -H "Authorization: Bearer <jwt-token>" \
http://localhost:8080/api/v1/client-keys

Admins can filter by user: ?user_id=<uuid>

Terminal window
curl -H "Authorization: Bearer <jwt-token>" \
http://localhost:8080/api/v1/client-keys/<id>
Terminal window
curl -X PATCH \
-H "Authorization: Bearer <jwt-token>" \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Key Name",
"scopes": ["clientkeys:read", "clientkeys:write"],
"rate_limit_per_minute": 200
}' \
http://localhost:8080/api/v1/client-keys/<id>
Terminal window
curl -X POST \
-H "Authorization: Bearer <jwt-token>" \
http://localhost:8080/api/v1/client-keys/<id>/revoke

Revocation deactivates the key without deleting it, preserving audit history.

Terminal window
curl -X DELETE \
-H "Authorization: Bearer <jwt-token>" \
http://localhost:8080/api/v1/client-keys/<id>

Use the X-Client-Key header to authenticate requests:

Terminal window
curl -H "X-Client-Key: <your-client-key>" \
http://localhost:8080/api/v1/some-endpoint