SavedObjectsClient

Client for managing Kibana saved objects through the Saved Objects API.

Saved Objects in Kibana are entities like dashboards, visualizations, index patterns, and other configuration items. This API provides methods to create, read, update, and delete saved objects, as well as bulk operations and import/export functionality.

class kibana.SavedObjectsClient(client, default_space_id=None, validate_spaces=True)[source]

Bases: NamespaceClient

Client for managing Kibana Saved Objects.

Saved Objects in Kibana are persistent entities that store configuration, user-created content, and application state. This includes dashboards, visualizations, index patterns, saved searches, and other Kibana objects. This client provides comprehensive CRUD operations with full support for Kibana Spaces.

Deprecated since version Kibana: 8.7 The single-object and bulk CRUD endpoints (create, get, update, delete, find, resolve and the bulk_* methods) are deprecated in Kibana 9.4.3. Prefer the type-specific APIs (e.g. client.dashboards, client.data_views) or the spec-current export/import_objects APIs, which remain fully supported.

Saved objects are scoped to spaces, enabling multi-tenancy where different teams or projects can maintain isolated sets of dashboards and visualizations.

Common saved object types:
  • dashboard: Kibana dashboards with visualizations

  • visualization: Individual visualizations (charts, graphs, etc.)

  • index-pattern: Index patterns for data access

  • search: Saved searches and queries

  • config: Kibana configuration settings

  • lens: Lens visualizations

  • map: Maps visualizations

  • canvas-workpad: Canvas workpads

  • tag: Tags for organizing objects

Key features:
  • CRUD operations for all saved object types (deprecated endpoints)

  • Bulk create/get/update/delete/resolve operations

  • NDJSON export and multipart import (spec-current)

  • Space-scoped operations for multi-tenancy

  • Reference management between objects

  • Version control with optimistic concurrency

_default_space_id

Default space ID for operations if not specified per-request.

_validate_spaces

Whether to validate space existence before operations.

Example

>>> from kibana import Kibana
>>> client = Kibana("http://localhost:5601", api_key="...")
>>>
>>> # Create a dashboard
>>> dashboard = client.saved_objects.create(
...     type="dashboard",
...     attributes={
...         "title": "My Dashboard",
...         "description": "Sales analytics dashboard"
...     }
... )
>>>
>>> # Export objects as NDJSON and re-import them
>>> exported = client.saved_objects.export(
...     objects=[{"type": "dashboard", "id": dashboard["id"]}]
... )
>>> result = client.saved_objects.import_objects(
...     file=list(exported), overwrite=True
... )
>>>
>>> # Work with space-scoped saved objects
>>> marketing_client = client.space("marketing")
>>> dashboards = marketing_client.saved_objects.find(type="dashboard")

Overview

The SavedObjectsClient provides comprehensive methods for managing Kibana saved objects. Saved objects can be scoped to specific Kibana Spaces for multi-tenancy.

Creating Saved Objects

Create a new saved object with the create() method:

from kibana import Kibana

client = Kibana("http://localhost:5601")

# Create a dashboard
dashboard = client.saved_objects.create(
    type="dashboard",
    attributes={
        "title": "My Dashboard",
        "description": "A sample dashboard"
    }
)

dashboard_id = dashboard.body["id"]
print(f"Created dashboard: {dashboard_id}")

# Create with a specific ID
visualization = client.saved_objects.create(
    type="visualization",
    id="my-viz-id",
    attributes={
        "title": "My Visualization",
        "visState": "{}"
    }
)

Saved Object Types

Common saved object types include:

  • dashboard - Kibana dashboards

  • visualization - Visualizations

  • index-pattern - Index patterns

  • search - Saved searches

  • lens - Lens visualizations

  • map - Maps

  • canvas-workpad - Canvas workpads

# Create an index pattern
index_pattern = client.saved_objects.create(
    type="index-pattern",
    attributes={
        "title": "logs-*",
        "timeFieldName": "@timestamp"
    }
)

# Create a saved search
search = client.saved_objects.create(
    type="search",
    attributes={
        "title": "Error Logs",
        "columns": ["message", "level"],
        "sort": [["@timestamp", "desc"]]
    }
)

Retrieving Saved Objects

Get saved objects by type and ID:

# Get a specific saved object
obj = client.saved_objects.get(
    type="dashboard",
    id=dashboard_id
)

print(f"Title: {obj.body['attributes']['title']}")

# Get multiple saved objects at once
objects = client.saved_objects.bulk_get(
    objects=[
        {"type": "dashboard", "id": "dashboard-1"},
        {"type": "visualization", "id": "viz-1"},
        {"type": "index-pattern", "id": "pattern-1"}
    ]
)

Updating Saved Objects

Update saved object attributes:

# Update a dashboard
updated = client.saved_objects.update(
    type="dashboard",
    id=dashboard_id,
    attributes={
        "title": "Updated Dashboard Title",
        "description": "Updated description"
    }
)

# Partial update (only specified attributes are updated)
updated = client.saved_objects.update(
    type="dashboard",
    id=dashboard_id,
    attributes={
        "description": "New description only"
    }
)

Deleting Saved Objects

Delete saved objects:

# Delete a single saved object
client.saved_objects.delete(
    type="dashboard",
    id=dashboard_id
)

# Bulk delete multiple saved objects
result = client.saved_objects.bulk_delete(
    objects=[
        {"type": "dashboard", "id": "dashboard-1"},
        {"type": "visualization", "id": "viz-1"}
    ]
)

Finding Saved Objects

Search for saved objects with filters:

# Find all dashboards
dashboards = client.saved_objects.find(
    type="dashboard"
)

for dashboard in dashboards.body["saved_objects"]:
    print(f"{dashboard['id']}: {dashboard['attributes']['title']}")

# Find with search query
results = client.saved_objects.find(
    type="dashboard",
    search="error",
    search_fields=["title", "description"]
)

# Find with pagination
results = client.saved_objects.find(
    type="visualization",
    page=1,
    per_page=20
)

Bulk Operations

Perform bulk create and update operations:

# Bulk create multiple saved objects
result = client.saved_objects.bulk_create(
    objects=[
        {
            "type": "dashboard",
            "attributes": {"title": "Dashboard 1"}
        },
        {
            "type": "dashboard",
            "attributes": {"title": "Dashboard 2"}
        },
        {
            "type": "visualization",
            "attributes": {"title": "Viz 1"}
        }
    ]
)

