Authentication
All PolarGrid API requests require authentication using an API key.API Keys
API keys are created in the PolarGrid Console and start withpg_.
Creating a Key
- Open the API Keys page — either click Generate API Key (or Manage API Keys) on the Dashboard Overview, or go to Settings → API Keys in the sidebar
- Click Generate New Key
- Give it a descriptive name (e.g., “Production App”, “Development”)
- Select permissions:
read-write(default),read-only, oradmin - Copy the key immediately — it won’t be shown again
Using Your Key
The SDKs handle authentication automatically — just pass your API key:Raw HTTP (cURL)
Send yourpg_* API key directly to the edge. Pick a region with the autorouter (one request) or pin one.
The autorouter (
autorouter.polargrid.ai) is a discovery endpoint — it serves GET /v1/route only. It does not proxy /v1/chat/completions, /v1/models, or any other inference traffic; POST against it is rejected by CloudFront with 403.Playground vs API
The Playground in the Console uses your realpg_* API key — the same key from Creating a Key above. There is no separate “playground token”.
Under the hood, the Playground sends your API key directly to the nearest edge — the same flow as a raw cURL call.
Environment Variables
We recommend storing your API key in an environment variable:Permission Levels
| Level | Description |
|---|---|
read-write | Default for keys minted from the Console. Recommended for typical SDK / API usage. |
read-only | Same data-plane access today; intended for callers that should not mint LiveKit room tokens (/v1/tokens). |
admin | Same data-plane access plus the ability to mint LiveKit room tokens. |
The inference endpoints (
/v1/chat/completions, /v1/completions, /v1/models, /v1/audio/*) are not currently scope-gated — any active key can call them. Scope enforcement is presently scoped to /v1/tokens. Default to read-write unless you have a specific reason to narrow.Troubleshooting Auth Errors
| HTTP Code | Error | Cause | Fix |
|---|---|---|---|
401 | Invalid API key | API key not recognized, revoked, or deleted | Verify the key is correct and active in the Console. If revoked, generate a new key |
403 | {"Message": null} or Forbidden | Request blocked by infrastructure (CloudFront/WAF) before reaching the auth service | Ensure you’re using the correct endpoint URL and that your request includes valid headers. See Regions |
Token Lifespan
When you authenticate with apg_* API key, the auth service issues a session token (JWT) and a refresh token.
| Token | Default Lifetime | Purpose |
|---|---|---|
| Session (JWT) | 24 hours | Authorizes inference requests on the edge |
| Refresh | 30 days | Extends the session without re-authenticating |
For most use cases, including long-running voice sessions (call centers, 24/7 agents), the 24-hour session lifetime with automatic refresh is sufficient. No manual token management is required.
Security Best Practices
- Use environment variables for API keys
- Rotate keys periodically
- Use separate keys for development and production
- Revoke keys immediately if compromised
