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.

Endpoint

GET /v1/violations
Authentication: Required (X-API-Key header) Returns every block and escalate decision. Violations are stored permanently and can never be edited or deleted.

Query Parameters

ParameterTypeDefaultDescription
agent_idstringFilter by agent ID
action_typestringFilter by action type: refund, credit, discount, spend
decisionstringFilter by decision: block or escalate
fromstringStart date (ISO 8601 UTC, e.g., 2026-04-01T00:00:00Z)
tostringEnd date (ISO 8601 UTC)
limitinteger20Results per page (min 1, max 100)
cursorstringPagination cursor from a previous response

Example Request

curl "https://spendguardapi.com/v1/violations?agent_id=support-agent-v1&decision=block&limit=5" \
  -H "X-API-Key: $SPENDGUARD_API_KEY"

Response — 200 OK

{
  "data": [
    {
      "violation_id": "viol_abc123",
      "check_id": "chk_x9y8z7w6v5u4",
      "agent_id": "support-agent-v1",
      "policy_id": "my_refund_policy",
      "policy_version": 1,
      "action_type": "refund",
      "amount": 750.00,
      "currency": "USD",
      "counterparty": "customer_456",
      "decision": "block",
      "violated_rule_id": "r1",
      "violated_rule_description": "Block refunds over $500",
      "confidence": "high",
      "latency_ms": 8,
      "timestamp": "2026-04-03T12:02:00Z"
    }
  ],
  "pagination": {
    "next_cursor": "viol_def456",
    "has_more": true,
    "total_count": 23
  }
}

Violation Record Fields

FieldTypeDescription
violation_idstringUnique violation identifier (viol_...)
check_idstringThe check that produced this violation
agent_idstringWhich agent triggered it
policy_idstringWhich policy was evaluated
policy_versionintegerWhich version of the policy
action_typestringrefund, credit, discount, or spend
amountnumberThe dollar amount
currencystringCurrency code
counterpartystringCustomer or vendor ID
decisionstringblock or escalate
violated_rule_idstringWhich rule fired
violated_rule_descriptionstringDescription of the violated rule
confidencestringhigh, medium, or low
latency_msintegerProcessing time in milliseconds
timestampstringWhen the decision was made (UTC)

Pagination

Results are sorted newest first. Use cursor to page through results:
# First page
curl "https://spendguardapi.com/v1/violations?limit=10" -H "X-API-Key: ..."

# Next page (using cursor from previous response)
curl "https://spendguardapi.com/v1/violations?limit=10&cursor=viol_def456" -H "X-API-Key: ..."
When has_more is false, you’ve reached the end.

Error Responses

StatusCodeWhen
401unauthorizedMissing or invalid API key
500internal_errorServer error