Authentication

All API requests require an API key. NPILayer uses the standard HTTP Bearer token scheme โ€” pass your key in the Authorization header on every request.

Getting an API key

  1. Create an account Sign up at npilayer.com/signup โ€” no credit card required for the free plan.
  2. Generate a key From your dashboard, click Create API Key, give it a name, and copy the key immediately. It is only shown once.
  3. Store it securely Treat your API key like a password. Store it in an environment variable, never in source code or client-side JavaScript.

Making authenticated requests

Include your API key in the Authorization header with the Bearer scheme:

curl \
  -H "Authorization: Bearer npil_live_your_api_key_here" \
  "https://api.npilayer.com/v1/providers/1003000126"

Key format

API keys are prefixed with npil_live_ followed by a cryptographically random string. Keys are shown once at creation and cannot be retrieved again โ€” if you lose a key, revoke it and create a new one.

Never include API keys in browser JavaScript, mobile app bundles, public repositories, or log files. Use environment variables or a secrets manager.

Revoking a key

To revoke a key, go to your dashboard and click Revoke next to the key. Revoked keys are rejected immediately. There is no delay or grace period.

Authentication errors

Requests with a missing or invalid API key receive a 401 response. The error code field tells you which:

HTTPCodeMeaning
401 missing_api_key No Authorization header was present on the request.
401 invalid_api_key The key was present but did not match any active key (wrong key, revoked key, or typo).
{
  "error": {
    "code": "invalid_api_key",
    "message": "The API key provided is invalid or has been revoked."
  }
}