# Authentication

Every request carries an API key as a bearer token:

```
Authorization: Bearer sk_live_…
```

There are two kinds of key:

- **Test keys (`sk_test_…`)** return fixed sample data from the sandbox. Real sources are never contacted, and calls are never charged. Any member of your organization can create one in the dashboard under **API keys**.
- **Live keys (`sk_live_…`)** return real answers from IPRS, NTSA, KRA, BRS, Safaricom and the DCI. Every call is charged to your wallet. Nilinde issues them when your organization is activated.

A key belongs to your organization, not to a person. A key can only see verifications made in its own environment, so a test key never sees live results.

## What an API key can call

- All verification APIs, and the verification records (list, fetch, summary).
- Your wallet balance (`GET /v1/wallet`) and monthly usage (`GET /v1/usage/quota`).

Everything else is managed in the dashboard and needs a user sign-in: creating and revoking keys, top-ups, wallet statements and exports, team members, and webhook settings. If you call those endpoints with an API key, you get `403`.

## Keeping keys safe

- Use keys only from your servers. Never put a key in a mobile app, a browser or a public repository.
- Store keys in a secrets manager or environment variables.
- Use a separate test key per developer or environment, so each can be revoked on its own.
- **Rotate** without downtime: create the new key, deploy it, then revoke the old one in the dashboard.
- If a key leaks, revoke it immediately. Revoked keys fail with `401` straight away.
