# x402 Sandwich/MEV Risk Scorer for Swaps

> x402 Sandwich/MEV Risk Scorer for Swaps is a paid API for AI agents from x402-services-production.up.railway.app, paid per call via x402, $0.05/call, status unknown (last checked 2026-09-14).

Scores the MEV/sandwich attack risk for a planned token swap based on price impact and trade size, and returns concrete mitigations like private RPC usage, slippage tightening, and order splitting.

## Facts

- Endpoint: POST https://x402-services-production.up.railway.app/api/exec/sandwich
- Price: $0.05/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x402-sandwich-mev-risk-scorer-for-swaps-c9312eda
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_JDtL7115XQPoajdOJQ34l

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability x402-sandwich-mev-risk-scorer-for-swaps-c9312eda -d '<json body>'
```

Example prompt: Before I swap 50000000000000000000 USDC for WETH on Base, can you check the sandwich/MEV risk score — tokenIn is 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48, tokenOut is 0x4200000000000000000000000000000000000006 — and tell me what mitigations I should apply?

## When to prefer this

Use this endpoint when an agent or user is about to execute a DEX swap and wants to quantify MEV/sandwich risk before committing to the trade. It is especially valuable for larger trades on Base or other EVM chains where price impact is significant. Prefer this over generic slippage calculators when you also need actionable mitigation advice (private RPC, order splitting) rather than just a price estimate.

## Known failure modes

- Missing required fields (tokenIn, tokenOut, amountIn) returns a 400 validation error
- Invalid or unrecognized token address returns an error or low-confidence score
- Unsupported chain returns an error or defaults to Base
- Payment not included or insufficient USDC causes a 402 Payment Required response
- Network timeout or upstream data unavailability results in a 5xx error

## How this service works

Sandwich / MEV risk score for a planned swap, from price impact and trade size, with concrete mitigations (private RPC, tighter slippage, order splitting). Send { chain, tokenIn, tokenOut, amountIn }. Trade without getting sandwiched.

## Output

A MEV/sandwich risk score for the planned swap derived from price impact and trade size, along with specific actionable mitigations such as using a private RPC endpoint, tightening slippage tolerance, or splitting the order into smaller trades to reduce exposure.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "amountIn",
  "tokenIn",
  "tokenOut"
 ],
 "properties": {
  "chain": {
   "type": "string",
   "description": "Chain, default base"
  },
  "tokenIn": {
   "type": "string",
   "description": "0x token to sell"
  },
  "amountIn": {
   "type": "string",
   "description": "Amount in smallest units"
  },
  "tokenOut": {
   "type": "string",
   "description": "0x token to buy"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/x402-sandwich-mev-risk-scorer-for-swaps-c9312eda/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-services-production.up.railway.app](https://www.zero.xyz/host/x402-services-production.up.railway.app/llms.txt)
