Upsert a Discover session Generally available; added in 9.6.0

PUT /api/discover_sessions/{id}

Spaces method and path for this operation:

put /s/{space_id}/api/discover_sessions/{id}

Refer to Spaces for more information.

Creates a Discover session with the specified ID, or fully replaces the existing session.

Headers

  • kbn-xsrf string Required

    A required header to protect against CSRF attacks

Path parameters

  • id string Required

    The unique ID of the Discover session to create or replace.

application/json

Body

  • description string

    A short description of the Discover session.

    Maximum length is 10000. Default value is empty.

  • tabs array[object] Required

    Ordered list of tabs in the Discover session. Each tab requires a stable, unique ID, which other saved objects and links can reference.

    At least 1 but not more than 25 elements.

    A Discover tab definition. data_source.type identifies the data source; type identifies the tab type. The tab type describes the saved settings and does not change how Discover displays the tab. Default tabs support data views and ES|QL; metrics tabs support only ES|QL.

    Any of:
  • tags array[string]

    Tag IDs to associate with this Discover session.

    Not more than 1000 elements. Maximum length of each is 250. Default value is [] (empty).

  • title string Required

    The title of the Discover session.

    Minimum length is 1, maximum length is 1000.

Responses

  • 200 application/json

    Updated

    Hide response attributes Show response attributes object
    • data object Required

      Configuration data for a Discover session.

      Additional properties are NOT allowed.

      Hide data attributes Show data attributes object
      • description string

        A short description of the Discover session.

        Maximum length is 10000. Default value is empty.

      • tabs array[object] Required

        Ordered list of tabs in the Discover session. Each tab requires a stable, unique ID, which other saved objects and links can reference.

        At least 1 but not more than 25 elements.

        A Discover tab definition. data_source.type identifies the data source; type identifies the tab type. The tab type describes the saved settings and does not change how Discover displays the tab. Default tabs support data views and ES|QL; metrics tabs support only ES|QL.

        Any of:
      • tags array[string]

        Tag IDs to associate with this Discover session.

        Not more than 1000 elements. Maximum length of each is 250. Default value is [] (empty).

      • title string Required

        The title of the Discover session.

        Minimum length is 1, maximum length is 1000.

    • id string Required

      The Discover session ID.

    • meta object Required

      Additional properties are NOT allowed.

      Hide meta attributes Show meta attributes object
      • created_at string

        Timestamp when the object was created (ISO 8601).

      • created_by string

        User profile ID of the user who created the object.

      • managed boolean

        When true, the object is managed by Kibana and cannot be edited by users.

      • owner string

        Identifier of the plugin or team that owns this object.

      • updated_at string

        Timestamp when the object was last updated (ISO 8601).

      • updated_by string

        User profile ID of the user who last updated the object.

      • version string

        Internal version identifier for optimistic concurrency control.

  • 201 application/json

    Created

    Hide response attributes Show response attributes object
    • data object Required

      Configuration data for a Discover session.

      Additional properties are NOT allowed.

      Hide data attributes Show data attributes object
      • description string

        A short description of the Discover session.

        Maximum length is 10000. Default value is empty.

      • tabs array[object] Required

        Ordered list of tabs in the Discover session. Each tab requires a stable, unique ID, which other saved objects and links can reference.

        At least 1 but not more than 25 elements.

        A Discover tab definition. data_source.type identifies the data source; type identifies the tab type. The tab type describes the saved settings and does not change how Discover displays the tab. Default tabs support data views and ES|QL; metrics tabs support only ES|QL.

        Any of:
      • tags array[string]

        Tag IDs to associate with this Discover session.

        Not more than 1000 elements. Maximum length of each is 250. Default value is [] (empty).

      • title string Required

        The title of the Discover session.

        Minimum length is 1, maximum length is 1000.

    • id string Required

      The Discover session ID.

    • meta object Required

      Additional properties are NOT allowed.

      Hide meta attributes Show meta attributes object
      • created_at string

        Timestamp when the object was created (ISO 8601).

      • created_by string

        User profile ID of the user who created the object.

      • managed boolean

        When true, the object is managed by Kibana and cannot be edited by users.

      • owner string

        Identifier of the plugin or team that owns this object.

      • updated_at string

        Timestamp when the object was last updated (ISO 8601).

      • updated_by string

        User profile ID of the user who last updated the object.

      • version string

        Internal version identifier for optimistic concurrency control.

  • 400

    Invalid request

  • 403

    Forbidden

  • 409

    Conflict

