Validate Actions
The validate endpoint checks a structured action plan against your policies and optionally previews the execution.
Endpoint
Endpoint
POST /v1/validateRequest & 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
| Field | Type | Description |
|---|---|---|
partner_id | string | Your partner ID |
action_plan.chain | string | Chain name: ethereum, arbitrum, optimism, base, polygon |
action_plan.actions | array | List of actions to validate |
action_plan.actions[].type | string | Action type: swap, deposit, withdraw, borrow, repay, bridge |
action_plan.actions[].venue | string | Venue adapter name (e.g. uniswap_v3, aave_v3) |
action_plan.actions[].params | object | Action-specific parameters |
action_plan.trigger | object | Optional trigger (default: {"kind": "manual"}) |
policy_id | string | Optional policy to evaluate against |
Result Values
| Result | Meaning |
|---|---|
accepted | All policy checks passed |
rejected | One or more policy rules violated |
accepted_with_warnings | Passed, but some advisory rules triggered |
Response Fields
| Field | Description |
|---|---|
status | Validation outcome: accepted, rejected, accepted_with_warnings |
validation_id | Unique ID for this validation run |
artifact | Compiled spell and IR hashes for audit |
preview.summary | Human-readable description of what would happen |
preview.warnings | Non-fatal warnings from simulation |
policy_result.passed_rules | Rule codes that passed |
policy_result.failed_rules | Rule codes that failed (present when rejected) |
How Validation Works
When you submit an action plan:
- Schema check — the plan structure is validated
- Spell compilation — actions are compiled into a Grimoire spell
- Preview simulation — the spell is simulated against live chain data
- 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