Authentication

Every request must include an API key as a Bearer token. Keys are created in the API dashboard and belong to an API account.

Authorization: Bearer wh_live_your_api_key_here

A key consists of the prefix wh_live_ followed by 64 hexadecimal characters. The same key is valid for all three endpoints. Keys have no scopes and no expiry date, and remain valid until revoked.

Creating and revoking keys#

Keys are managed on the API Keys tab of the API dashboard. Creating a key requires an active API plan.

  • The full key is displayed only once, at creation. Only a hash of the key is stored, so a lost key cannot be recovered and must be replaced with a new one.
  • Name each key for the environment it is used in, such as "production" or "staging". The dashboard identifies keys by name and by their first 12 characters.
  • An account can have up to 5 active keys, or 10 on Premium and Enterprise plans, where keys are shared with the team.
  • Revocation is permanent. A revoked key cannot be re-enabled. Revocation can take up to 5 minutes to take effect.

Rotating a key without downtime#

  1. Create a second key.
  2. Deploy the new key to your application.
  3. Confirm that requests succeed with the new key.
  4. Revoke the old key.

Store keys server-side#

An API key grants access to the full word balance of the account and must be treated as a secret. Load it from an environment variable or a secrets manager, and do not commit it to source control, write it to logs or include it in client-side code.

export WRITEHUMAN_API_KEY="wh_live_..."

The API does not send CORS headers and cannot be called directly from a browser. For web and mobile applications, route requests through your own backend, which calls the WriteHuman API.

Authentication errors#

StatuscodeCause
401missing_api_keyThe Authorization: Bearer header is missing or malformed.
401invalid_api_keyThe key is unknown or has been revoked.
402no_subscriptionThe key is valid, but the account has no active plan. A plan with a failed payment is treated as inactive until the payment succeeds.
403reverify_requiredThe account owner must re-verify their email address. See Re-verification.
429auth_locked_outToo many failed authentication attempts. Wait for the number of seconds given in the Retry-After header.

Repeated failed attempts from the same address result in a lockout of up to 15 minutes. The Retry-After header of the 429 response gives the remaining lockout time in seconds.

Re-verification#

WriteHuman may require an account owner to re-verify their email address. While re-verification is pending, all endpoints return 403 reverify_required and no words are charged.

  1. The account owner signs in at writehuman.ai and follows the link in the verification email.
  2. Create a new key in the dashboard. The most recent key created after re-verification began becomes active within approximately one minute.
  3. Keys created earlier remain disabled until re-verification ends. Update your application to use the new key.

Do not automatically retry a reverify_required response. The error persists until the account owner completes re-verification.