Skip to main content

Documentation Index

Fetch the complete documentation index at: https://spendguard.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Base URL

https://spendguardapi.com
All API endpoints are relative to this base URL.

Authentication

All endpoints except GET /health and POST /v1/simulate (demo mode) require an API key. Send your key in the X-API-Key header:
curl -H "X-API-Key: sg_live_your_key_here" https://spendguardapi.com/v1/policies/my_policy
See the Authentication guide for details.

Error Format

Every error response uses this exact structure:
{
  "error": {
    "code": "snake_case_error_code",
    "message": "Human-readable explanation.",
    "request_id": "req_a1b2c3d4e5f6",
    "timestamp": "2026-04-03T12:00:00.000Z"
  }
}

Standard Error Codes

CodeHTTP StatusDescription
unauthorized401Missing or invalid API key
api_key_inactive401Key exists but is disabled
bad_request400Malformed JSON or missing required fields
validation_error422Valid JSON but fails business rules
policy_not_found404Policy ID does not exist
check_not_found404Check ID does not exist
rate_limit_exceeded429Too many requests
duplicate_action_detected200Duplicate guard triggered (returned as a block decision)
internal_error500Unexpected server error

Rate Limits

ModeLimitScope
Authenticated100 req/minPer API key
Demo (no auth)10 req/minPer IP address
Rate limit headers are included in every response:
  • X-RateLimit-Limit
  • X-RateLimit-Remaining
  • X-RateLimit-Reset
When rate limited, the response includes a Retry-After header.

Request IDs

Every response includes an X-Request-ID header (format: req_ + 12 hex characters). Include this ID when contacting support.

Content Type

All request bodies must be JSON with Content-Type: application/json.

Endpoints

MethodEndpointAuthDescription
POST/v1/policiesRequiredCreate a policy
GET/v1/policies/{id}RequiredGet a policy
POST/v1/checksRequiredRun an authorization check
GET/v1/checks/{id}RequiredGet a past check
GET/v1/violationsRequiredList violations (audit log)
POST/v1/simulateOptionalSimulate checks (no side effects)
POST/v1/keysAdmin keyCreate an API key
GET/healthNoneHealth check