# Bulk update
result = client.saved_objects.bulk_update(
    objects=[
        {
            "type": "dashboard",
            "id": "dashboard-1",
            "attributes": {"title": "Updated Dashboard 1"}
        },
        {
            "type": "dashboard",
            "id": "dashboard-2",
            "attributes": {"title": "Updated Dashboard 2"}
        }
    ]
)

Export and Import

Export and import saved objects:

# Export saved objects
export_data = client.saved_objects.export(
    objects=[
        {"type": "dashboard", "id": "dashboard-1"},
        {"type": "visualization", "id": "viz-1"}
    ]
)

# Export all objects of a type
export_data = client.saved_objects.export(
    type="dashboard"
)

# Import saved objects
result = client.saved_objects.import_objects(
    file=export_data,
    overwrite=True
)

Space-Scoped Operations

Work with saved objects in specific spaces:

# Create saved object in a specific space
dashboard = client.saved_objects.create(
    type="dashboard",
    attributes={"title": "Marketing Dashboard"},
    space_id="marketing"
)

# Or use a space-scoped client
marketing_client = client.space("marketing")
dashboard = marketing_client.saved_objects.create(
    type="dashboard",
    attributes={"title": "Marketing Dashboard"}
)

# Find saved objects in a specific space
results = client.saved_objects.find(
    type="dashboard",
    space_id="marketing"
)

Error Handling

Handle common errors when working with saved objects:

from kibana.exceptions import (
    NotFoundError,
    ConflictError,
    BadRequestError,
    SpaceNotFoundError
)

try:
    obj = client.saved_objects.create(
        type="dashboard",
        id="my-dashboard",
        attributes={"title": "My Dashboard"},
        space_id="marketing"
    )
except SpaceNotFoundError as e:
    print(f"Space not found: {e.space_id}")
except ConflictError as e:
    print(f"Object already exists: {e.message}")
except BadRequestError as e:
    print(f"Invalid attributes: {e.message}")

try:
    obj = client.saved_objects.get(
        type="dashboard",
        id="nonexistent"
    )
except NotFoundError as e:
    print(f"Object not found: {e.message}")
__init__(client, default_space_id=None, validate_spaces=True)[source]

Initialize SavedObjectsClient with optional space context.

Parameters:
  • client – Parent BaseClient instance to delegate HTTP requests to.

  • default_space_id (str | None) – Optional default space ID for all operations. If provided, all operations will be scoped to this space unless overridden with the space_id parameter.

  • validate_spaces (bool) – Whether to validate space existence before operations. When True (default), the client will verify that spaces exist before making API calls. Set to False for better performance if you’re certain spaces exist.

Example

>>> # Client without default space
>>> saved_objects = SavedObjectsClient(base_client)
>>>
>>> # Client with default space
>>> marketing_objects = SavedObjectsClient(
...     base_client,
...     default_space_id="marketing",
...     validate_spaces=True
... )
create(*, type, attributes, id=None, overwrite=False, references=None, initial_namespaces=None, core_migration_version=None, type_migration_version=None, space_id=None, validate_space=None)[source]

Create a new saved object.

POST /api/saved_objects/{type} or POST /api/saved_objects/{type}/{id}

Deprecated since version Kibana: 8.7 Deprecated in Kibana 9.4.3. Use the type-specific APIs (e.g. client.dashboards.create, client.data_views.create) or import_objects() instead.

Parameters:
  • type (str) – Type of saved object (e.g., ‘dashboard’, ‘visualization’, ‘index-pattern’)

  • attributes (dict[str, Any]) – Attributes of the saved object

  • id (str | None) – Optional ID for the saved object (auto-generated if not provided)

  • overwrite (bool) – If true, overwrite existing object with the same ID

  • references (list[dict[str, Any]] | None) – Optional list of references to other saved objects

  • initial_namespaces (list[str] | None) – Identifiers of the spaces the object is shared into when it is created (for shareable object types)

  • core_migration_version (str | None) – The Kibana version that last migrated this document (preserve when creating objects outside of Kibana)

  • type_migration_version (str | None) – The type version that last migrated this document (preserve when creating objects outside of Kibana)

  • space_id (str | None) – Optional space ID for space-scoped operations

  • validate_space (bool | None) – Override space validation setting for this operation

Returns:

Created saved object details

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> # Create a dashboard
>>> dashboard = client.saved_objects.create(
...     type="dashboard",
...     attributes={
...         "title": "My Dashboard",
...         "description": "Dashboard description"
...     }
... )
>>> print(dashboard["id"])
>>> # Create with explicit ID in a specific space
>>> dashboard = client.saved_objects.create(
...     type="dashboard",
...     id="my-dashboard-id",
...     attributes={"title": "Marketing Dashboard"},
...     space_id="marketing"
... )
get(*, type, id, space_id=None, validate_space=None)[source]

Get a saved object by type and ID.

GET /api/saved_objects/{type}/{id}

Deprecated since version Kibana: 8.7 Deprecated in Kibana 9.4.3. Use the type-specific APIs (e.g. client.dashboards.get) or export() instead.

Parameters:
  • type (str) – Type of saved object

  • id (str) – ID of the saved object

  • space_id (str | None) – Optional space ID for space-scoped operations

  • validate_space (bool | None) – Override space validation setting for this operation

Returns:

Saved object details

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> dashboard = client.saved_objects.get(
...     type="dashboard",
...     id="my-dashboard-id"
... )
>>> print(dashboard["attributes"]["title"])
resolve(*, type, id, space_id=None, validate_space=None)[source]

Resolve a saved object by type and ID.

GET /api/saved_objects/resolve/{type}/{id}

Retrieves a single saved object by its ID, using any legacy URL aliases if they exist. Under certain circumstances when Kibana is upgraded, saved object migrations may necessitate regenerating some object IDs; this endpoint follows the alias to the new object.

Deprecated since version Kibana: 8.7 Deprecated in Kibana 9.4.3. Use the type-specific APIs (e.g. client.dashboards.get) or export() instead.

Parameters:
  • type (str) – Type of saved object

  • id (str) – ID of the saved object

  • space_id (str | None) – Optional space ID for space-scoped operations

  • validate_space (bool | None) – Override space validation setting for this operation

Returns:

Resolution result with saved_object and outcome (“exactMatch”, “aliasMatch”, or “conflict”)

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.saved_objects.resolve(
...     type="dashboard",
...     id="my-dashboard-id"
... )
>>> print(result["outcome"], result["saved_object"]["id"])
find(*, type, aggs=None, default_search_operator=None, fields=None, filter=None, has_no_reference=None, has_no_reference_operator=None, has_reference=None, has_reference_operator=None, page=None, per_page=None, search=None, search_fields=None, sort_field=None, space_id=None, validate_space=None)[source]

