Skip to content
Closed
9 changes: 9 additions & 0 deletions explore-analyze/dashboards/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,12 @@ To create or edit dashboards, you need:
::::

* Sufficient privileges for the **Dashboard** feature. Without them, you might get a read-only indicator. A {{product.kibana}} administrator can [grant you the required privileges](../../deploy-manage/users-roles/cluster-or-deployment-auth/kibana-privileges.md).

## Create dashboards programmatically [building-programmatic]

```{applies_to}
stack: preview 9.4
serverless: preview
```

In addition to building dashboards in the {{product.kibana}} UI, you can create and manage dashboards and visualizations using APIs or AI-powered tools. Refer to [Create dashboards and visualizations programmatically](create-programmatically.md).
22 changes: 20 additions & 2 deletions explore-analyze/dashboards/create-dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,25 @@ Create a new dashboard in {{product.kibana}} to start visualizing and monitoring
:url: https://github.com/elastic/agent-skills/tree/main/skills/kibana/kibana-dashboards
:::

::::{dropdown} Create a dashboard using the API
:applies_to: { stack: preview 9.4, serverless: preview }

Use `POST /api/dashboards` to create a dashboard programmatically. You can create an empty dashboard or include panels inline:

```bash
curl -X POST "${KIBANA_URL}/api/dashboards" \
-H "Authorization: ApiKey ${API_KEY}" \
-H "kbn-xsrf: true" \
-H "Content-Type: application/json" \
-d '{
"title": "Web logs overview",
"time_range": { "from": "now-90d", "to": "now" }
}'
```

