> ## 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.

# Create Strategy

> Creates a new strategy with an initial allocation version.

Creates a strategy from a flat list of asset allocations with a rebalance
schedule and optional swap preferences. Allocations are validated before the
strategy is persisted.

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

Asset IDs use CAIP-19 format (e.g., `eip155:1/erc20:0xa0b8...`). Allocation
weights are string percentages that must sum to 100.

Schedule and preferences are stored separately and can be updated independently
via `PUT /v2/strategies/:id/schedule` and `PATCH /v2/strategies/:id/preferences`.

Common error responses:

* `400` when the request body or allocation is invalid
* `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' \
    --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", {
    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 201 theme={null}
  {
    "success": true,
    "data": {
      "strategyId": "01JWZEE2MF30KVRMRX53N88VA4",
      "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": null,
          "thresholdUsd": "5.00"
        }
      },
      "isPublic": false,
      "version": 1,
      "createdAt": "2026-04-17T12:00:00.000Z"
    }
  }
  ```

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