Find saved objects.

GET /api/saved_objects/_find

Deprecated since version Kibana: 8.7 Deprecated in Kibana 9.4.3. Use the type-specific APIs (e.g. client.data_views.get_all) or export() instead.

Parameters:
  • type (str | list[str]) – Type(s) of saved objects to find (string or list of strings)

  • aggs (str | dict[str, Any] | None) – Aggregation structure, serialized as a JSON string (a dict is JSON-encoded automatically)

  • default_search_operator (str | None) – The default operator to use for the simple_query_string search (“AND” or “OR”)

  • fields (str | list[str] | None) – Attribute field(s) of the object to return in the response (string or list; lists are sent as repeated keys)

  • filter (str | None) – KQL string to filter on attributes or references (e.g. “dashboard.attributes.title: foo”)

  • has_no_reference (dict[str, str] | str | None) – Filter to objects NOT having a reference to the given {“type”: …, “id”: …} object

  • has_no_reference_operator (str | None) – Operator (“AND”/”OR”) for has_no_reference when multiple references are given

  • has_reference (dict[str, str] | str | None) – Filter to objects having a reference to the given {“type”: …, “id”: …} object

  • has_reference_operator (str | None) – Operator (“AND”/”OR”) for has_reference when multiple references are given

  • page (int | None) – Page number

  • per_page (int | None) – Items per page

  • search (str | None) – An Elasticsearch simple_query_string query that filters the objects in the response

  • search_fields (str | list[str] | None) – Field(s) to perform the search query against (string or list; lists are sent as repeated keys)

  • sort_field (str | None) – Field to sort by

  • space_id (str | None) – Optional space ID for space-scoped operations

  • validate_space (bool | None) – Override space validation setting for this operation

Returns:

ObjectApiResponse containing search results

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> results = client.saved_objects.find(
...     type=["dashboard", "tag"],
...     search="sales*",
...     search_fields=["title", "description"],
...     per_page=50,
... )
>>> print(results["total"])
update(*, type, id, attributes, version=None, references=None, space_id=None, validate_space=None)[source]

Update an existing saved object.

PUT /api/saved_objects/{type}/{id}

Deprecated since version Kibana: 8.7 Deprecated in Kibana 9.4.3. Use the type-specific APIs (e.g. client.dashboards.update) or import_objects() with overwrite=True instead.

Parameters:
  • type (str) – Type of saved object

  • id (str) – ID of the saved object

  • attributes (dict[str, Any]) – Updated attributes (partial or full)

  • version (str | None) – Optional version for optimistic concurrency control

  • references (list[dict[str, Any]] | None) – Optional updated list of references

  • space_id (str | None) – Optional space ID for space-scoped operations

  • validate_space (bool | None) – Override space validation setting for this operation

Returns:

Updated saved object details

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> updated = client.saved_objects.update(
...     type="dashboard",
...     id="my-dashboard-id",
...     attributes={"title": "Updated Dashboard Title"}
... )
>>> # Update with version for optimistic concurrency
>>> updated = client.saved_objects.update(
...     type="dashboard",
...     id="my-dashboard-id",
...     attributes={"title": "Updated Title"},
...     version="WzEsMV0="
... )
delete(*, type, id, force=False, space_id=None, validate_space=None)[source]

Delete a saved object.

DELETE /api/saved_objects/{type}/{id}

Deprecated since version Kibana: 8.7 Deprecated (and removed from the 9.4.3 OpenAPI spec, though still functional). Use the type-specific APIs (e.g. client.dashboards.delete) instead.

Parameters:
  • type (str) – Type of saved object

  • id (str) – ID of the saved object

  • force (bool) – If true, force delete objects that exist in multiple namespaces

  • space_id (str | None) – Optional space ID for space-scoped operations

  • validate_space (bool | None) – Override space validation setting for this operation

Returns:

Deletion confirmation

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> client.saved_objects.delete(
...     type="dashboard",
...     id="my-dashboard-id"
... )
bulk_create(*, objects, overwrite=None, space_id=None, validate_space=None)[source]

Create multiple saved objects in one request.

POST /api/saved_objects/_bulk_create

Deprecated since version Kibana: 8.7 Deprecated in Kibana 9.4.3. Use the type-specific APIs or import_objects() instead.

Parameters:
  • objects (list[dict[str, Any]]) – List of objects to create. Each object supports keys like type (required), attributes (required), id, references, initialNamespaces, coreMigrationVersion and typeMigrationVersion.

  • overwrite (bool | None) – If true, overwrite existing objects with the same ID

  • space_id (str | None) – Optional space ID for space-scoped operations

  • validate_space (bool | None) – Override space validation setting for this operation

Returns:

Bulk create results with a saved_objects array

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.saved_objects.bulk_create(
...     objects=[
...         {"type": "tag", "id": "tag-1",
...          "attributes": {"name": "one", "description": "", "color": "#000000"}},
...         {"type": "tag", "id": "tag-2",
...          "attributes": {"name": "two", "description": "", "color": "#ffffff"}},
...     ]
... )
>>> print(len(result["saved_objects"]))
bulk_get(*, objects, space_id=None, validate_space=None)[source]

Get multiple saved objects in one request.

POST /api/saved_objects/_bulk_get

Deprecated since version Kibana: 8.7 Deprecated in Kibana 9.4.3. Use the type-specific APIs or export() instead.

Parameters:
  • objects (list[dict[str, Any]]) – List of {"type": ..., "id": ...} descriptors (optionally with fields or namespaces)

  • space_id (str | None) – Optional space ID for space-scoped operations

  • validate_space (bool | None) – Override space validation setting for this operation

Returns:

Bulk get results with a saved_objects array (objects that were not found carry an error entry)

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.saved_objects.bulk_get(
...     objects=[{"type": "dashboard", "id": "my-dashboard-id"}]
... )
>>> print(result["saved_objects"][0]["attributes"]["title"])
bulk_resolve(*, objects, space_id=None, validate_space=None)[source]

Resolve multiple saved objects in one request.

POST /api/saved_objects/_bulk_resolve

Like resolve() but for multiple objects: retrieves saved objects by ID, following legacy URL aliases if they exist.

Deprecated since version Kibana: 8.7 Deprecated in Kibana 9.4.3. Use the type-specific APIs or export() instead.

Parameters:
  • objects (list[dict[str, Any]]) – List of {"type": ..., "id": ...} descriptors

  • space_id (str | None) – Optional space ID for space-scoped operations

  • validate_space (bool | None) – Override space validation setting for this operation

