Skip to main content

Dashboards API

Panel-based dashboards with SPL2 queries, 12-column grid layout, and template variables. Each panel runs an independent SPL2 query with its own time range.

GET /dashboards

List all dashboards.

curl -s localhost:3100/api/v1/dashboards | jq .

Response (200):

{
"data": {
"dashboards": [
{
"id": "dsh_abc123",
"name": "Production Overview",
"created_at": "2026-02-10T12:00:00Z",
"updated_at": "2026-02-14T08:00:00Z",
"panels_count": 6
},
{
"id": "dsh_def456",
"name": "API Performance",
"created_at": "2026-02-11T09:00:00Z",
"updated_at": "2026-02-13T16:30:00Z",
"panels_count": 4
}
]
}
}

POST /dashboards

Create a dashboard.

Request Body

FieldTypeRequiredDescription
namestringYesDashboard name
panelsarrayYesArray of panel definitions
variablesarrayNoTemplate variables for dynamic filtering

Panel Object

FieldTypeRequiredDefaultDescription
idstringYes--Unique panel identifier (within dashboard)
titlestringYes--Panel display title
typestringYes--Visualization: timechart, table, bar, line, area, stat, pie
qstringYes--SPL2 query
fromstringNo"-1h"Time range start
positionobjectYes--Grid position {x, y, w, h}

Position Object

The dashboard uses a 12-column grid layout:

FieldTypeDescription
xintegerColumn position (0--11)
yintegerRow position (0-based)
wintegerWidth in grid units (1--12)
hintegerHeight in grid units

Variable Object

FieldTypeRequiredDescription
namestringYesVariable name (used as $name in queries)
typestringYesfield_values (auto-populated from field) or custom
fieldstringYesField to populate values from
defaultstringNoDefault value
labelstringNoDisplay label

Full Example

curl -X POST localhost:3100/api/v1/dashboards \
-d '{
"name": "Production Overview",
"panels": [
{
"id": "p1",
"title": "Error Rate",
"type": "timechart",
"q": "level=error | timechart count span=5m",
"from": "-6h",
"position": {"x": 0, "y": 0, "w": 6, "h": 4}
},
{
"id": "p2",
"title": "Top Error Sources",
"type": "table",
"q": "level=error | stats count by source | sort -count | head 10",
"from": "-1h",
"position": {"x": 6, "y": 0, "w": 6, "h": 4}
},
{
"id": "p3",
"title": "Total Events",
"type": "stat",
"q": "| stats count",
"from": "-24h",
"position": {"x": 0, "y": 4, "w": 3, "h": 2}
},
{
"id": "p4",
"title": "Error Percentage",
"type": "stat",
"q": "| stats count(eval(level=\"error\")) as errors, count as total | eval pct=round(errors/total*100, 1)",
"from": "-1h",
"position": {"x": 3, "y": 4, "w": 3, "h": 2}
},
{
"id": "p5",
"title": "Status Distribution",
"type": "pie",
"q": "source=nginx | stats count by status",
"from": "-1h",
"position": {"x": 6, "y": 4, "w": 6, "h": 4}
},
{
"id": "p6",
"title": "Latency by Endpoint",
"type": "bar",
"q": "source=api-gateway | stats avg(duration_ms) as avg_lat, p99(duration_ms) as p99_lat by endpoint | sort -avg_lat | head 10",
"from": "-1h",
"position": {"x": 0, "y": 6, "w": 6, "h": 4}
}
],
"variables": [
{
"name": "source",
"type": "field_values",
"field": "source",
"default": "*",
"label": "Source"
}
]
}'

Response (201):

{
"data": {
"id": "dsh_abc123",
"name": "Production Overview",
"panels": [
{
"id": "p1",
"title": "Error Rate",
"type": "timechart",
"q": "level=error | timechart count span=5m",
"from": "-6h",
"position": {"x": 0, "y": 0, "w": 6, "h": 4}
}
],
"variables": [
{
"name": "source",
"type": "field_values",
"field": "source",
"default": "*",
"label": "Source"
}
],
"created_at": "2026-02-14T14:52:00Z",
"updated_at": "2026-02-14T14:52:00Z"
}
}

GET /dashboards/{id}

Get the full dashboard definition including all panels and variables.

curl -s localhost:3100/api/v1/dashboards/dsh_abc123 | jq .

Response (200):

{
"data": {
"id": "dsh_abc123",
"name": "Production Overview",
"panels": [
{
"id": "p1",
"title": "Error Rate",
"type": "timechart",
"q": "level=error | timechart count span=5m",
"from": "-6h",
"position": {"x": 0, "y": 0, "w": 6, "h": 4}
},
{
"id": "p2",
"title": "Top Error Sources",
"type": "table",
"q": "level=error | stats count by source | sort -count | head 10",
"from": "-1h",
"position": {"x": 6, "y": 0, "w": 6, "h": 4}
}
],
"variables": [
{
"name": "source",
"type": "field_values",
"field": "source",
"default": "*",
"label": "Source"
}
],
"created_at": "2026-02-10T12:00:00Z",
"updated_at": "2026-02-14T08:00:00Z"
}
}

Error Responses

StatusCodeDescription
404NOT_FOUNDDashboard not found

PUT /dashboards/{id}

Replace a dashboard definition. This is a full replacement -- include all panels and variables.

Path Parameters

ParameterRequiredDescription
idYesDashboard ID
curl -X PUT localhost:3100/api/v1/dashboards/dsh_abc123 \
-d '{
"name": "Production Overview (v2)",
"panels": [
{
"id": "p1",
"title": "Error Rate (5m buckets)",
"type": "timechart",
"q": "level=error | timechart count span=5m",
"from": "-12h",
"position": {"x": 0, "y": 0, "w": 12, "h": 4}
},
{
"id": "p2",
"title": "Top Error Sources",
"type": "table",
"q": "level=error | stats count by source | sort -count | head 20",
"from": "-1h",
"position": {"x": 0, "y": 4, "w": 6, "h": 4}
},
{
"id": "p3",
"title": "Status Codes",
"type": "pie",
"q": "source=nginx | stats count by status",
"from": "-1h",
"position": {"x": 6, "y": 4, "w": 6, "h": 4}
}
],
"variables": [
{
"name": "source",
"type": "field_values",
"field": "source",
"default": "*",
"label": "Source"
}
]
}'

Response (200): Updated dashboard object.

Error Responses

StatusCodeDescription
404NOT_FOUNDDashboard not found

DELETE /dashboards/{id}

Delete a dashboard.

curl -X DELETE localhost:3100/api/v1/dashboards/dsh_abc123

Response: 204 No Content


Panel Types

TypeDescriptionBest For
timechartTime-series line chartTrends over time (timechart command)
tableTabular datastats, top, table results
barBar chartComparing values across categories
lineLine chartNon-time numeric series
areaArea chartStacked or filled time series
statSingle numberKPIs, counters, percentages
piePie/donut chartDistribution of values

Template Variables

Template variables enable dynamic filtering across all panels. When a user selects a value from the variable dropdown, panels re-execute their queries with the variable value substituted.

Reference variables in panel queries with $variable_name:

{
"panels": [
{
"id": "p1",
"title": "Error Rate by Source",
"type": "timechart",
"q": "source=$source level=error | timechart count span=5m",
"from": "-6h",
"position": {"x": 0, "y": 0, "w": 12, "h": 4}
}
],
"variables": [
{
"name": "source",
"type": "field_values",
"field": "source",
"default": "*",
"label": "Source"
}
]
}

Variable types:

  • field_values -- auto-populated from the GET /fields/{name}/values endpoint
  • custom -- manually defined list of values