﻿---
title: Manage Discover sessions programmatically
description: Create and manage Discover sessions from code with the Discover sessions API, and see how it works with the Dashboards API and the data views APIs.
url: https://docs-v3-preview.elastic.dev/elastic/docs-content/tree/main/explore-analyze/discover/manage-sessions-programmatically
products:
  - Elastic Documentation
  - Kibana
applies_to:
  - Elastic Cloud Serverless: Generally available
  - Elastic Stack: Planned
---

# Manage Discover sessions programmatically
If you keep your Kibana content in version control or deploy it from a pipeline, you can create and manage Discover sessions from code instead of saving each one by hand in **Discover**. Three APIs work together to do that:

| API                   | Kibana API docs                                                                     | Kibana Serverless API docs                                                              | Use it for                                                                                              | Result                                  |
|-----------------------|-------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|-----------------------------------------|
| Discover sessions API | [Open](https://www.elastic.co/docs/api/doc/kibana/group/endpoint-discover-sessions) | [Open](https://www.elastic.co/docs/api/doc/serverless/group/endpoint-discover-sessions) | Keeping sessions in version control and deploying them from CI/CD                                       | Saved Discover session                  |
| Dashboards API        | [Open](https://elastic.github.io/dashboards-api-spec/dashboards#tag/Dashboards)     | [Open](https://elastic.github.io/dashboards-api-spec/dashboards#tag/Dashboards)         | Showing a session on a dashboard that you also manage as code                                           | Dashboard with a Discover session panel |
| Data views v2 API     | [Open](https://www.elastic.co/docs/api/doc/kibana/group/endpoint-data-views-v2)     | [Open](https://www.elastic.co/docs/api/doc/serverless/group/endpoint-data-views-v2)     | Creating a saved data view that a session tab can use as its data source, before you deploy the session | Data view                               |


## Related pages

- [Save and manage Discover sessions](https://docs-v3-preview.elastic.dev/elastic/docs-content/tree/main/explore-analyze/discover/save-open-search)
- [Export results and sessions from Discover](https://docs-v3-preview.elastic.dev/elastic/docs-content/tree/main/explore-analyze/discover/export-discover-session)
- [Use Discover sessions in dashboards](https://docs-v3-preview.elastic.dev/elastic/docs-content/tree/main/explore-analyze/discover/use-sessions-in-dashboards)
- [Create dashboards programmatically](https://docs-v3-preview.elastic.dev/elastic/docs-content/tree/main/explore-analyze/dashboards/create-dashboards-programmatically)
- [Manage dashboards as code](https://docs-v3-preview.elastic.dev/elastic/docs-content/tree/main/explore-analyze/dashboards/manage-dashboards-as-code)
- [Manage data views from code](/elastic/docs-content/tree/main/explore-analyze/find-and-organize/data-views#data-views-from-code)