# Go-live checklist

> Twelve checks before a live API key goes to production: key storage and scope, startup check, timeouts, retries, statuses, balance alerts and logging.

Run through this list before you put a live key in production. Each item takes a few minutes and prevents a failure that costs money, leaks data or turns real users away. Each one links to the page that explains it.

## Before you switch to a live key

1. **Keep the live key in a secret store.** Put it in your secret manager or your platform's encrypted environment variables, never in source code, a client bundle or a mobile app. Your frontend calls your backend, and only your backend calls the API. See [Keep keys secret](https://qelka.com/docs/authentication#keep-keys-secret).

2. **Restrict the key to the endpoints it calls.** A key limited to `email` cannot start a bulk job if it leaks. In the dashboard, choose **Only some** under **Access** when you create the key, and include `account` if the service runs the startup check. See [Restricted keys](https://qelka.com/docs/authentication#restricted-keys).

3. **Use one key per service and environment.** Name each key after where it runs, such as `signup-service-production`. You can then rotate or revoke one key without touching the others. See [Rotate a key](https://qelka.com/docs/authentication#rotate-a-key).

4. **Check the key mode at startup.** Call `GET /account`, which is free, and stop the service if production runs with a key whose `key.mode` is not `live`. A test key in production accepts simulated answers as real. See [Check which key a service runs with](https://qelka.com/docs/authentication#check-which-key-a-service-runs-with).

5. **Set a client timeout on every call.** A full-mode email check waits for the recipient's mail server, and a VAT check waits for VIES, which can take longer than 12 seconds when it is busy. About 15 seconds suits a full-mode email check; run VAT checks in the background when you can. See the [email](https://qelka.com/docs/api-reference/email) and [VAT](https://qelka.com/docs/api-reference/vat) references.

6. **Retry `429` after `Retry-After`, and only retry what can succeed.** Wait the number of seconds in the `Retry-After` header on a `429`. Retry `500` and `502` with backoff. Never retry `400`, `401`, `402`, `403`, `404` or `422`: they fail the same way every time. See [Retry correctly](https://qelka.com/docs/rate-limits#retry-correctly).

7. **Handle every status and reason.** Branch on `status`, then on `reason` where the endpoint has one, and on `error.type` for errors, never on `error.message`. Each reference page has a table of statuses with what to do, such as the [email statuses](https://qelka.com/docs/api-reference/email#statuses). See [Handle errors in code](https://qelka.com/docs/errors#handle-errors-in-code).

8. **Never block a user on `unknown`.** An `unknown` email means the checks could not conclude, for example because the mail server did not answer in time or asked to retry later. Accept the address and confirm it another way, or check again later. Do the same when the API itself fails: fail open, let the user through and check in the background. See [Validate signup forms](https://qelka.com/docs/guides/validate-signup-forms).

9. **Get warned before the balance runs out.** Subscribe to the `credits.low` webhook, which fires when the balance falls under 10% of your plan's monthly credits, and check that the low-balance email goes to someone who reads it. Turn on auto top-up if a stop would hurt. See [Get warned before the balance runs out](https://qelka.com/docs/credits#get-warned-before-the-balance-runs-out) and [Webhooks](https://qelka.com/docs/webhooks).

10. **Monitor `X-Credits-Remaining`.** Every response carries your balance after the call. Send it to your metrics and alert under a threshold that leaves you time to react. At zero, calls fail with `402 insufficient_credits`. See [Credits](https://qelka.com/docs/credits).

11. **Log `X-Request-Id` and the result `id`.** Every response has an `X-Request-Id` header, and every check result has an `id` starting with `lkp_`. Log them with failures and with results you may need to discuss: support can find a request from them without you sending the data you checked. See [Response headers](https://qelka.com/docs/api-reference#response-headers).

12. **Send only the data you need.** Use `fast` email mode when you do not need the mailbox check, the `basic` phone level when you do not need the current carrier, and upload only the column to check in bulk jobs. Do not log full email addresses or phone numbers on your side either. See [Send less data](https://qelka.com/docs/data-and-privacy#send-less-data).

## After launch

- **Watch the dashboard.** The logs page lists each call with its status and outcome for 30 days, and the usage page shows credits per day and per endpoint.
- **Follow incidents** on the [status page](https://qelka.com/status).
- **Store results with your records** so the same value is not checked twice: cached results cost the same as fresh ones. See [Caching](https://qelka.com/docs/caching).
- **Ask for help** at support@qelka.com with the `X-Request-Id` of the call in question.