PUT /api/discover_sessions/{id}
curl -X PUT "${KIBANA_URL}/api/discover_sessions/web-log-requests" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -H "elastic-api-version: 2023-10-31" \
  -H "kbn-xsrf: true" \
  -H "Content-Type: application/json" \
  -d '{
  "title": "Requests by extension",
  "description": "",
  "tags": [],
  "tabs": [
    {
      "id": "requests",
      "label": "Requests",
      "type": "default",
      "data_source": {
        "type": "esql",
        "query": "FROM kibana_sample_data_logs | STATS requests = COUNT(*) BY extension | SORT requests DESC"
      },
      "column_order": [
        "extension",
        "requests"
      ],
      "sort": [],
      "hide_chart": false,
      "hide_table": false
    }
  ]
}'
PUT kbn:/api/discover_sessions/web-log-requests
{
  "title": "Requests by extension",
  "description": "",
  "tags": [],
  "tabs": [
    {
      "id": "requests",
      "label": "Requests",
      "type": "default",
      "data_source": {
        "type": "esql",
        "query": "FROM kibana_sample_data_logs | STATS requests = COUNT(*) BY extension | SORT requests DESC"
      },
      "column_order": [
        "extension",
        "requests"
      ],
      "sort": [],
      "hide_chart": false,
      "hide_table": false
    }
  ]
}
Request example
{
  "description": "",
  "tabs": [
    {
      "column_order": [
        "extension",
        "requests"
      ],
      "data_source": {
        "query": "FROM kibana_sample_data_logs | STATS requests = COUNT(*) BY extension | SORT requests DESC",
        "type": "esql"
      },
      "hide_chart": false,
      "hide_table": false,
      "id": "requests",
      "label": "Requests",
      "sort": [],
      "type": "default"
    }
  ],
  "tags": [],
  "title": "Requests by extension"
}
Response examples (200)
{
  "data": {
    "description": "",
    "tabs": [
      {
        "column_order": [
          "extension",
          "requests"
        ],
        "data_source": {
          "query": "FROM kibana_sample_data_logs | STATS requests = COUNT(*) BY extension | SORT requests DESC",
          "type": "esql"
        },
        "hide_chart": false,
        "hide_table": false,
        "id": "requests",
        "label": "Requests",
        "sort": [],
        "type": "default"
      }
    ],
    "tags": [],
    "title": "Requests by extension"
  },
  "id": "web-log-requests",
  "meta": {
    "created_at": "2026-10-15T09:00:00.000Z",
    "created_by": "u_example",
    "managed": false,
    "updated_at": "2026-10-15T09:00:00.000Z",
    "updated_by": "u_example",
    "version": "WzEsMV0="
  }
}
Response examples (201)
{
  "data": {
    "description": "",
    "tabs": [
      {
        "column_order": [
          "extension",
          "requests"
        ],
        "data_source": {
          "query": "FROM kibana_sample_data_logs | STATS requests = COUNT(*) BY extension | SORT requests DESC",
          "type": "esql"
        },
        "hide_chart": false,
        "hide_table": false,
        "id": "requests",
        "label": "Requests",
        "sort": [],
        "type": "default"
      }
    ],
    "tags": [],
    "title": "Requests by extension"
  },
  "id": "web-log-requests",
  "meta": {
    "created_at": "2026-10-15T09:00:00.000Z",
    "created_by": "u_example",
    "managed": false,
    "updated_at": "2026-10-15T09:00:00.000Z",
    "updated_by": "u_example",
    "version": "WzEsMV0="
  }
}