> ## Documentation Index
> Fetch the complete documentation index at: https://docs.glider.fi/llms.txt
> Use this file to discover all available pages before exploring further.

# Validate Strategy

> Runs the same validation gates as Create Strategy without persisting anything.

A side-effect-free dry-run of `POST /v2/strategies`. Useful for pre-flight
checks before submitting a create request — for example, to enable or disable
a submit button, surface inline form errors, or preview which assets in an
allocation would be rejected.

The endpoint accepts the **same request body** as Create Strategy and runs
the **same validation gates** in the same order:

1. **Asset validation** — every `assetId` must be recognized and not
   blocked.
2. **Structural validation** — CAIP-19 parsing, weight sum (must total
   100\), no duplicate assets, and allocation shape.

A 200 response is a faithful predictor of a Create Strategy success at the
moment the call is made. Asset availability can change between the validate
and create calls, so a passing dry-run is not a guarantee — clients should
still handle a 400 from the actual create.

* Auth: `x-api-key` header (required)
* Scope: `strategies:write`

Common error responses:

* `400` when the asset gate or allocation validation fails
* `401` when `x-api-key` header is missing or the key is invalid
* `403` when the API key lacks the `strategies:write` scope
* `500` on unexpected server errors

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://api.glider.fi/v2/strategies/validate' \
    --header 'x-api-key: gldr_sk_your_api_key' \
    --header 'Content-Type: application/json' \
    --data '{
      "name": "Balanced Growth",
      "description": "Multi-chain balanced allocation strategy",
      "allocation": {
        "assets": [
          { "assetId": "eip155:1/erc20:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "weight": "60" },
          { "assetId": "eip155:1/erc20:0xdac17f958d2ee523a2206206994597c13d831ec7", "weight": "40" }
        ]
      },
      "schedule": {
        "type": "interval",
        "frequency": "daily"
      },
      "preferences": {
        "swap": {
          "slippageBps": 300,
          "priceImpactBps": 300,
          "thresholdUsd": "5.00"
        }
      }
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://api.glider.fi/v2/strategies/validate", {
    method: "POST",
    headers: {
      "x-api-key": "gldr_sk_your_api_key",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      name: "Balanced Growth",
      allocation: {
        assets: [
          { assetId: "eip155:1/erc20:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", weight: "60" },
          { assetId: "eip155:1/erc20:0xdac17f958d2ee523a2206206994597c13d831ec7", weight: "40" },
        ],
      },
      schedule: { type: "interval", frequency: "daily" },
      preferences: { swap: { slippageBps: 300, thresholdUsd: "5.00" } },
    }),
  });
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "data": {
      "valid": true
    }
  }
  ```

  ```json 400 Asset blocklisted theme={null}
  {
    "success": false,
    "error": {
      "code": "API_400",
      "message": "Asset(s) are blocklisted and cannot be used in a strategy: eip155:1/erc20:0xaaa",
      "details": ["Asset(s) are blocklisted and cannot be used in a strategy: eip155:1/erc20:0xaaa"]
    }
  }
  ```

  ```json 400 Asset not recognized theme={null}
  {
    "success": false,
    "error": {
      "code": "API_400",
      "message": "Asset(s) are not recognized as valid tokens: eip155:1/erc20:0xdead",
      "details": ["Asset(s) are not recognized as valid tokens: eip155:1/erc20:0xdead"]
    }
  }
  ```

  ```json 400 Allocation weights theme={null}
  {
    "success": false,
    "error": {
      "code": "API_400",
      "message": "Strategy validation failed: Allocation weights must sum to 100",
      "details": ["Allocation weights must sum to 100"]
    }
  }
  ```
</ResponseExample>
