/health) require authentication via an API key passed in the x-api-key request header.
Getting Your API Key
1
Navigate to settings
Go to Settings > API Keys in your PG:AI workspace.
2
Generate a key
Click Generate API Key, give it a descriptive name, and select the permission scopes it should have.
3
Copy and store securely
Copy the key immediately — it won’t be shown again. Store it in environment variables or a secrets manager.
Using Your API Key
Include the API key in thex-api-key header on every request:
Base URL
All API endpoints use the following base URL:Permissions & Scopes
API keys are scoped with granular permissions. Each endpoint requires a specific permission — requests made with a key that lacks the required scope will receive a403 Forbidden response.
Wildcard scopes are also supported. For example,
insights:* grants both insights:read and insights:write.
Rate Limits
API requests are rate-limited based on your plan. If you exceed the limit, the API returns a429 Too Many Requests response.
Error Responses
All error responses follow a consistent structured format. Every error includes atype, a machine-readable code, and a human-readable message. Some errors include a details object with additional context.
X-Request-Id header you can use when contacting support to identify the specific request.
