# Get stack chart payload with version segments (/indexify-api-documentation/market-data/get-stack-chart-payload)

```json
[
  {
    "path": "/api/charts.php?action=stack-chart-payload",
    "method": "get",
    "operationId": "getStackChartPayload",
    "summary": "Get stack chart payload with version segments",
    "description": "Returns token amounts for each allocation version segment so the frontend can build accurate historical charts across allocation edits. Includes a `segments` array with time ranges and per-version base amounts, plus a backwards-compatible `tokens` field with the current allocation.\n",
    "security": [],
    "parameters": [
      {
        "name": "slug",
        "in": "query",
        "schema": {
          "type": "string"
        },
        "description": "Stack slug (either slug or stack_id required)."
      },
      {
        "name": "stack_id",
        "in": "query",
        "schema": {
          "type": "integer"
        },
        "description": "Stack ID (either slug or stack_id required)."
      },
      {
        "name": "bucket",
        "in": "query",
        "schema": {
          "type": "string",
          "enum": [
            "1s",
            "1m",
            "5m",
            "30m",
            "1h",
            "24h"
          ],
          "default": "5m"
        },
        "description": "Chart candle bucket size."
      },
      {
        "name": "endTime",
        "in": "query",
        "schema": {
          "type": "integer"
        },
        "description": "End timestamp for pagination."
      },
      {
        "name": "includeTokenValues",
        "in": "query",
        "schema": {
          "type": "string",
          "enum": [
            "true",
            "false"
          ]
        },
        "description": "Whether to include per-token values in the chart response."
      }
    ],
    "responses": {
      "200": {
        "description": "Chart payload with version segments.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "stack_id": {
                  "type": "integer"
                },
                "payload": {
                  "type": "object",
                  "properties": {
                    "segments": {
                      "type": "array",
                      "description": "Version segments ordered chronologically. Each segment represents one allocation version with its time range and token base amounts.\n",
                      "items": {
                        "type": "object",
                        "properties": {
                          "version": {
                            "type": "integer",
                            "description": "Version number (matches version_history endpoint)."
                          },
                          "start": {
                            "type": "integer",
                            "description": "Unix timestamp when this allocation became active."
                          },
                          "end": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "Unix timestamp when this allocation was replaced. null for the current live allocation.\n"
                          },
                          "tokens": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "address": {
                                  "type": "string",
                                  "description": "Solana token address."
                                },
                                "amount": {
                                  "type": "number",
                                  "description": "Base token amount for this version."
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "tokens": {
                      "type": "array",
                      "description": "Current base token amounts (backwards compatibility).",
                      "items": {
                        "type": "object",
                        "properties": {
                          "address": {
                            "type": "string"
                          },
                          "amount": {
                            "type": "number"
                          }
                        }
                      }
                    },
                    "bucket": {
                      "type": "string"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "includeTokenValues": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "400": {
        "description": "Missing parameters or invalid bucket.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "404": {
        "description": "Stack not found or no base token amounts.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    }
  }
]
```