Skip to content

Manage API keys

Varroa API keys authenticate CLI, MCP, CI, and other non-browser clients. A key acts as its owner and uses that owner’s current permissions.

Create a key from the dashboard or API:

Terminal window
curl -sf -X POST https://app.example.com/api/v1/me/apikeys \
-H "Authorization: Bearer $CURRENT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"deployment-automation","expiresIn":"720h"}'

The response contains vk_<prefix>.<secret>. Copy it immediately. The full token is returned once. The prefix is safe to use when listing or revoking the key.

Verify it:

Terminal window
curl -sf https://app.example.com/api/v1/me \
-H "Authorization: Bearer $VARROA_API_KEY"
Terminal window
curl -sf https://app.example.com/api/v1/me/apikeys \
-H "Authorization: Bearer $VARROA_API_KEY"
curl -sf -X POST \
https://app.example.com/api/v1/me/apikeys/<prefix>/rotate \
-H "Authorization: Bearer $VARROA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"expiresIn":"720h"}'
curl -sf -X DELETE \
https://app.example.com/api/v1/me/apikeys/<prefix> \
-H "Authorization: Bearer $VARROA_API_KEY"

Rotation returns a new token and revokes the old prefix. Administrators can list or revoke another user’s keys under /api/v1/users/<name>/apikeys.

Previously accepted credentials can remain valid in a validation cache for up to about 60 seconds. Remove the owner’s role grants as well when access must be withdrawn across all keys immediately.

Managed controllers accept a Varroa key as a bearer token and apply the owner’s Jenkins roles:

Terminal window
curl -sf https://jenkins.example.com/api/json \
-H "Authorization: Bearer $VARROA_API_KEY"

Validated bearer requests do not require a Jenkins CSRF crumb.

  • Create one key per client and purpose.
  • Set an expiry for unattended automation.
  • Store the full token in a secret manager.
  • Log only the prefix.
  • Rotate instead of sharing.
  • Grant the owner only the required Varroa and Jenkins roles.

For MCP setup, use the canonical procedure in Connect an MCP client.

SymptomCheck
401Complete token value, expiry, rotation, and revocation
403Owner’s Varroa or Jenkins role
Group grant is absentOwner’s resolved groups from /api/v1/me
Revoked key briefly succeedsAllow for the validation cache interval