---
type: api
title: Get a Vega library item
description: "Returns the complete state of a Vega library item, including its spec, query, and filters."
url: https://www.elastic.co/elastic/docs-builder/docs/5002/api/kibana/next/operation/operation-get-vega-id
resource: https://www.elastic.co/elastic/docs-builder/docs/5002/api/kibana/next/operation/operation-get-vega-id
products:
  - Kibana
---

# Get a Vega library item

Authentication: required

Availability: Planned

- Server: `https://{kibana_url}`

## Paths

- `GET` `/api/vega/{id}`
- `GET` `/s/{space_id}/api/vega/{id}`

#### Path parameters

- `space_id` (string) — optional
  An identifier for the space. If `space_id` is not provided in the URL, the default space is used. Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.
- `id` (string) — required
  The Vega library item ID, as returned by the create or search endpoints, or the ID you chose when you created the item with the upsert endpoint.

## Description

Returns the complete state of a Vega library item, including its spec, query, and filters.

## Responses

#### `200`

ok

`application/json`

- `data` (object)
  - `description` (string · min length: 0 · max length: 10000)
    A short description of the Vega library item.
  - `filters` (union oneOf[] · max items: 100)
    Filters. Applied together with the dashboard filters to Elasticsearch and ES|QL data sources that use `%context%: true`, and to Elasticsearch data sources that use `%dashboard_context-*%` placeholders.
    - **condition**
      A filter that evaluates a single field condition such as equality, range, or existence.
      - `type` (enum)
        Values: `condition`
      - `condition` (union oneOf)
        A filter condition with strict operator/value type matching.
        - **is** (`operator: is`)
          Matches documents where `field` equals a single specified value.
          - `operator` (enum)
            Values: `is`
          - `field` (string)
            Name of the document field the condition evaluates.
          - `negate` (boolean)
            When `true`, the filter is negated and matches documents that do NOT satisfy the condition. Defaults to `false`.
          - `value` (union string | number | boolean)
            Single value to compare against the field.
        - **is_one_of** (`operator: is_one_of`)
          Matches documents where `field` equals any value in a provided list.
          - `operator` (enum)
            Values: `is_one_of`
          - `field` (string)
            Name of the document field the condition evaluates.
          - `negate` (boolean)
            When `true`, the filter is negated and matches documents that do NOT satisfy the condition. Defaults to `false`.
          - `value` (union string[] | number[] | boolean[])
            Homogeneous array of values to match against the field.
        - **range** (`operator: range`)
          Matches documents where `field` falls within a specified numeric or date range.
          - `operator` (enum)
            Values: `range`
          - `field` (string)
            Name of the document field the condition evaluates.
          - `negate` (boolean)
            When `true`, the filter is negated and matches documents that do NOT satisfy the condition. Defaults to `false`.
          - `value` (object)
            Boundary values for a range comparison.
            - `format` (string)
              Elasticsearch [date format](https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/mapping-date-format) string applied when parsing date boundary values. For example, `strict_date_optional_time` or `epoch_millis`.
            - `gt` (number | string)
              Greater than.
            - `gte` (number | string)
              Greater than or equal to.
            - `lt` (number | string)
              Less than.
            - `lte` (number | string)
              Less than or equal to.
        - **exists** (`operator: exists`)
          Matches documents where `field` exists and contains a non-null value.
          - `operator` (enum)
            Values: `exists`
          - `field` (string)
            Name of the document field the condition evaluates.
          - `negate` (boolean)
            When `true`, the filter is negated and matches documents that do NOT satisfy the condition. Defaults to `false`.
      - `controlled_by` (string)
        Identifier of the panel that manages this filter. When set, the filter is treated as owned by that panel.
      - `data_view_id` (string)
        Identifier of the data view used as context for this filter.
      - `disabled` (boolean)
        When `true`, the filter is inactive and does not affect query results. Defaults to `false`.
      - `is_multi_index` (boolean)
        When `true`, the filter can be applied across multiple indices. Defaults to `false`.
      - `label` (string)
        Human-readable label for the filter, used for display purposes.
      - `negate` (boolean)
        When `true`, the filter is negated and matches documents that do NOT satisfy the condition. Defaults to `false`.
    - **group**
      A filter that combines multiple conditions or nested groups using a logical `and` or `or` operator.
      - `type` (enum)
        Values: `group`
      - `controlled_by` (string)
        Identifier of the panel that manages this filter. When set, the filter is treated as owned by that panel.
      - `data_view_id` (string)
        Identifier of the data view used as context for this filter.
      - `disabled` (boolean)
        When `true`, the filter is inactive and does not affect query results. Defaults to `false`.
      - `group` (object)
        Logical group that combines one or more conditions or nested groups.
        - `conditions` (union anyOf[]) — recursive
          Ordered list of conditions or nested groups combined by the group `operator`.
        - `operator` (enum)
          Logical operator applied across all entries in `conditions`. Use `and` to require all conditions, or `or` to require at least one.
          Values: `and`, `or`
      - `is_multi_index` (boolean)
        When `true`, the filter can be applied across multiple indices. Defaults to `false`.
      - `label` (string)
        Human-readable label for the filter, used for display purposes.
      - `negate` (boolean)
        When `true`, the filter is negated and matches documents that do NOT satisfy the condition. Defaults to `false`.
    - **dsl**
      A filter expressed as a raw [Elasticsearch Query DSL](https://www.elastic.co/docs/reference/query-languages/querydsl) object, used for queries that cannot be represented by condition or group filters.
      - `type` (enum)
        Values: `dsl`
      - `controlled_by` (string)
        Identifier of the panel that manages this filter. When set, the filter is treated as owned by that panel.
      - `data_view_id` (string)
        Identifier of the data view used as context for this filter.
      - `disabled` (boolean)
        When `true`, the filter is inactive and does not affect query results. Defaults to `false`.
      - `dsl` (map string to object)
        Elasticsearch Query DSL object passed directly to the query.
      - `field` (string)
        Field name for scripted filters where the field cannot be extracted from the DSL query.
      - `is_multi_index` (boolean)
        When `true`, the filter can be applied across multiple indices. Defaults to `false`.
      - `label` (string)
        Human-readable label for the filter, used for display purposes.
      - `negate` (boolean)
        When `true`, the filter is negated and matches documents that do NOT satisfy the condition. Defaults to `false`.
      - `params` (object)
        Filter parameters metadata. May contain display values, formats, and parameters for scripted filters.
    - **spatial**
      A filter that applies an Elasticsearch geo query, used for geographic boundary and shape matching.
      - `type` (enum)
        Values: `spatial`
      - `controlled_by` (string)
        Identifier of the panel that manages this filter. When set, the filter is treated as owned by that panel.
      - `data_view_id` (string)
        Identifier of the data view used as context for this filter.
      - `disabled` (boolean)
        When `true`, the filter is inactive and does not affect query results. Defaults to `false`.
      - `dsl` (map string to object)
        Elasticsearch geo query DSL object.
      - `is_multi_index` (boolean)
        When `true`, the filter can be applied across multiple indices. Defaults to `false`.
      - `label` (string)
        Human-readable label for the filter, used for display purposes.
      - `negate` (boolean)
        When `true`, the filter is negated and matches documents that do NOT satisfy the condition. Defaults to `false`.
  - `query` (object)
    KQL or Lucene query. Applied together with the dashboard query to Elasticsearch and ES|QL data sources that use `%context%: true`, and to Elasticsearch data sources that use `%dashboard_context-*%` placeholders.
    - `expression` (string · min length: 0 · max length: 1000000)
      A query expression in KQL or Lucene syntax.
    - `language` (enum)
      Query language. Use `kql` for Kibana Query Language (KQL) or `lucene` for Lucene query syntax.
      Values: `kql`, `lucene`
  - `spec` (union oneOf)
    The Vega or Vega-Lite specification. Use `{ "format": "hjson", "value": "<hjson-string>" }` for HJSON (comments and unquoted keys are preserved) or `{ "format": "json", "value": { ... } }` for a JSON object.
    - **HJSON spec** (`format: hjson`)
      - `format` (enum)
        Values: `hjson`
      - `value` (string · min length: 1 · max length: 1000000)
        The Vega or Vega-Lite specification in HJSON format. Comments and unquoted keys are preserved.
    - **JSON spec** (`format: json`)
      - `format` (enum)
        Values: `json`
      - `value` (map string to object)
        The Vega or Vega-Lite specification as a JSON object.
  - `tags` (string[] · max items: 1000 · default: [])
    Tag IDs associated with this library item.
  - `title` (string · min length: 1 · max length: 1024)
    The Vega library item title.
- `id` (string)
  The unique ID of the Vega library item, as returned by the create or search endpoints.
- `meta` (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.
#### `403`

forbidden

#### `404`

not found

## Code examples

#### Console

```console
GET kbn:/api/vega/7c1d8e40-9b2f-11f0-a5c3-2f6e4b8d9a10
```

#### curl

```curl
curl -X GET "${KIBANA_URL}/api/vega/7c1d8e40-9b2f-11f0-a5c3-2f6e4b8d9a10" \
  -H "Authorization: ApiKey ${API_KEY}"
```

## Response examples

#### Get Vega library item response

`application/json`

The full Vega library item state including the spec, query, filters, and metadata.

```json
{
  "data": {
    "filters": [
      {
        "condition": {
          "field": "geo.dest",
          "operator": "is",
          "value": "US"
        },
        "data_view_id": "90943e30-9a47-11e8-b64d-95841ca0b247",
        "type": "condition"
      },
      {
        "dsl": {
          "range": {
            "bytes": {
              "gte": 1000
            }
          }
        },
        "type": "dsl"
      }
    ],
    "query": {
      "expression": "machine.os.keyword : \u0022osx\u0022",
      "language": "kql"
    },
    "spec": {
      "format": "json",
      "value": {
        "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
        "data": {
          "format": {
            "property": "aggregations.extensions.buckets"
          },
          "url": {
            "%context%": true,
            "%timefield%": "timestamp",
            "body": {
              "aggs": {
                "extensions": {
                  "terms": {
                    "field": "extension.keyword"
                  }
                }
              },
              "size": 0
            },
            "index": "kibana_sample_data_logs"
          }
        },
        "encoding": {
          "x": {
            "field": "key",
            "type": "nominal"
          },
          "y": {
            "field": "doc_count",
            "type": "quantitative"
          }
        },
        "mark": "bar"
      }
    },
    "title": "Top extensions (US, macOS)"
  },
  "id": "7c1d8e40-9b2f-11f0-a5c3-2f6e4b8d9a10",
  "meta": {
    "created_at": "2026-09-30T10:00:00.000Z",
    "managed": false,
    "updated_at": "2026-09-30T10:00:00.000Z",
    "version": "WzU5LDFd"
  }
}
```