Returns:

Bulk resolve results with a resolved_objects array; each entry has saved_object and outcome

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.saved_objects.bulk_resolve(
...     objects=[{"type": "dashboard", "id": "my-dashboard-id"}]
... )
>>> print(result["resolved_objects"][0]["outcome"])
bulk_update(*, objects, space_id=None, validate_space=None)[source]

Update multiple saved objects in one request.

POST /api/saved_objects/_bulk_update

Deprecated since version Kibana: 8.7 Deprecated in Kibana 9.4.3. Use the type-specific APIs or import_objects() with overwrite=True instead.

WARNING: Although still present in the Kibana 9.4.3 OpenAPI spec, this route is no longer registered on Kibana 9.4.3 servers; requests fall through to the create-saved-object route and fail with a 400 (“expected a plain object value, but found [Array]”). Call update() per object on 9.4.3.

Parameters:
  • objects (list[dict[str, Any]]) – List of update descriptors; each supports type (required), id (required), attributes, references, version and namespace.

  • space_id (str | None) – Optional space ID for space-scoped operations

  • validate_space (bool | None) – Override space validation setting for this operation

Returns:

Bulk update results with a saved_objects array

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.saved_objects.bulk_update(
...     objects=[{
...         "type": "dashboard",
...         "id": "my-dashboard-id",
...         "attributes": {"title": "New Title"},
...     }]
... )
bulk_delete(*, objects, force=None, space_id=None, validate_space=None)[source]

Delete multiple saved objects in one request.

POST /api/saved_objects/_bulk_delete

WARNING: When you delete a saved object, it cannot be recovered.

Deprecated since version Kibana: 8.7 Deprecated in Kibana 9.4.3. Use the type-specific APIs instead.

Parameters:
  • objects (list[dict[str, Any]]) – List of {"type": ..., "id": ...} descriptors

  • force (bool | None) – If true, force delete objects that exist in multiple namespaces (applies to all objects in the request)

  • space_id (str | None) – Optional space ID for space-scoped operations

  • validate_space (bool | None) – Override space validation setting for this operation

Returns:

Bulk delete results with a statuses array

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.saved_objects.bulk_delete(
...     objects=[{"type": "tag", "id": "tag-1"}]
... )
>>> print(result["statuses"][0]["success"])
export(*, objects=None, type=None, search=None, has_reference=None, exclude_export_details=None, include_references_deep=None, space_id=None, validate_space=None)[source]

Export saved objects as NDJSON.

POST /api/saved_objects/_export

Retrieves sets of saved objects that you want to import into Kibana. The response body is NDJSON: one exported object per line, plus (unless exclude_export_details=True) a final export-details line. The parsed response body is a list of dicts.

NOTE: objects cannot be combined with type; pass one or the other. This API is space-aware: only objects belonging to the target space are exported.

Parameters:
  • objects (list[dict[str, str]] | None) – List of {"type": ..., "id": ...} descriptors to export

  • type (str | list[str] | None) – The saved object type(s) to include in the export (use "*" to export all types)

  • search (str | None) – Search for documents to export using the Elasticsearch Simple Query String syntax

  • has_reference (dict[str, str] | list[dict[str, str]] | None) – Filter exported objects by reference: a single {"type": ..., "id": ...} dict or a list of them

  • exclude_export_details (bool | None) – Do not add the export-details entry at the end of the stream

  • include_references_deep (bool | None) – Include all of the referenced objects in the export

  • space_id (str | None) – Optional space ID for space-scoped operations

  • validate_space (bool | None) – Override space validation setting for this operation

Returns:

Response whose body is the parsed NDJSON list of exported objects (iterate over it or serialize it back for import)

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> exported = client.saved_objects.export(
...     objects=[{"type": "dashboard", "id": "my-dashboard-id"}],
...     include_references_deep=True,
... )
>>> lines = list(exported)
>>> print(lines[-1]["exportedCount"])
import_objects(*, file, create_new_copies=None, overwrite=None, compatibility_mode=None, filename='import.ndjson', space_id=None, validate_space=None)[source]

Import saved objects from an NDJSON export file.

POST /api/saved_objects/_import

Creates sets of Kibana saved objects from a file created by the export API (uploaded as multipart/form-data). Saved objects can be imported only into the same version, a newer minor on the same major, or the next major. Exported saved objects are not backwards compatible and cannot be imported into an older version of Kibana.

NOTE: create_new_copies cannot be combined with overwrite or compatibility_mode.

Parameters:
  • file (bytes | str | list[dict[str, Any]]) – NDJSON export content: raw bytes/str, or a list of saved-object dicts (e.g. the parsed body returned by export()), which is NDJSON-encoded automatically

  • create_new_copies (bool | None) – Create copies of the saved objects with regenerated IDs, resetting their origin references

  • overwrite (bool | None) – Overwrite any existing objects with the same ID

  • compatibility_mode (bool | None) – Apply various adjustments to the saved objects that are being imported to maintain compatibility between different Kibana versions (cannot be used with create_new_copies)

  • filename (str) – Filename advertised in the multipart upload

  • space_id (str | None) – Optional space ID for space-scoped operations

  • validate_space (bool | None) – Override space validation setting for this operation

Returns:

Import result with success, successCount and, on failure, an errors array

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> exported = client.saved_objects.export(
...     objects=[{"type": "dashboard", "id": "my-dashboard-id"}]
... )
>>> result = client.saved_objects.import_objects(
...     file=list(exported),
...     overwrite=True,
... )
>>> print(result["success"], result["successCount"])
resolve_import_errors(*, file, retries, create_new_copies=None, compatibility_mode=None, filename='import.ndjson', space_id=None, validate_space=None)[source]

Resolve errors from a previous import.

POST /api/saved_objects/_resolve_import_errors

To resolve errors from the import API, you can retry certain saved objects, overwrite specific saved objects, or change references to different saved objects. The same file given to the import API is re-uploaded together with a list of retry operations.

Parameters:
  • file (bytes | str | list[dict[str, Any]]) – The same NDJSON content given to the import API: raw bytes/str or a list of saved-object dicts

  • retries (list[dict[str, Any]]) – The retry operations. Each entry requires type and id and supports overwrite, destinationId, replaceReferences, ignoreMissingReferences

  • create_new_copies (bool | None) – Create copies of the saved objects with regenerated IDs, resetting their origin references

  • compatibility_mode (bool | None) – Apply compatibility adjustments to the imported saved objects (cannot be used with create_new_copies)

  • filename (str) – Filename advertised in the multipart upload

  • space_id (str | None) – Optional space ID for space-scoped operations

  • validate_space (bool | None) – Override space validation setting for this operation

