Skip to main content
POST
/
v2
/
strategies
/
validate
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"
      }
    }
  }'
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" } },
  }),
});
{
  "success": true,
  "data": {
    "valid": true
  }
}
{
  "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"]
  }
}
{
  "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"]
  }
}
{
  "success": false,
  "error": {
    "code": "API_400",
    "message": "Strategy validation failed: Allocation weights must sum to 100",
    "details": ["Allocation weights must sum to 100"]
  }
}
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
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"
      }
    }
  }'
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" } },
  }),
});
{
  "success": true,
  "data": {
    "valid": true
  }
}
{
  "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"]
  }
}
{
  "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"]
  }
}
{
  "success": false,
  "error": {
    "code": "API_400",
    "message": "Strategy validation failed: Allocation weights must sum to 100",
    "details": ["Allocation weights must sum to 100"]
  }
}