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

> Create a new portfolio using a signed message

Creates a new portfolio using the signed message from the previous step.

<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="accountIndex" type="number" default="0">
  The account index
</ParamField>

<ParamField body="kernelVersion" type="string" required>
  The kernel version (from signature request response)
</ParamField>

<ParamField body="signatureAction" type="object" required>
  The signature action object from the signature request response
</ParamField>

<ParamField body="signature" type="string" required>
  The signature obtained from the user's wallet
</ParamField>

<ParamField body="templateData" type="object">
  Optional template data to initialize the portfolio
</ParamField>

<ParamField header="X-API-KEY" type="string" required>
  Your API key for authentication
</ParamField>

<ParamField header="Content-Type" type="string" default="application/json">
  The format of the request body
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url '/v1/portfolio/create' \
    --header 'Content-Type: application/json' \
    --header 'X-API-KEY: your_api_key_here' \
    --data '{
      "userAddress": "0xYourWalletAddress",
      "chainIds": [8453],
      "accountIndex": 0,
      "kernelVersion": "0.3.2",
      "signatureAction": {
        "reason": "portfolio-permission",
        "type": "personal_sign",
        "message": "I authorize Glider to manage my portfolio\n\n0x8ad4d95c3c3d0a1e87bfdb1d2401905db4a97d8e05e77d69e5d79397da128b81"
      },
      "signature": "0xYourSignatureFromWallet",
      "templateData": {
        "name": "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"
            }
          ]
        }
      }
    }'
  ```

  ```javascript JavaScript theme={null}
  const createResponse = await fetch(
    "/v1/portfolio/create",
    {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        "X-API-KEY": "your_api_key_here",
      },
      body: JSON.stringify({
        // Include all the data from the signature request
        userAddress: "0xYourWalletAddress",
        chainIds: [8453],
        accountIndex: 0,
        kernelVersion: "0.3.2",
        signatureAction: signatureData.data.signatureAction,
        // Add the signature obtained from wallet
        signature: "0xYourSignatureFromWallet",
        // Optionally specify the portfolio template
        templateData: {
          name: "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" // ETH on Base
              },
              {
                blockType: "asset",
                assetId: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913:8453" // USDC on Base
              },
            ],
          }
        }
      }),
    }
  );

  const portfolio = await createResponse.json();
  const portfolioId = portfolio.data.portfolioId;
  ```
</RequestExample>

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