Returns:

Result with success, successCount and, on failure, an errors array

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.saved_objects.resolve_import_errors(
...     file=exported_ndjson_bytes,
...     retries=[{
...         "type": "dashboard",
...         "id": "my-dashboard-id",
...         "overwrite": True,
...     }],
... )
>>> print(result["success"])
rotate_encryption_key(*, batch_size=None, type=None, space_id=None, validate_space=None)[source]

Rotate the encryption key for encrypted saved objects.

POST /api/encrypted_saved_objects/_rotate_key

Re-encrypts encrypted saved objects with the primary encryption key. Requires xpack.encryptedSavedObjects.keyRotation.decryptionOnlyKeys to be configured in kibana.yml; otherwise Kibana responds with a 400 error. If a rotation is already in progress, Kibana responds 429.

Parameters:
  • batch_size (int | None) – Number of saved objects Kibana processes in each batch (default 10000)

  • type (str | None) – Limit rotation to only the given saved object type (e.g. “alert” or “api-key-pending-invalidation”)

  • space_id (str | None) – Optional space ID for space-scoped operations

  • validate_space (bool | None) – Override space validation setting for this operation

Returns:

Rotation summary with total, successful and failed

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.saved_objects.rotate_encryption_key(
...     batch_size=1000, type="alert"
... )
>>> print(result["successful"], result["failed"])
perform_request(method, path, *, params=None, headers=None, body=None)

Perform an HTTP request via the parent client with space context enhancement.

Parameters:
  • method (str) – HTTP method (GET, POST, PUT, DELETE, etc.)

  • path (str) – API endpoint path

  • params (dict[str, Any] | None) – Query parameters

  • headers (dict[str, str] | None) – Request headers

  • body (dict[str, Any] | None) – Request body

Returns:

API response

Raises:

ApiError – If the API returns an error response (enhanced with space context)

Return type:

ObjectApiResponse[Any]

AsyncSavedObjectsClient

Asynchronous version of the SavedObjectsClient for use with async/await syntax.

class kibana._async.client.saved_objects.AsyncSavedObjectsClient(client, default_space_id=None, validate_spaces=True)[source]

Bases: AsyncNamespaceClient

Async client for managing Kibana Saved Objects.

Saved Objects in Kibana are persistent entities that store configuration, user-created content, and application state. This includes dashboards, visualizations, index patterns, saved searches, and other Kibana objects. This client provides comprehensive CRUD operations with full support for Kibana Spaces.

Deprecated since version Kibana: 8.7 The single-object and bulk CRUD endpoints (create, get, update, delete, find, resolve and the bulk_* methods) are deprecated in Kibana 9.4.3. Prefer the type-specific APIs (e.g. client.dashboards, client.data_views) or the spec-current export/import_objects APIs, which remain fully supported.

Saved objects are scoped to spaces, enabling multi-tenancy where different teams or projects can maintain isolated sets of dashboards and visualizations.

Common saved object types:
  • dashboard: Kibana dashboards with visualizations

  • visualization: Individual visualizations (charts, graphs, etc.)

  • index-pattern: Index patterns for data access

  • search: Saved searches and queries

  • config: Kibana configuration settings

  • lens: Lens visualizations

  • map: Maps visualizations

  • canvas-workpad: Canvas workpads

  • tag: Tags for organizing objects

Key features:
  • CRUD operations for all saved object types (deprecated endpoints)

  • Bulk create/get/update/delete/resolve operations

  • NDJSON export and multipart import (spec-current)

  • Space-scoped operations for multi-tenancy

  • Reference management between objects

  • Version control with optimistic concurrency

_default_space_id

Default space ID for operations if not specified per-request.

_validate_spaces

Whether to validate space existence before operations.

Example

>>> from kibana import AsyncKibana
>>> client = AsyncKibana("http://localhost:5601", api_key="...")
>>>
>>> # Create a dashboard
>>> dashboard = await client.saved_objects.create(
...     type="dashboard",
...     attributes={
...         "title": "My Dashboard",
...         "description": "Sales analytics dashboard"
...     }
... )
>>>
>>> # Export objects as NDJSON and re-import them
>>> exported = await client.saved_objects.export(
...     objects=[{"type": "dashboard", "id": dashboard["id"]}]
... )
>>> result = await client.saved_objects.import_objects(
...     file=list(exported), overwrite=True
... )
>>>
>>> # Work with space-scoped saved objects
>>> marketing_client = client.space("marketing")
>>> dashboards = await marketing_client.saved_objects.find(type="dashboard")

Usage

The AsyncSavedObjectsClient provides the same methods as SavedObjectsClient but all methods are async and must be awaited:

from kibana import AsyncKibana
import asyncio

async def main():
    async with AsyncKibana("http://localhost:5601") as client:
        # Create saved object (async)
        dashboard = await client.saved_objects.create(
            type="dashboard",
            attributes={"title": "Async Dashboard"}
        )

        # Get saved object (async)
        obj = await client.saved_objects.get(
            type="dashboard",
            id=dashboard.body["id"]
        )

        # Find saved objects (async)
        results = await client.saved_objects.find(
            type="dashboard"
        )

        # Delete saved object (async)
        await client.saved_objects.delete(
            type="dashboard",
            id=dashboard.body["id"]
        )

asyncio.run(main())

Concurrent Operations

Perform multiple saved object operations concurrently:

import asyncio

async def main():
    async with AsyncKibana("http://localhost:5601") as client:
        # Create multiple saved objects concurrently
        objects = await asyncio.gather(
            client.saved_objects.create(
                type="dashboard",
                attributes={"title": "Dashboard 1"}
            ),
            client.saved_objects.create(
                type="dashboard",
                attributes={"title": "Dashboard 2"}
            ),
            client.saved_objects.create(
                type="visualization",
                attributes={"title": "Viz 1"}
            )
        )

        print(f"Created {len(objects)} saved objects")

        # Retrieve multiple objects concurrently
        retrieved = await asyncio.gather(
            client.saved_objects.get(
                type="dashboard",
                id=objects[0].body["id"]
            ),
            client.saved_objects.get(
                type="dashboard",
                id=objects[1].body["id"]
            ),
            client.saved_objects.get(
                type="visualization",
                id=objects[2].body["id"]
            )
        )

asyncio.run(main())
__init__(client, default_space_id=None, validate_spaces=True)[source]

Initialize AsyncSavedObjectsClient with optional space context.

