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

# Quickstart

> Create and automate a portfolio in 5 simple steps

This quickstart guide will get you up and running with a fully automated portfolio in just 5 simple steps.

## Authentication

<Note>
  Glider is currently in early access. Sign up for the waitlist on the [Glider
  App](https://glider.fi/).
</Note>

<Steps titleSize="h3">
  <Step title="Prerequisites">
    Before you begin, you'll need:

    1. A Glider platform account
    2. An API key for authentication
    3. A wallet for signing portfolio creation and transaction permissions
  </Step>

  <Step title="Authenticate">
    First, you need to get an API key that will authenticate your requests to the Glider API.

    1. Log in to the [Glider platform](https://glider.fi)
    2. Navigate to your profile settings
    3. Select "API Keys" and create a new key
    4. Store your API key securely - you'll need to include it in the header of all API requests

    <CodeGroup>
      ```bash curl theme={null}
      # Example of including your API key in requests
      curl -H "X-API-KEY: your_api_key_here" https://api.glider.fi/v1/...
      ```

      ```javascript javascript theme={null}
      // Example of including your API key in requests
      const response = await fetch("https://api.glider.fi/v1/...", {
        headers: { "X-API-KEY": "your_api_key_here" },
        ...
      });
      ```
    </CodeGroup>
  </Step>

  <Step title="API Response Format">
    <Note>
      **V1 and V2 use different envelopes.** V1 (legacy consumer endpoints)
      includes `correlationId`, `requestId`, and `timestamp` in the JSON body.
      V2 (the integrator API at `/v2`) places these in response headers only —
      `X-Correlation-Id` and `X-Request-Id`. See the
      [V2 overview](/api-reference/v2-overview) for the full v2 envelope.
    </Note>

    **V1 envelope** — success:

    ```json theme={null}
    {
      "success": true, // or false for errors
      "data": {
        // Response data varies by endpoint
      },
      "correlationId": "corr_abcd1234", // For request tracking
      "requestId": "req_efgh5678", // For request tracking
      "timestamp": "2023-05-21T12:34:56.789Z" // ISO timestamp
    }
    ```

    **V1 envelope** — error:

    ```json theme={null}
    {
      "success": false,
      "error": {
        "code": "ERROR_CODE", // Specific error code
        "message": "Human-readable error message",
        "details": { // Optional additional details
          // Error-specific information
        }
      },
      "correlationId": "corr_abcd1234",
      "requestId": "req_efgh5678",
      "timestamp": "2023-05-21T12:34:56.789Z"
    }
    ```

    **V2 envelope** — success:

    ```json theme={null}
    {
      "success": true,
      "data": { /* endpoint-specific */ },
      "nextCursor": "eyJjIjoi..." // paginated endpoints only
    }
    ```

    **V2 envelope** — error:

    ```json theme={null}
    {
      "success": false,
      "error": {
        "code": "API_400",
        "message": "Request validation failed",
        "details": ["field: reason"]
      }
    }
    ```

    V2 tracing identifiers are in the `X-Correlation-Id` and `X-Request-Id`
    response headers — never in the body.
  </Step>
</Steps>

## 5-Step Portfolio Creation

### 1. Get a signature request

Request a message that your user will sign to authorize portfolio creation:

```javascript theme={null}
const signatureResponse = await fetch('https://api.glider.fi/v1/portfolio/create/signature', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-KEY': API_KEY,
  },
  body: JSON.stringify({
    userAddress: '0xUserWalletAddress',
    chainIds: [8453], // Base chain
  }),
});

const signatureData = await signatureResponse.json();
```

### 2. Sign and create the portfolio

Have the user sign the message, then create the portfolio:

```javascript theme={null}
// Sign with user's wallet (using ethers, viem, or similar)
const signature = await wallet.signMessage(
  signatureData.data.signatureAction.message
);

// Create the portfolio with the signature
const createResponse = await fetch('https://api.glider.fi/v1/portfolio/create', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-KEY': API_KEY,
  },
  body: JSON.stringify({
    ...signatureData.data,
    signature,
    templateData: {
      name: 'ETH-USDC Portfolio',
      description: 'A simple ETH-USDC portfolio',
      entry: {
        blockType: 'weight',
        weightType: 'specified-percentage',
        weightings: ['70', '30'],
        children: [
          {
            blockType: 'asset',
            assetId: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE:8453' // ETH
          },
          {
            blockType: 'asset',
            assetId: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913:8453' // USDC
          }
        ]
      },
      tradingSettings: {
        type: 'threshold',
        triggerPercentage: 5
      }
    }
  }),
});

const portfolio = await createResponse.json();
const portfolioId = portfolio.data.portfolioId;
```

### 3. Verify portfolio creation

Check that your portfolio was created successfully:

```javascript theme={null}
const getPortfolioResponse = await fetch(`https://api.glider.fi/v1/portfolio/${portfolioId}`, {
  method: 'GET',
  headers: {
    'X-API-KEY': API_KEY,
  },
});

const portfolioDetails = await getPortfolioResponse.json();
console.log(`Portfolio created: ${portfolioDetails.data.name}`);
```

### 4. Deposit assets

Generate deposit instructions for your user:

```javascript theme={null}
const depositResponse = await fetch(`https://api.glider.fi/v1/portfolio/${portfolioId}/deposit`, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-KEY': API_KEY,
  },
  body: JSON.stringify({
    token: {
      chainId: 8453,
      address: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE', // ETH
      amount: '0.1' // 0.1 ETH
    }
  }),
});

const depositData = await depositResponse.json();
// Provide this to your frontend for user to confirm transaction
```

### 5. Start automation

Enable automatic rebalancing for your portfolio:

```javascript theme={null}
const startResponse = await fetch(`https://api.glider.fi/v1/portfolio/${portfolioId}/start`, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-KEY': API_KEY,
  },
  body: JSON.stringify({
    runRebalanceImmediately: true,
    interval: {
      every: 86400000, // Daily (24 hours in milliseconds)
    }
  }),
});

const startData = await startResponse.json();
console.log('Portfolio automation started!');
```

That's it! You now have a fully automated portfolio that will rebalance daily or whenever assets drift more than 5% from target allocations.

## Next Steps

For more detailed guides, check out:

* [Portfolio Creation](/guides/portfolio-creation)
* [Portfolio Updating](/guides/portfolio-updating)
* [Deposit Assets](/guides/portfolio-deposits)
* [API Reference](/api-reference/endpoints/portfolio-management)
