# POST /v1/validate/batch

Validate multiple trades in sequence. Each trade is evaluated against the wallet state that would result from all preceding trades being executed, allowing you to assess correlated position risk.

## Request

```
POST https://api.canonprotocol.org/v1/validate/batch
```

### Headers

| Header | Required | Value |
|---|---|---|
| `Authorization` | Yes | `Bearer YOUR_API_KEY` |
| `Content-Type` | Yes | `application/json` |

### Body

```json
{
  "wallet": "0x7a3b1234567890abcdef1234567890abcdef1234",
  "trades": [
    {
      "asset": "BTC",
      "action": "long",
      "size": 50000,
      "leverage": 10,
      "mode": "cross"
    },
    {
      "asset": "ETH",
      "action": "long",
      "size": 30000,
      "leverage": 5,
      "mode": "cross"
    }
  ]
}
```

| Field | Type | Required | Description |
|---|---|---|---|
| `wallet` | string | Yes | Ethereum wallet address (42 characters, `0x` prefix) |
| `trades` | array | Yes | Array of trade objects (1-50 trades) |
| `trades[].asset` | string | Yes | Asset ticker |
| `trades[].action` | string | Yes | `"long"`, `"short"`, or `"close"` |
| `trades[].size` | number | Yes | Position size in USD |
| `trades[].leverage` | number | No | Leverage multiplier |
| `trades[].mode` | string | No | `"cross"` (default) or `"isolated"` |

### Validation Rules

- Maximum of **50 trades** per batch
- The `trades` array must not be empty
- All standard validation rules from `/v1/validate` apply to each trade

## Response

Returns an object with a `results` array containing one `ValidateResponse` per trade. Each response reflects the risk assessment as if all preceding trades had been executed.

```json
{
  "results": [
    {
      "risk_score": 28,
      "recommendation": "proceed",
      "flags": [],
      "slippage": { "..." : "..." },
      "liquidation": { "..." : "..." },
      "meta": {
        "asset": "BTC",
        "mark_price": 67500.00,
        "latency_ms": 52,
        "request_id": "req_batch_001"
      }
    },
    {
      "risk_score": 55,
      "recommendation": "proceed_with_caution",
      "flags": ["correlated_exposure"],
      "slippage": { "..." : "..." },
      "liquidation": { "..." : "..." },
      "meta": {
        "asset": "ETH",
        "mark_price": 3415.20,
        "latency_ms": 48,
        "request_id": "req_batch_001"
      }
    }
  ]
}
```

The second trade (ETH long) may show a higher risk score and `correlated_exposure` flag because the wallet already has a BTC long from the first trade. This sequential evaluation is a key feature of batch validation.

Each item in `results` follows the same schema as a single [/v1/validate](/llm/api/validate.md) response.

## Use Cases

- **Portfolio construction**: Validate a set of positions before opening them
- **Rebalancing**: Check the risk of closing some positions and opening others
- **Correlation detection**: Identify when multiple trades create concentrated exposure
