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

> Update a portfolio's template data

Updates a portfolio's template data (asset allocations, trading settings, etc.). Both `PUT` and `POST` methods are supported.

<ParamField path="portfolioId" type="string" required>
  The unique identifier of the portfolio
</ParamField>

<ParamField body="templateData" type="object" required>
  The portfolio template data
</ParamField>

<ParamField body="templateData.name" type="string">
  The name of the portfolio
</ParamField>

<ParamField body="templateData.description" type="string">
  The description of the portfolio
</ParamField>

<ParamField body="templateData.entry" type="object" required>
  The root entry point for the portfolio template structure
</ParamField>

<ParamField body="templateData.tradingSettings" type="object">
  Settings that control how and when the portfolio is rebalanced
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request PUT \
    --url '/v1/portfolio/port_abc123' \
    --header 'Content-Type: application/json' \
    --header 'X-API-KEY: your_api_key_here' \
    --data '{
      "templateData": {
        "name": "Updated 70/30 ETH-USDC Portfolio",
        "description": "A simple portfolio with 70% ETH and 30% USDC allocation",
        "entry": {
          "blockType": "weight",
          "weightType": "specified-percentage",
          "weightings": ["70", "30"],
          "children": [
            {
              "blockType": "asset",
              "assetId": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE:8453"
            },
            {
              "blockType": "asset",
              "assetId": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913:8453"
            }
          ]
        },
        "tradingSettings": {
          "type": "threshold",
          "triggerPercentage": 5
        }
      }
    }'
  ```

  ```javascript JavaScript theme={null}
  const portfolioId = "port_abc123";
  const updateResponse = await fetch(
    `/v1/portfolio/${portfolioId}`,
    {
      method: "PUT", // or POST
      headers: {
        "Content-Type": "application/json",
        "X-API-KEY": "your_api_key_here",
      },
      body: JSON.stringify({
        templateData: {
          name: "Updated 70/30 ETH-USDC Portfolio",
          description: "A simple portfolio with 70% ETH and 30% USDC allocation",
          entry: {
            blockType: "weight",
            weightType: "specified-percentage",
            weightings: ["70", "30"],
            children: [
              {
                blockType: "asset",
                assetId: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE:8453"
              },
              {
                blockType: "asset",
                assetId: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913:8453"
              },
            ],
          },
          tradingSettings: {
            type: "threshold",
            triggerPercentage: 5
          }
        }
      }),
    }
  );

  const updatedPortfolio = await updateResponse.json();
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "success": true,
    "data": {
      "portfolioId": "port_abc123",
      "message": "Portfolio template updated successfully",
      "httpMethod": "PUT",
      "blueprint": {
        "blueprintId": "tmpl_xyz789",
        "editId": "edit_abc123",
        "version": 2,
        "name": "Updated 70/30 ETH-USDC Portfolio"
      }
    },
    "correlationId": "corr_abc123",
    "requestId": "req_xyz789",
    "timestamp": "2023-05-21T13:45:12.345Z"
  }
  ```
</ResponseExample>
