Gallantree Developer API

Key rotation and expiry

API keys are meant to be rotated, not held forever. This guide covers how expiry works and the overlap-window pattern for rotating without downtime.

Expiry defaults

Once a key expires, the API returns 401 API key has expired on every request that uses it. There is no grace period on an already-expired key — regenerate first.

The overlap-window pattern

The point of rotation is to swap a credential without dropping a single request. The pattern:

  1. Generate a new key in the portal (the existing key stays valid).
  2. Deploy the new key alongside the old one — your integration reads whichever the config specifies. Some teams add a bit of config that tries the new key and falls back to the old; others rotate atomically by updating a single environment variable.
  3. Wait for propagation — depending on your fleet, minutes to hours. The old key is still valid throughout.
  4. Revoke the old key in the portal.

The old key stays valid until you revoke it or it expires — the platform does not revoke it for you or remind you. Revoke it as soon as the new key is live everywhere; aim for within 24 hours, so you never have two working credentials for longer than the switch-over needs.

Revocation is immediate

When you revoke a key in the portal, the next request that uses it is rejected. There's no CDN cache, no async propagation delay. If you revoke a key you're still using in production, expect immediate 401s.

What happens on expiry

Tracking expiry

There is no public API endpoint for listing your keys or their expiry dates — check them on the portal's app page. If you want automated alerting, store each key's expiry date alongside the key in your secret store when you issue it, and alert from there.

Runnable example — rotate without downtime

Shell
# 1. Read the current key from your secret store (whatever your team uses)
OLD_KEY=$(vault kv get -field=api-key secret/gallantree)

# 2. Generate NEW_KEY in the portal, copy it into your secret store
vault kv put secret/gallantree api-key="$NEW_KEY"

# 3. Deploy — depending on your rollout style, this may be a rolling restart
kubectl rollout restart deployment/gallantree-sync

# 4. Verify the new key is live everywhere by tailing your logs for the prefix
kubectl logs -l app=gallantree-sync | grep "$(echo "$NEW_KEY" | cut -c1-12)"

# 5. Revoke the old key in the portal
Was this page helpful?

Built with Token Gesture