Documentation menu

Concepts

Key security best practices

Keep Wayline API keys safe — call from your backend, restrict browser keys by origin, never ship keys in mobile apps, and rotate exposed keys.

Updated Dec 1, 2026 View Markdown

API keys grant access to billable usage. Treat live keys like passwords.

Call the API from your server

The safest pattern is: your app → your backend → Wayline. Your backend holds the key, adds caching and per-user limits, and can change providers without an app release.

Browser keys: restrict by origin

If you must call Wayline directly from a web page, create a separate key restricted to your exact origins (for example https://app.yourcompany.com or https://*.yourcompany.com). Requests from other origins receive KEY_NOT_ALLOWED_FROM_ORIGIN. Also restrict its scopes to only the endpoints the page uses and set a spend limit.

Never ship keys in mobile apps

Keys inside iOS, Android or Flutter apps can be extracted from the binary. Route mobile traffic through your backend. Our Flutter recipe shows the pattern.

Server keys: restrict by IP

For server-to-server use, restrict live keys to your egress IP ranges (CIDR). Requests from elsewhere receive KEY_NOT_ALLOWED_FROM_IP.

Other practices

  • Keep keys in a secrets manager or environment variables — never in source control.
  • Use different keys per environment and per service, so you can revoke one without an outage.
  • Turn on a monthly spend limit.
  • Never log full keys. Our SDKs never log keys.
  • If a key leaks, rotate it immediately.