> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apowerb.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Fetch paginated data for a chart

> Resolves the chart config by ID, executes its query, applies filters and sorting, then returns a paginated raw-data response. The frontend is responsible for mapping this to an ECharts option.



## OpenAPI

````yaml /api-reference/openapi.json get /api/v1/charts/{chart_id}/data
openapi: 3.1.0
info:
  title: apowerb API
  description: REST API of the apowerb agentic framework (open-source edition).
  version: 0.1.2
  license:
    name: MIT
    url: https://github.com/apowerb/apowerb/blob/main/LICENSE
servers:
  - url: https://api.example.com
    description: Your apowerb instance
  - url: http://localhost:8000
    description: Local stack
security: []
paths:
  /api/v1/charts/{chart_id}/data:
    get:
      tags:
        - chart-data
      summary: Fetch paginated data for a chart
      description: >-
        Resolves the chart config by ID, executes its query, applies filters and
        sorting, then returns a paginated raw-data response. The frontend is
        responsible for mapping this to an ECharts option.
      operationId: get_chart_data_api_v1_charts__chart_id__data_get
      parameters:
        - name: chart_id
          in: path
          required: true
          schema:
            type: string
            title: Chart Id
        - name: page
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            description: Page number (1-based)
            default: 1
            title: Page
          description: Page number (1-based)
        - name: page_size
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
                maximum: 100000
                minimum: 1
              - type: 'null'
            description: >-
              Rows per page. When unset, the service falls back to
              chart.source.limit (operator-configured per chart, default 1000).
              Capped at 100_000.
            title: Page Size
          description: >-
            Rows per page. When unset, the service falls back to
            chart.source.limit (operator-configured per chart, default 1000).
            Capped at 100_000.
        - name: filter_field
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Field name to filter on
            title: Filter Field
          description: Field name to filter on
        - name: filter_op
          in: query
          required: false
          schema:
            anyOf:
              - $ref: '#/components/schemas/FilterOperator'
              - type: 'null'
            description: Filter operator
            title: Filter Op
          description: Filter operator
        - name: filter_value
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Filter value
            title: Filter Value
          description: Filter value
        - name: sort_field
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Field to sort by
            title: Sort Field
          description: Field to sort by
        - name: sort_order
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/SortOrder'
            description: asc or desc
            default: desc
          description: asc or desc
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChartDataResponse'
        '404':
          description: Chart not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    FilterOperator:
      type: string
      enum:
        - eq
        - neq
        - gt
        - gte
        - lt
        - lte
        - in
        - not_in
        - contains
        - is_null
        - is_not_null
      title: FilterOperator
    SortOrder:
      type: string
      enum:
        - asc
        - desc
      title: SortOrder
    ChartDataResponse:
      properties:
        chart_id:
          type: string
          title: Chart Id
        chart_type:
          $ref: '#/components/schemas/ChartType'
        title:
          type: string
          title: Title
        labels:
          items:
            type: string
          type: array
          title: Labels
        rows:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Rows
        pagination:
          $ref: '#/components/schemas/PageMeta'
        refresh_interval:
          anyOf:
            - type: integer
            - type: 'null'
          title: Refresh Interval
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        config:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Config
        generated_at:
          type: string
          format: date-time
          title: Generated At
      type: object
      required:
        - chart_id
        - chart_type
        - title
        - labels
        - rows
        - pagination
      title: ChartDataResponse
      description: |-
        Standard raw-data envelope returned to the frontend.

        The frontend maps this to an ECharts option — the backend never builds
        chart library configs.

        Shape
        -----
        labels  — column / field names (derived from first row keys)
        rows    — one dict per data point or table row
        pagination — page metadata
      example:
        chart_id: abc-123
        chart_type: bar
        generated_at: '2026-03-17T10:00:00Z'
        labels:
          - hour
          - success
          - failed
        pagination:
          has_next: false
          has_prev: false
          page: 1
          page_size: 50
          total: 24
        refresh_interval: 60
        rows:
          - failed: 3
            hour: '00:00'
            success: 120
          - failed: 7
            hour: '01:00'
            success: 98
        title: Agent runs per hour
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ChartType:
      type: string
      enum:
        - bar
        - line
        - pie
        - donut
        - scatter
        - area
        - heatmap
        - table
        - stat
        - histogram
      title: ChartType
    PageMeta:
      properties:
        page:
          type: integer
          title: Page
        page_size:
          type: integer
          title: Page Size
        total:
          type: integer
          title: Total
        has_next:
          type: boolean
          title: Has Next
        has_prev:
          type: boolean
          title: Has Prev
      type: object
      required:
        - page
        - page_size
        - total
        - has_next
        - has_prev
      title: PageMeta
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````

## Related topics

- [List charts](/api-reference/charts/list-charts.md)
- [Get chart data (public access)](/api-reference/chart-data/get-chart-data-public-access.md)
- [Create a chart](/api-reference/charts/create-a-chart.md)
- [Partially update a chart](/api-reference/charts/partially-update-a-chart.md)
- [Get a single chart](/api-reference/charts/get-a-single-chart.md)
