GuardLayer exposes two categories of APIs:
- Admin Management APIs (Dashboard operations, config tuning, audits, keys keys setup) — protected by JWT Authorization.
- LLM Proxy Gateways (Completions routing, compatible with OpenAI format) — protected by Client API Keys.
All routes under /api/* (except auth registration and login) require a Bearer token in the Authorization header:
Authorization: Bearer <valid_jwt_token>Proxy routes under /v1/* require a Bearer token in the Authorization header representing a valid GuardLayer API Key:
Authorization: Bearer gl_live_abc123...- Description: Registers the first administrative user account (subsequent calls will return 403 Forbidden).
- Auth Required: No
- Request Body:
{ "email": "admin@guardlayer.dev", "password": "securepassword123" } - Response Schema (
201 Created):{ "message": "Registration successful", "user": { "id": "uuid-string", "email": "admin@guardlayer.dev" } }
- Description: Authenticates admin credentials and returns a signed JWT.
- Auth Required: No
- Request Body:
{ "email": "admin@guardlayer.dev", "password": "securepassword123" } - Response Schema (
200 OK):{ "token": "signed_jwt_token_string", "user": { "id": "uuid-string", "email": "admin@guardlayer.dev" } }
- Description: Retrieves a list of all administrative API key scopes.
- Auth Required: Yes (Admin JWT)
- Response Schema (
200 OK):[ { "id": "uuid-string", "name": "production-mobile-app", "key_prefix": "gl_live_abc", "is_active": true, "created_at": "2026-06-04T10:00:00Z", "last_used_at": "2026-06-04T15:20:00Z" } ]
- Description: Creates a new active API Key.
- Auth Required: Yes (Admin JWT)
- Request Body:
{ "name": "development-test-suite" } - Response Schema (
201 Created):{ "id": "uuid-string", "name": "development-test-suite", "key_prefix": "gl_live_xyz", "key": "gl_live_xyz********************9aBc", "is_active": true }
- Description: Streams the full history of audit logs filtered by options as a CSV download.
- Auth Required: Yes (Admin JWT)
- Query Parameters:
api_key_id(optional): Filter logs to specific key uuid.from_date(optional): ISO date range start.to_date(optional): ISO date range end.was_blocked(optional): Boolean filter (trueorfalse).
- Response Format:
text/csvstream attachment.
- Description: Streams security threat occurrences logs filtered by query parameters as a CSV download.
- Auth Required: Yes (Admin JWT)
- Response Format:
text/csvstream attachment.
- Description: Proxies request completions through safety guardrails.
- Auth Required: Yes (Client API Key)
- Request Body (OpenAI Schema):
{ "model": "gpt-3.5-turbo", "messages": [ { "role": "user", "content": "Summarize the document." } ], "temperature": 0.7 } - Response Schema (
200 OK): Standard OpenAI structure or400 Bad Requestif blocked by safety thresholds.
| HTTP Status | Error Code | Description |
|---|---|---|
401 |
UNAUTHORIZED_MISSING_TOKEN |
Bearer token is missing from the request header. |
401 |
UNAUTHORIZED_INVALID_TOKEN |
The JWT signature is invalid or has expired. |
401 |
UNAUTHORIZED_INVALID_KEY |
Client API key is not registered in the system. |
403 |
FORBIDDEN_ADMIN_EXISTS |
Blocked attempt to call /auth/register when admin already exists. |
429 |
TOO_MANY_REQUESTS |
API key rate limits exceeded. |