Parameters:
  • client – Parent AsyncBaseClient instance to delegate HTTP requests to.

  • default_space_id (str | None) – Optional default space ID for all operations. If provided, all operations will be scoped to this space unless overridden with the space_id parameter.

  • validate_spaces (bool) – Whether to validate space existence before operations. When True (default), the client will verify that spaces exist before making API calls. Set to False for better performance if you’re certain spaces exist.

Example

>>> # Client without default space
>>> saved_objects = AsyncSavedObjectsClient(base_client)
>>>
>>> # Client with default space
>>> marketing_objects = AsyncSavedObjectsClient(
...     base_client,
...     default_space_id="marketing",
...     validate_spaces=True
... )
async create(*, type, attributes, id=None, overwrite=False, references=None, initial_namespaces=None, core_migration_version=None, type_migration_version=None, space_id=None, validate_space=None)[source]

Create a new saved object.

POST /api/saved_objects/{type} or POST /api/saved_objects/{type}/{id}

Deprecated since version Kibana: 8.7 Deprecated in Kibana 9.4.3. Use the type-specific APIs (e.g. client.dashboards.create, client.data_views.create) or import_objects() instead.

Parameters:
  • type (str) – Type of saved object (e.g., ‘dashboard’, ‘visualization’, ‘index-pattern’)

  • attributes (dict[str, Any]) – Attributes of the saved object

  • id (str | None) – Optional ID for the saved object (auto-generated if not provided)

  • overwrite (bool) – If true, overwrite existing object with the same ID

  • references (list[dict[str, Any]] | None) – Optional list of references to other saved objects

  • initial_namespaces (list[str] | None) – Identifiers of the spaces the object is shared into when it is created (for shareable object types)

  • core_migration_version (str | None) – The Kibana version that last migrated this document (preserve when creating objects outside of Kibana)

  • type_migration_version (str | None) – The type version that last migrated this document (preserve when creating objects outside of Kibana)

  • space_id (str | None) – Optional space ID for space-scoped operations

  • validate_space (bool | None) – Override space validation setting for this operation

Returns:

Created saved object details

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> # Create a dashboard
>>> dashboard = await client.saved_objects.create(
...     type="dashboard",
...     attributes={
...         "title": "My Dashboard",
...         "description": "Dashboard description"
...     }
... )
>>> print(dashboard["id"])
>>> # Create with explicit ID in a specific space
>>> dashboard = await client.saved_objects.create(
...     type="dashboard",
...     id="my-dashboard-id",
...     attributes={"title": "Marketing Dashboard"},
...     space_id="marketing"
... )
async get(*, type, id, space_id=None, validate_space=None)[source]

Get a saved object by type and ID.

GET /api/saved_objects/{type}/{id}

Deprecated since version Kibana: 8.7 Deprecated in Kibana 9.4.3. Use the type-specific APIs (e.g. client.dashboards.get) or export() instead.

Parameters:
  • type (str) – Type of saved object

  • id (str) – ID of the saved object

  • space_id (str | None) – Optional space ID for space-scoped operations

  • validate_space (bool | None) – Override space validation setting for this operation

Returns:

Saved object details

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> dashboard = await client.saved_objects.get(
...     type="dashboard",
...     id="my-dashboard-id"
... )
>>> print(dashboard["attributes"]["title"])
async resolve(*, type, id, space_id=None, validate_space=None)[source]

Resolve a saved object by type and ID.

GET /api/saved_objects/resolve/{type}/{id}

Retrieves a single saved object by its ID, using any legacy URL aliases if they exist. Under certain circumstances when Kibana is upgraded, saved object migrations may necessitate regenerating some object IDs; this endpoint follows the alias to the new object.

Deprecated since version Kibana: 8.7 Deprecated in Kibana 9.4.3. Use the type-specific APIs (e.g. client.dashboards.get) or export() instead.

Parameters:
  • type (str) – Type of saved object

  • id (str) – ID of the saved object

  • space_id (str | None) – Optional space ID for space-scoped operations

  • validate_space (bool | None) – Override space validation setting for this operation

Returns:

Resolution result with saved_object and outcome (“exactMatch”, “aliasMatch”, or “conflict”)

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.saved_objects.resolve(
...     type="dashboard",
...     id="my-dashboard-id"
... )
>>> print(result["outcome"], result["saved_object"]["id"])
async find(*, type, aggs=None, default_search_operator=None, fields=None, filter=None, has_no_reference=None, has_no_reference_operator=None, has_reference=None, has_reference_operator=None, page=None, per_page=None, search=None, search_fields=None, sort_field=None, space_id=None, validate_space=None)[source]

Find saved objects.

GET /api/saved_objects/_find

Deprecated since version Kibana: 8.7 Deprecated in Kibana 9.4.3. Use the type-specific APIs (e.g. client.data_views.get_all) or export() instead.

Parameters:
  • type (str | list[str]) – Type(s) of saved objects to find (string or list of strings)

  • aggs (str | dict[str, Any] | None) – Aggregation structure, serialized as a JSON string (a dict is JSON-encoded automatically)

  • default_search_operator (str | None) – The default operator to use for the simple_query_string search (“AND” or “OR”)

  • fields (str | list[str] | None) – Attribute field(s) of the object to return in the response (string or list; lists are sent as repeated keys)

  • filter (str | None) – KQL string to filter on attributes or references (e.g. “dashboard.attributes.title: foo”)

  • has_no_reference (dict[str, str] | str | None) – Filter to objects NOT having a reference to the given {“type”: …, “id”: …} object

  • has_no_reference_operator (str | None) – Operator (“AND”/”OR”) for has_no_reference when multiple references are given

  • has_reference (dict[str, str] | str | None) – Filter to objects having a reference to the given {“type”: …, “id”: …} object

  • has_reference_operator (str | None) – Operator (“AND”/”OR”) for has_reference when multiple references are given

  • page (int | None) – Page number

  • per_page (int | None) – Items per page

  • search (str | None) – An Elasticsearch simple_query_string query that filters the objects in the response

  • search_fields (str | list[str] | None) – Field(s) to perform the search query against (string or list; lists are sent as repeated keys)

  • sort_field (str | None) – Field to sort by

  • space_id (str | None) – Optional space ID for space-scoped operations

  • validate_space (bool | None) – Override space validation setting for this operation

Returns:

ObjectApiResponse containing search results

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> results = await client.saved_objects.find(
...     type=["dashboard", "tag"],
...     search="sales*",
...     search_fields=["title", "description"],
...     per_page=50,
... )
>>> print(results["total"])
async update(*, type, id, attributes, version=None, references=None, space_id=None, validate_space=None)[source]