Refer to the [Dashboards API reference](https://www.elastic.co/docs/api/doc/kibana/group/endpoint-dashboards) for the full request schema, including how to add panels and controls.
::::

## Requirements [create-dashboard-requirements]

Before creating a dashboard, ensure you have:
Expand All @@ -42,7 +61,7 @@ Before creating a dashboard, ensure you have:
5. Define the main settings of your dashboard from the **Settings** menu located in the toolbar.

1. A meaningful title, description, and [tags](../find-and-organize/tags.md) allow you to find the dashboard quickly later when browsing your list of dashboards or using the {{kib}} search bar.
2. Additional display options allow you unify the look and feel of the dashboards panels:
2. Additional display options allow you unify the look and feel of the dashboard's panels:

* **Store time with dashboard** — Saves the specified time filter.
* **Use margins between panels** — Adds a margin of space between each panel.
Expand Down Expand Up @@ -71,4 +90,3 @@ Before creating a dashboard, ensure you have:

:::{include} ../_snippets/dashboard-ownership.md
:::

53 changes: 53 additions & 0 deletions explore-analyze/dashboards/create-programmatically.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
navigation_title: Create programmatically
description: Use the Dashboards API, the Lens Visualizations API, or AI-powered tools to create and manage Kibana dashboards and visualizations programmatically.
applies_to:
stack: ga
serverless: ga
products:
- id: kibana
type: overview
---

# Create dashboards and visualizations programmatically [create-programmatically]

You can create and manage Kibana dashboards and visualizations outside of the UI, using REST APIs or AI-powered tools. This is useful for automating dashboard deployments, managing them in version control, building tooling around dashboard lifecycle management, or using AI agents to generate dashboards on demand.

## Dashboards API [dashboards-api]

```{applies_to}
stack: preview 9.4
serverless: preview
```

The Dashboards API provides full CRUD access to dashboards, including their panels, controls, sections, and display options. Use it to create dashboards from code, update them programmatically, or integrate dashboard management into your own tooling.

Refer to the [Dashboards API reference](https://www.elastic.co/docs/api/doc/kibana/group/endpoint-dashboards).

## Lens Visualizations API [lens-visualizations-api]

```{applies_to}
stack: preview 9.4
serverless: preview
```

The Lens Visualizations API lets you create and manage reusable Lens visualizations as saved objects. Once created, a visualization can be embedded in a dashboard by reference. Use it to build a library of reusable charts and metrics that can be shared across multiple dashboards.

Refer to the [Lens Visualizations API reference](https://www.elastic.co/docs/api/doc/kibana/group/endpoint-lens).

## Kibana dashboards agent skill [dashboards-agent-skill]

The Kibana dashboards agent skill enables AI agents and LLM-powered tools to create and manage dashboards through natural language instructions. It is designed for agentic workflows where a language model generates dashboard definitions and applies them automatically.

Refer to the [kibana-dashboards agent skill](https://github.com/elastic/agent-skills/tree/main/skills/kibana/kibana-dashboards) on GitHub.

## Agent Builder dashboard tools [agent-builder-dashboard-tools]

```{applies_to}
stack: preview 9.4
serverless: preview
```

Elastic's built-in AI assistant includes dashboard tools that let you create and update dashboards through a chat interface, without leaving the Kibana UI. Describe what you want to build, and the assistant generates the dashboard for you.

Refer to [Agent Builder](../ai-features/elastic-agent-builder.md) for an overview of the available built-in tools.
110 changes: 109 additions & 1 deletion explore-analyze/kibana-data-exploration-learning-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ You've queried, filtered, aggregated, and inspected data, all within Discover us

## Step 3: Build your dashboard [build-your-dashboard]

Now that you have a dashboard with your first panel, add more visualizations to tell a complete story about your web traffic.
Now that you have a dashboard with your first panel, add more visualizations to tell a complete story about your web traffic. You can also [recreate this dashboard using the API](#learn-tutorial-create-programmatically) once you have completed the tutorial.

::::::{stepper}

Expand Down Expand Up @@ -372,6 +372,114 @@ When you are happy with the layout, select **Save** in the toolbar.

::::::

### Create this dashboard using the API [learn-tutorial-create-programmatically]

::::{dropdown} Recreate the Web logs overview dashboard with one API call
:applies_to: { stack: preview 9.4, serverless: preview }

Once you know what the finished dashboard looks like, you can create it programmatically using the Dashboards API. The following request creates the full dashboard built in this tutorial.

```bash
curl -X POST "${KIBANA_URL}/api/dashboards" \
-H "Authorization: ApiKey ${API_KEY}" \
-H "kbn-xsrf: true" \
-H "Content-Type: application/json" \
-d '{
"title": "Web logs overview",
"time_range": { "from": "now-90d", "to": "now" },
"panels": [
{
"type": "lens",
"grid": { "x": 0, "y": 0, "w": 12, "h": 5 },
"config": {
"attributes": {
"title": "Median response size",
"type": "metric",
"dataset": { "type": "index", "index": "kibana_sample_data_logs", "time_field": "@timestamp" },
"metrics": [{ "type": "primary", "operation": "median", "field": "bytes", "format": { "type": "bytes" } }]
}
}
},
{
"type": "lens",
"grid": { "x": 0, "y": 5, "w": 48, "h": 12 },
"config": {
"attributes": {
"title": "Log volume over time per host",
"type": "xy",
"layers": [{
"type": "line",
"dataset": { "type": "index", "index": "kibana_sample_data_logs", "time_field": "@timestamp" },
"x": { "operation": "date_histogram", "field": "@timestamp" },
"y": [{ "operation": "count" }],
"breakdown": { "operation": "terms", "fields": ["host.keyword"], "size": 10 }
}]
}
}
},
{
"type": "lens",
"grid": { "x": 0, "y": 17, "w": 24, "h": 10 },
"config": {
"attributes": {
"title": "Requests by file extension",
"type": "xy",
"layers": [{
"type": "bar",
"dataset": { "type": "index", "index": "kibana_sample_data_logs", "time_field": "@timestamp" },
"x": { "operation": "terms", "fields": ["extension.keyword"], "size": 10 },
"y": [{ "operation": "count" }]
}]
}
}
},
{
"type": "lens",
"grid": { "x": 24, "y": 17, "w": 24, "h": 10 },
"config": {
"attributes": {
"title": "Events by response code",
"type": "xy",
"layers": [{
"type": "bar",
"dataset": {
"type": "esql",
"query": "FROM kibana_sample_data_logs | WHERE response IS NOT NULL | STATS event_count = COUNT(*) BY response"
},
"x": { "operation": "value", "column": "response" },
"y": [{ "operation": "value", "column": "event_count" }]
}]
}
}
},
{
"type": "lens",
"grid": { "x": 0, "y": 27, "w": 48, "h": 12 },
"config": {
"attributes": {
"title": "",
"type": "datatable",
"dataset": {
"type": "esql",
"query": "FROM kibana_sample_data_logs | KEEP @timestamp, request, response, bytes | SORT @timestamp DESC | LIMIT 100"
},
"metrics": [
{ "operation": "value", "column": "@timestamp" },
{ "operation": "value", "column": "request" },
{ "operation": "value", "column": "response" },
{ "operation": "value", "column": "bytes" }
],
"rows": []
}
}
}
]
}'
```

Refer to the [Dashboards API reference](https://www.elastic.co/docs/api/doc/kibana/group/endpoint-dashboards) for the full schema.
::::

Your dashboard now combines multiple panel types built with Lens, and you've seen how inline editing and interactive filtering make the dashboard both customizable and interactive. To learn more, refer to [Dashboards](dashboards.md), [Lens](visualize/lens.md), and [Panels and visualizations](visualize.md).

## Step 4: Share the dashboard [share-the-dashboard]
Expand Down
1 change: 1 addition & 0 deletions explore-analyze/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ toc:
- file: dashboards/building.md
children:
- file: dashboards/create-dashboard.md
- file: dashboards/create-programmatically.md
- file: dashboards/open-dashboard.md
- file: dashboards/add-controls.md
- file: dashboards/drilldowns.md
Expand Down
Loading