Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Validate Actions

The validate endpoint checks a structured action plan against your policies and optionally previews the execution.

Endpoint

Endpoint
POST /v1/validate

Request & Response

Request
curl -X POST https://api.grimoire.run/v1/validate \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "partner_id": "YOUR_PARTNER_ID",
    "action_plan": {
      "chain": "ethereum",
      "actions": [
        {
          "type": "swap",
          "venue": "uniswap_v3",
          "params": {
            "token_in": "USDC",
            "token_out": "ETH",
            "amount_in": "5000"
          }
        }
      ]
    }
  }'

Request Body

FieldTypeDescription
partner_idstringYour partner ID
action_plan.chainstringChain name: ethereum, arbitrum, optimism, base, polygon
action_plan.actionsarrayList of actions to validate
action_plan.actions[].typestringAction type: swap, deposit, withdraw, borrow, repay, bridge
action_plan.actions[].venuestringVenue adapter name (e.g. uniswap_v3, aave_v3)
action_plan.actions[].paramsobjectAction-specific parameters
action_plan.triggerobjectOptional trigger (default: {"kind": "manual"})
policy_idstringOptional policy to evaluate against

Result Values

ResultMeaning
acceptedAll policy checks passed
rejectedOne or more policy rules violated
accepted_with_warningsPassed, but some advisory rules triggered

Response Fields

FieldDescription
statusValidation outcome: accepted, rejected, accepted_with_warnings
validation_idUnique ID for this validation run
artifactCompiled spell and IR hashes for audit
preview.summaryHuman-readable description of what would happen
preview.warningsNon-fatal warnings from simulation
policy_result.passed_rulesRule codes that passed
policy_result.failed_rulesRule codes that failed (present when rejected)

How Validation Works

When you submit an action plan:

  1. Schema check — the plan structure is validated
  2. Spell compilation — actions are compiled into a Grimoire spell
  3. Preview simulation — the spell is simulated against live chain data
  4. Policy evaluation — your partner policies are checked against the plan and preview results

If preview simulation is unavailable (RPC issues, unsupported venue), the response includes a degraded flag and policy evaluation proceeds with compile-time information only.

Use Cases

  • Pre-trade validation — check if a trade would pass your risk policies before executing
  • Agent guardrails — validate AI-generated action plans before allowing execution
  • Compliance checks — ensure actions stay within defined limits
  • Audit — every validation is persisted with artifact hashes for traceability