Update an existing saved object.

PUT /api/saved_objects/{type}/{id}

Deprecated since version Kibana: 8.7 Deprecated in Kibana 9.4.3. Use the type-specific APIs (e.g. client.dashboards.update) or import_objects() with overwrite=True instead.

Parameters:
  • type (str) – Type of saved object

  • id (str) – ID of the saved object

  • attributes (dict[str, Any]) – Updated attributes (partial or full)

  • version (str | None) – Optional version for optimistic concurrency control

  • references (list[dict[str, Any]] | None) – Optional updated list of references

  • space_id (str | None) – Optional space ID for space-scoped operations

  • validate_space (bool | None) – Override space validation setting for this operation

Returns:

Updated saved object details

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> updated = await client.saved_objects.update(
...     type="dashboard",
...     id="my-dashboard-id",
...     attributes={"title": "Updated Dashboard Title"}
... )
>>> # Update with version for optimistic concurrency
>>> updated = await client.saved_objects.update(
...     type="dashboard",
...     id="my-dashboard-id",
...     attributes={"title": "Updated Title"},
...     version="WzEsMV0="
... )
async delete(*, type, id, force=False, space_id=None, validate_space=None)[source]

Delete a saved object.

DELETE /api/saved_objects/{type}/{id}

Deprecated since version Kibana: 8.7 Deprecated (and removed from the 9.4.3 OpenAPI spec, though still functional). Use the type-specific APIs (e.g. client.dashboards.delete) instead.

Parameters:
  • type (str) – Type of saved object

  • id (str) – ID of the saved object

  • force (bool) – If true, force delete objects that exist in multiple namespaces

  • space_id (str | None) – Optional space ID for space-scoped operations

  • validate_space (bool | None) – Override space validation setting for this operation

Returns:

Deletion confirmation

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> await client.saved_objects.delete(
...     type="dashboard",
...     id="my-dashboard-id"
... )
async bulk_create(*, objects, overwrite=None, space_id=None, validate_space=None)[source]

Create multiple saved objects in one request.

POST /api/saved_objects/_bulk_create

Deprecated since version Kibana: 8.7 Deprecated in Kibana 9.4.3. Use the type-specific APIs or import_objects() instead.

Parameters:
  • objects (list[dict[str, Any]]) – List of objects to create. Each object supports keys like type (required), attributes (required), id, references, initialNamespaces, coreMigrationVersion and typeMigrationVersion.

  • overwrite (bool | None) – If true, overwrite existing objects with the same ID

  • space_id (str | None) – Optional space ID for space-scoped operations

  • validate_space (bool | None) – Override space validation setting for this operation

Returns:

Bulk create results with a saved_objects array

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.saved_objects.bulk_create(
...     objects=[
...         {"type": "tag", "id": "tag-1",
...          "attributes": {"name": "one", "description": "", "color": "#000000"}},
...         {"type": "tag", "id": "tag-2",
...          "attributes": {"name": "two", "description": "", "color": "#ffffff"}},
...     ]
... )
>>> print(len(result["saved_objects"]))
async bulk_get(*, objects, space_id=None, validate_space=None)[source]

Get multiple saved objects in one request.

POST /api/saved_objects/_bulk_get

Deprecated since version Kibana: 8.7 Deprecated in Kibana 9.4.3. Use the type-specific APIs or export() instead.

Parameters:
  • objects (list[dict[str, Any]]) – List of {"type": ..., "id": ...} descriptors (optionally with fields or namespaces)

  • space_id (str | None) – Optional space ID for space-scoped operations

  • validate_space (bool | None) – Override space validation setting for this operation

Returns:

Bulk get results with a saved_objects array (objects that were not found carry an error entry)

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.saved_objects.bulk_get(
...     objects=[{"type": "dashboard", "id": "my-dashboard-id"}]
... )
>>> print(result["saved_objects"][0]["attributes"]["title"])
async bulk_resolve(*, objects, space_id=None, validate_space=None)[source]

Resolve multiple saved objects in one request.

POST /api/saved_objects/_bulk_resolve

Like resolve() but for multiple objects: retrieves saved objects by ID, following legacy URL aliases if they exist.

Deprecated since version Kibana: 8.7 Deprecated in Kibana 9.4.3. Use the type-specific APIs or export() instead.

Parameters:
  • objects (list[dict[str, Any]]) – List of {"type": ..., "id": ...} descriptors

  • space_id (str | None) – Optional space ID for space-scoped operations

  • validate_space (bool | None) – Override space validation setting for this operation

Returns:

Bulk resolve results with a resolved_objects array; each entry has saved_object and outcome

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.saved_objects.bulk_resolve(
...     objects=[{"type": "dashboard", "id": "my-dashboard-id"}]
... )
>>> print(result["resolved_objects"][0]["outcome"])
async bulk_update(*, objects, space_id=None, validate_space=None)[source]

Update multiple saved objects in one request.

POST /api/saved_objects/_bulk_update

Deprecated since version Kibana: 8.7 Deprecated in Kibana 9.4.3. Use the type-specific APIs or import_objects() with overwrite=True instead.

WARNING: Although still present in the Kibana 9.4.3 OpenAPI spec, this route is no longer registered on Kibana 9.4.3 servers; requests fall through to the create-saved-object route and fail with a 400 (“expected a plain object value, but found [Array]”). Call update() per object on 9.4.3.

Parameters:
  • objects (list[dict[str, Any]]) – List of update descriptors; each supports type (required), id (required), attributes, references, version and namespace.

  • space_id (str | None) – Optional space ID for space-scoped operations

  • validate_space (bool | None) – Override space validation setting for this operation

Returns:

Bulk update results with a saved_objects array

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.saved_objects.bulk_update(
...     objects=[{
...         "type": "dashboard",
...         "id": "my-dashboard-id",
...         "attributes": {"title": "New Title"},
...     }]
... )
async bulk_delete(*, objects, force=None, space_id=None, validate_space=None)[source]

Delete multiple saved objects in one request.

POST /api/saved_objects/_bulk_delete

WARNING: When you delete a saved object, it cannot be recovered.

Deprecated since version Kibana: 8.7 Deprecated in Kibana 9.4.3. Use the type-specific APIs instead.

Parameters:
  • objects (list[dict[str, Any]]) – List of {"type": ..., "id": ...} descriptors

  • force (bool | None) – If true, force delete objects that exist in multiple namespaces (applies to all objects in the request)

  • space_id (str | None) – Optional space ID for space-scoped operations

  • validate_space (bool | None) – Override space validation setting for this operation

