Developer API

Developer API authentication

Create v2 API keys, send the bearer key safely, choose scopes and environments, and rotate or revoke keys.

Key format and environments

  • A v2 key has three dot-separated parts: the environment prefix (wf_v2_test or wf_v2_live), a public identifier (wf_pub_…) and a secret (wf_sec_…). Always send all three as one bearer value.
  • Test keys read and write only test resources; live keys only live resources. Use a test key until the integration passes its checks.
  • Key pairs from the retired v1 API (a publishable identifier in its own header plus a secret bearer) are not accepted; create a v2 key.

Key lifecycle

  • Create keys in Developer API → API Keys, or with POST /api/v2/keys (scope keys.write) with a name, the scope list and expiresInDays of 30, 90 or 365.
  • The complete key is returned once, at creation or rotation. Wellfriend stores only a hash and never returns it again.
  • POST /api/v2/keys/{keyId}/rotate issues a new secret and the old one stops working at the same moment; POST /api/v2/keys/{keyId}/revoke stops the key immediately.
  • GET /api/v2/keys (scope keys.read) lists keys with their environment, scopes and expiry, never the secret.
  • An account has a limit on active keys; creating one more returns 409 KEY_LIMIT_REACHED.

Where to store keys

  • Store the key only on a secure server or trusted runtime.
  • Do not place the key in browser JavaScript, mobile apps, public HTML, logs, screenshots, issue trackers, or support tickets.
  • Use environment variables or a managed secret store in your own infrastructure.
  • If a key is exposed, revoke it and create a replacement.

Authentication and scope errors

A missing, malformed, expired or revoked key returns 401 AUTHENTICATION_REQUIRED. A valid key without every scope the operation requires returns 403 SCOPE_FORBIDDEN, and details.requiredScopes lists the scopes it needs.

Key handling checklist

  • Store the complete key in a secret manager or a server environment variable.
  • If you log anything about a key, log its name or its wf_pub_ identifier, never the wf_sec_ part.
  • Grant only the scopes each service calls.
  • Rotate keys when someone with access leaves, a server is rebuilt, or a key may have appeared in a log.