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

# Portfolio Create From Template

> Create a new portfolio from a pre-defined template

Creates a new portfolio from a pre-defined template.

<ParamField body="templateId" type="string" required>
  The ID of the template to use
</ParamField>

<ParamField body="userAddress" type="string" required>
  The Ethereum address of the user who will own the portfolio
</ParamField>

<ParamField body="chainIds" type="number[]" required>
  Array of chain IDs where the portfolio will operate
</ParamField>

<ParamField body="name" type="string">
  Custom name for the portfolio (overrides template name)
</ParamField>

<ParamField body="description" type="string">
  Custom description for the portfolio (overrides template description)
</ParamField>

<ParamField body="accountIndex" type="number" default="0">
  The account index
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url '/v1/portfolios/create-from-template' \
    --header 'Content-Type: application/json' \
    --header 'X-API-KEY: your_api_key_here' \
    --data '{
      "templateId": "tmpl_xyz789",
      "userAddress": "0xYourWalletAddress",
      "chainIds": [8453],
      "name": "My Custom Template Portfolio",
      "description": "Created from a template with custom name",
      "accountIndex": 0
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "/v1/portfolios/create-from-template",
    {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        "X-API-KEY": "your_api_key_here",
      },
      body: JSON.stringify({
        templateId: "tmpl_xyz789",
        userAddress: "0xYourWalletAddress",
        chainIds: [8453], // Base chain ID
        name: "My Custom Template Portfolio",
        description: "Created from a template with custom name",
        accountIndex: 0
      }),
    }
  );

  const portfolio = await response.json();
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "success": true,
    "data": {
      "portfolioId": "port_def456",
      "message": "Portfolio created from template successfully",
      "vaults": [
        {
          "chainId": "8453",
          "address": "0xPortfolioVaultAddress"
        }
      ],
      "template": {
        "blueprintId": "tmpl_xyz789",
        "editId": "edit_def456",
        "version": 1,
        "name": "My Custom Template Portfolio"
      }
    },
    "correlationId": "corr_abc123",
    "requestId": "req_xyz789",
    "timestamp": "2023-05-21T12:34:56.789Z"
  }
  ```
</ResponseExample>