Returns:

Bulk delete results with a statuses array

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.saved_objects.bulk_delete(
...     objects=[{"type": "tag", "id": "tag-1"}]
... )
>>> print(result["statuses"][0]["success"])
async export(*, objects=None, type=None, search=None, has_reference=None, exclude_export_details=None, include_references_deep=None, space_id=None, validate_space=None)[source]

Export saved objects as NDJSON.

POST /api/saved_objects/_export

Retrieves sets of saved objects that you want to import into Kibana. The response body is NDJSON: one exported object per line, plus (unless exclude_export_details=True) a final export-details line. The parsed response body is a list of dicts.

NOTE: objects cannot be combined with type; pass one or the other. This API is space-aware: only objects belonging to the target space are exported.

Parameters:
  • objects (list[dict[str, str]] | None) – List of {"type": ..., "id": ...} descriptors to export

  • type (str | list[str] | None) – The saved object type(s) to include in the export (use "*" to export all types)

  • search (str | None) – Search for documents to export using the Elasticsearch Simple Query String syntax

  • has_reference (dict[str, str] | list[dict[str, str]] | None) – Filter exported objects by reference: a single {"type": ..., "id": ...} dict or a list of them

  • exclude_export_details (bool | None) – Do not add the export-details entry at the end of the stream

  • include_references_deep (bool | None) – Include all of the referenced objects in the export

  • space_id (str | None) – Optional space ID for space-scoped operations

  • validate_space (bool | None) – Override space validation setting for this operation

Returns:

Response whose body is the parsed NDJSON list of exported objects (iterate over it or serialize it back for import)

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> exported = await client.saved_objects.export(
...     objects=[{"type": "dashboard", "id": "my-dashboard-id"}],
...     include_references_deep=True,
... )
>>> lines = list(exported)
>>> print(lines[-1]["exportedCount"])
async import_objects(*, file, create_new_copies=None, overwrite=None, compatibility_mode=None, filename='import.ndjson', space_id=None, validate_space=None)[source]

Import saved objects from an NDJSON export file.

POST /api/saved_objects/_import

Creates sets of Kibana saved objects from a file created by the export API (uploaded as multipart/form-data). Saved objects can be imported only into the same version, a newer minor on the same major, or the next major. Exported saved objects are not backwards compatible and cannot be imported into an older version of Kibana.

NOTE: create_new_copies cannot be combined with overwrite or compatibility_mode.

Parameters:
  • file (bytes | str | list[dict[str, Any]]) – NDJSON export content: raw bytes/str, or a list of saved-object dicts (e.g. the parsed body returned by export()), which is NDJSON-encoded automatically

  • create_new_copies (bool | None) – Create copies of the saved objects with regenerated IDs, resetting their origin references

  • overwrite (bool | None) – Overwrite any existing objects with the same ID

  • compatibility_mode (bool | None) – Apply various adjustments to the saved objects that are being imported to maintain compatibility between different Kibana versions (cannot be used with create_new_copies)

  • filename (str) – Filename advertised in the multipart upload

  • space_id (str | None) – Optional space ID for space-scoped operations

  • validate_space (bool | None) – Override space validation setting for this operation

Returns:

Import result with success, successCount and, on failure, an errors array

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> exported = await client.saved_objects.export(
...     objects=[{"type": "dashboard", "id": "my-dashboard-id"}]
... )
>>> result = await client.saved_objects.import_objects(
...     file=list(exported),
...     overwrite=True,
... )
>>> print(result["success"], result["successCount"])
async resolve_import_errors(*, file, retries, create_new_copies=None, compatibility_mode=None, filename='import.ndjson', space_id=None, validate_space=None)[source]

Resolve errors from a previous import.

POST /api/saved_objects/_resolve_import_errors

To resolve errors from the import API, you can retry certain saved objects, overwrite specific saved objects, or change references to different saved objects. The same file given to the import API is re-uploaded together with a list of retry operations.

Parameters:
  • file (bytes | str | list[dict[str, Any]]) – The same NDJSON content given to the import API: raw bytes/str or a list of saved-object dicts

  • retries (list[dict[str, Any]]) – The retry operations. Each entry requires type and id and supports overwrite, destinationId, replaceReferences, ignoreMissingReferences

  • create_new_copies (bool | None) – Create copies of the saved objects with regenerated IDs, resetting their origin references

  • compatibility_mode (bool | None) – Apply compatibility adjustments to the imported saved objects (cannot be used with create_new_copies)

  • filename (str) – Filename advertised in the multipart upload

  • space_id (str | None) – Optional space ID for space-scoped operations

  • validate_space (bool | None) – Override space validation setting for this operation

Returns:

Result with success, successCount and, on failure, an errors array

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.saved_objects.resolve_import_errors(
...     file=exported_ndjson_bytes,
...     retries=[{
...         "type": "dashboard",
...         "id": "my-dashboard-id",
...         "overwrite": True,
...     }],
... )
>>> print(result["success"])
async rotate_encryption_key(*, batch_size=None, type=None, space_id=None, validate_space=None)[source]

Rotate the encryption key for encrypted saved objects.

POST /api/encrypted_saved_objects/_rotate_key

Re-encrypts encrypted saved objects with the primary encryption key. Requires xpack.encryptedSavedObjects.keyRotation.decryptionOnlyKeys to be configured in kibana.yml; otherwise Kibana responds with a 400 error. If a rotation is already in progress, Kibana responds 429.

Parameters:
  • batch_size (int | None) – Number of saved objects Kibana processes in each batch (default 10000)

  • type (str | None) – Limit rotation to only the given saved object type (e.g. “alert” or “api-key-pending-invalidation”)

  • space_id (str | None) – Optional space ID for space-scoped operations

  • validate_space (bool | None) – Override space validation setting for this operation

Returns:

Rotation summary with total, successful and failed

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.saved_objects.rotate_encryption_key(
...     batch_size=1000, type="alert"
... )
>>> print(result["successful"], result["failed"])
async perform_request(method, path, *, params=None, headers=None, body=None)

Perform an async HTTP request via the parent client with space context enhancement.

Parameters:
  • method (str) – HTTP method (GET, POST, PUT, DELETE, etc.)

  • path (str) – API endpoint path

  • params (dict[str, Any] | None) – Query parameters

  • headers (dict[str, str] | None) – Request headers

  • body (dict[str, Any] | None) – Request body

Returns:

API response

Raises:

ApiError – If the API returns an error response (enhanced with space context)

Return type:

ObjectApiResponse[Any]