API Reference

Call Guard directly over HTTP if you prefer not to use the SDK.

Authentication

Customer-facing endpoints use only:

x-api-key: guard_*************** GUARD_URL=https://guard-api-****.onrender.com # Guard API URL

Keep the API key server-side. If you build a public frontend, call Guard through your own backend (or Next.js API routes).

POST/check

Decide whether a request should be allowed.

Headers

x-api-key: <API_KEY>
Content-Type: application/json

Body

{
  "route": "/api/login",
  "method": "POST" // optional
}

Response

// allowed
{ "allowed": true }

// blocked
{ "allowed": false, "reason": "RATE_LIMIT" }

Reasons

RATE_LIMIT
MONTHLY_QUOTA_EXCEEDED
GUARD_RATE_LIMIT
SERVICE_UNAVAILABLE
UNAUTHORIZED
INVALID_API_KEY
API_KEY_DISABLED
ROUTE_REQUIRED
GET/usage

Usage for your API key (monthly).

curl "$GUARD_URL/usage" \
  -H "x-api-key: $GUARD_API_KEY"