SpacesClient

Client for managing Kibana Spaces through the Spaces API.

Spaces allow you to organize your Kibana objects (dashboards, visualizations, saved objects) into separate, isolated areas. Each space can have its own set of saved objects and can be used to implement multi-tenancy in Kibana.

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

Bases: NamespaceClient

Client for Kibana Spaces API.

Spaces allow you to organize your Kibana objects (dashboards, visualizations, index patterns, etc.) into separate, isolated areas. Each space has its own set of saved objects and can be used to implement multi-tenancy, enabling different teams or projects to work independently within the same Kibana instance.

Key features of Spaces:
  • Isolated saved objects per space

  • Customizable appearance (color, initials, custom avatar image)

  • Solution views (“es”, “oblt”, “security”, “classic”) introduced in 9.x

  • Feature-level access control (disable specific features per space)

  • URL-based space selection (/s/space-id/app/…)

  • Copying and sharing saved objects between spaces

  • Default space always exists and cannot be deleted

Example

>>> from kibana import Kibana
>>> client = Kibana("http://localhost:5601", api_key="...")
>>>
>>> # Create a space for the marketing team
>>> space = client.spaces.create(
...     id="marketing",
...     name="Marketing Team",
...     description="Space for marketing analytics",
...     color="#FF6B6B",
...     initials="MK",
...     solution="classic",
... )
>>>
>>> # List all spaces
>>> spaces = client.spaces.get_all()
>>> for space in spaces.body:
...     print(f"{space['name']} ({space['id']})")
>>>
>>> # Work within a specific space
>>> marketing_client = client.space("marketing")
>>> connectors = marketing_client.actions.get_all()

Overview

The SpacesClient provides methods to create, retrieve, update, and delete Kibana Spaces. Spaces enable multi-tenancy by isolating saved objects and providing separate workspaces for different teams or use cases.

Creating Spaces

Create a new space with the create() method:

from kibana import Kibana

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

# Create a space
space = client.spaces.create(
    id="marketing",
    name="Marketing Team",
    description="Space for the marketing team",
    color="#FF6B6B",
    initials="MK"
)

print(f"Created space: {space.body['id']}")

Space Configuration Options

Spaces can be configured with various options:

# Create space with disabled features
space = client.spaces.create(
    id="sales",
    name="Sales Team",
    description="Sales team workspace",
    color="#4ECDC4",
    initials="ST",
    disabled_features=["dev_tools", "advancedSettings"]
)

# Create space with custom image URL
space = client.spaces.create(
    id="engineering",
    name="Engineering",
    description="Engineering team space",
    image_url="https://example.com/logo.png"
)

Listing and Retrieving Spaces

Get all spaces or retrieve a specific space:

# Get all spaces
spaces = client.spaces.get_all()
for space in spaces.body:
    print(f"{space['id']}: {space['name']}")

# Get a specific space
space = client.spaces.get(id="marketing")
print(f"Space name: {space.body['name']}")
print(f"Description: {space.body['description']}")

Updating Spaces

Update space configuration:

# Update space name and description
updated = client.spaces.update(
    id="marketing",
    name="Marketing Department",
    description="Updated description for marketing team"
)

# Update disabled features
updated = client.spaces.update(
    id="marketing",
    disabled_features=["dev_tools", "advancedSettings", "indexPatterns"]
)

Deleting Spaces

Delete a space and all its saved objects:

# Delete a space
client.spaces.delete(id="marketing")

Warning

Deleting a space permanently removes all saved objects within that space. This operation cannot be undone.

Space-Scoped Operations

Use spaces with other API clients for multi-tenancy:

# Create a space
space = client.spaces.create(
    id="team-a",
    name="Team A",
    description="Team A workspace"
)

# Create a space-scoped client
team_a_client = client.space("team-a")

# Create connector in Team A's space
connector = team_a_client.actions.create(
    name="Team A Webhook",
    connector_type_id=".webhook",
    config={"url": "https://team-a.example.com/webhook"}
)

# Create dashboard in Team A's space
dashboard = team_a_client.saved_objects.create(
    type="dashboard",
    attributes={"title": "Team A Dashboard"}
)

Error Handling

Handle common errors when working with spaces:

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

try:
    space = client.spaces.create(
        id="my-space",
        name="My Space"
    )
except ConflictError as e:
    print(f"Space already exists: {e.message}")
except InvalidSpaceIdError as e:
    print(f"Invalid space ID: {e.space_id}")
except BadRequestError as e:
    print(f"Invalid configuration: {e.message}")

try:
    space = client.spaces.get(id="nonexistent")
except NotFoundError as e:
    print(f"Space not found: {e.message}")
create(*, id, name, description=None, color=None, initials=None, image_url=None, disabled_features=None, solution=None)[source]

Create a new space.

Creates a new Kibana space with the specified configuration. The space ID must be unique and URL-friendly (lowercase alphanumeric, hyphens and underscores only) and cannot be changed after creation.

Parameters:
  • id (str) – Unique identifier for the space. Limited to lowercase alphanumeric, underscore, and hyphen characters (a-z, 0-9, _, -). Examples: “marketing”, “team-a”, “prod_env”.

  • name (str) – Display name for the space. Shown in the Kibana UI and can contain any characters.

  • description (str | None) – Optional description explaining the purpose of the space. Displayed in the space selector.

  • color (str | None) – Optional hexadecimal color code for the space avatar (e.g., “#FF0000”). By default, the color is generated from the name.

  • initials (str | None) – Optional one or two characters shown in the space avatar. If not provided, Kibana generates them from the name.

  • image_url (str | None) – Optional data-URL encoded image to display in the space avatar instead of initials. For best results use a 64x64 image. Sent as the imageUrl body field.

  • disabled_features (list[str] | None) – Optional list of Kibana feature IDs to turn off in this space (e.g., “discover”, “dashboard”, “canvas”, “maps”, “ml”, “apm”, “slo”, “uptime”).

  • solution (str | None) – Optional solution view for the space. One of "es" (Elasticsearch), "oblt" (Observability), "security" (Security), or "classic". Controls which navigation and features the space presents.

Returns:

ObjectApiResponse containing the created space details including id, name, description, color, initials, disabledFeatures, and solution.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> # Create a basic space
>>> space = client.spaces.create(id="engineering", name="Engineering")
>>>
>>> # Create an Observability solution space with full configuration
>>> space = client.spaces.create(
...     id="oblt-team",
...     name="Observability Team",
...     description="O11y workspace",
...     color="#FF6B6B",
...     initials="OT",
...     disabled_features=["ml"],
...     solution="oblt",
... )
>>> print(space.body["solution"])
oblt
get(*, id)[source]

Get a space by ID.

Retrieves detailed information about a specific space including its configuration, disabled features, and solution view.

Parameters:

id (str) – The space ID to retrieve (e.g., “default”, “marketing”).

Returns:

ObjectApiResponse containing the space details including id, name, description, color, initials, disabledFeatures, and solution.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> space = client.spaces.get(id="marketing")
>>> print(space.body["name"])
Marketing Team
>>> print(space.body.get("disabledFeatures", []))
['ml', 'apm']
get_all(*, purpose=None, include_authorized_purposes=None)[source]

Get all spaces.

Retrieves a list of all spaces in the Kibana instance that the authenticated user has access to view, optionally filtered by the purpose the user is authorized for.

Parameters:
  • purpose (str | None) – Optional purpose to filter spaces by user authorization. One of "any", "copySavedObjectsIntoSpace", or "shareSavedObjectsIntoSpace". Cannot be combined with include_authorized_purposes=True (Kibana rejects the combination with a 400 error).

  • include_authorized_purposes (bool | None) – When True, each returned space includes an authorizedPurposes map describing which purposes the current user is authorized for. Must be False (or omitted) when purpose is specified.

Returns:

ObjectApiResponse containing a list of all spaces. Each space includes id, name, description, color, initials, disabledFeatures, solution, and (if requested) authorizedPurposes.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> spaces = client.spaces.get_all(include_authorized_purposes=True)
>>> for space in spaces.body:
...     print(space["id"], space.get("authorizedPurposes"))
>>>
>>> # Only spaces the user may copy saved objects into
>>> spaces = client.spaces.get_all(purpose="copySavedObjectsIntoSpace")
update(*, id, name, description=None, color=None, initials=None, image_url=None, disabled_features=None, solution=None)[source]

Update a space.

Sends an HTTP PUT that replaces the space configuration: Kibana requires both id and name in the request body (calls that omit the name are rejected with a 400 error). On Kibana 9.4.3, body fields with schema defaults are reset when omitted (notably disabled_features resets to []), while other omitted optional fields (description, color, initials, image_url, solution) are preserved. For predictable results treat this as a full replace: get() the space first and re-send every field you want to keep. The space ID itself cannot be changed after creation.

Parameters:
  • id (str) – The space ID to update (cannot be changed).

  • name (str) – Display name for the space (required by the PUT body schema, so the current name must be re-sent even if unchanged).

  • description (str | None) – Description for the space. Pass an empty string to clear an existing description; omitting it preserves it.

  • color (str | None) – Hexadecimal color code for the space avatar (e.g., “#00FF00”).

  • initials (str | None) – One or two characters shown in the space avatar.

  • image_url (str | None) – Data-URL encoded image for the space avatar. Sent as the imageUrl body field.

  • disabled_features (list[str] | None) – List of feature IDs turned off in the space. Replaces the entire list; omitting it re-enables all features.

  • solution (str | None) – Solution view for the space. One of "es", "oblt", "security", or "classic".

Returns:

ObjectApiResponse containing the updated space details.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> # Read-modify-write to change only the color
>>> current = client.spaces.get(id="marketing").body
>>> space = client.spaces.update(
...     id="marketing",
...     name=current["name"],
...     description=current.get("description"),
...     color="#00FF00",
...     disabled_features=current.get("disabledFeatures"),
... )
delete(*, id)[source]

Delete a space.

Permanently deletes a space and all its associated saved objects (dashboards, visualizations, data views, etc.). This operation cannot be undone.

Warning

Deleting a space permanently deletes every saved object within that space. The default space cannot be deleted.

Parameters:

id (str) – The space ID to delete. Cannot be “default”.

Returns:

ObjectApiResponse, empty (HTTP 204) for successful deletion.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> client.spaces.delete(id="old-project")
copy_saved_objects(*, spaces, objects, include_references=None, create_new_copies=None, overwrite=None, compatibility_mode=None)[source]

Copy saved objects between spaces.

Copies saved objects from the current space (the one the client is scoped to, or the default space) into one or more target spaces. The response reports, per target space, whether the copy succeeded and any per-object errors (e.g., conflicts) that can subsequently be retried with resolve_copy_saved_objects_errors().

Parameters:
  • spaces (list[str]) – Identifiers of the target spaces to copy the objects into (max 100).

  • objects (list[dict[str, Any]]) – Saved objects to copy, each a dict with "type" and "id" keys (max 1000). Example: [{"type": "dashboard", "id": "my-dashboard"}].

  • include_references (bool | None) – When True, all saved objects related to the specified objects are also copied. Server default: False.

  • create_new_copies (bool | None) – Create new copies of the objects with regenerated identifiers and reset origin, avoiding conflict errors. Server default: True. Cannot be combined with overwrite or compatibility_mode.

  • overwrite (bool | None) – When True, conflicting objects in the target space are automatically overwritten. Server default: False. Cannot be combined with create_new_copies.

  • compatibility_mode (bool | None) – Apply adjustments to maintain compatibility between different Kibana versions. Server default: False. Cannot be combined with create_new_copies.

Returns:

ObjectApiResponse mapping each target space ID to a result object with success, successCount, successResults, and (on failure) errors.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.spaces.copy_saved_objects(
...     spaces=["marketing"],
...     objects=[{"type": "dashboard", "id": "sales-dash"}],
...     include_references=True,
... )
>>> print(result.body["marketing"]["success"])
True
resolve_copy_saved_objects_errors(*, retries, objects, include_references=None, create_new_copies=None, compatibility_mode=None)[source]

Resolve conflicts encountered while copying saved objects.

Overwrites specific saved objects that failed to copy in a previous copy_saved_objects() call. Use the errors reported in that call’s response to build the retries map.

Parameters:
  • retries (dict[str, list[dict[str, Any]]]) – Map of target space ID to the list of retry instructions for that space. Each retry is a dict with required "type" and "id" keys and optional "overwrite" (bool), "destinationId" (str), "createNewCopy" (bool), and "ignoreMissingReferences" (bool) keys.

  • objects (list[dict[str, Any]]) – The same saved objects passed to the original copy call, each a dict with "type" and "id" keys (max 1000).

  • include_references (bool | None) – When True, related saved objects are also copied. Server default: False.

  • create_new_copies (bool | None) – Create new copies with regenerated identifiers. Server default: True.

  • compatibility_mode (bool | None) – Apply cross-version compatibility adjustments. Server default: False. Cannot be combined with create_new_copies.

Returns:

ObjectApiResponse mapping each target space ID to a result object with success, successCount, and successResults.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.spaces.resolve_copy_saved_objects_errors(
...     objects=[{"type": "dashboard", "id": "sales-dash"}],
...     retries={
...         "marketing": [
...             {"type": "dashboard", "id": "sales-dash", "overwrite": True}
...         ]
...     },
...     create_new_copies=False,
... )
>>> print(result.body["marketing"]["success"])
True
disable_legacy_url_aliases(*, aliases)[source]

Disable legacy URL aliases.

Disables legacy URL aliases that were created when Kibana upgraded objects to be shareable across spaces, so that the old object URLs no longer redirect to the new objects.

Parameters:

aliases (list[dict[str, Any]]) – Legacy URL aliases to disable (max 1000). Each alias is a dict with required keys "targetSpace" (the space where the alias target object exists), "targetType" (the type of the target object), and "sourceId" (the legacy object identifier).

Returns:

ObjectApiResponse, empty (HTTP 204) on success.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> client.spaces.disable_legacy_url_aliases(
...     aliases=[
...         {
...             "targetSpace": "marketing",
...             "targetType": "dashboard",
...             "sourceId": "legacy-dash-id",
...         }
...     ]
... )
get_shareable_references(*, objects)[source]

Get shareable references for saved objects.

Collects references and spaces context for the given saved objects — used to determine which objects (and their transitive references) will be affected before sharing them to other spaces with update_objects_spaces().

Parameters:

objects (list[dict[str, Any]]) – Saved objects to collect references for, each a dict with "type" and "id" keys (max 1000).

Returns:

ObjectApiResponse with an objects list; each entry includes the object’s type, id, spaces, and any inbound/outbound reference information (e.g. inboundReferences, spacesWithMatchingAliases, spacesWithMatchingOrigins).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> refs = client.spaces.get_shareable_references(
...     objects=[{"type": "dashboard", "id": "sales-dash"}]
... )
>>> for obj in refs.body["objects"]:
...     print(obj["type"], obj["id"], obj["spaces"])
update_objects_spaces(*, objects, spaces_to_add, spaces_to_remove)[source]

Update the spaces that saved objects are shared to.

Adds the given saved objects to and/or removes them from the specified spaces (sharing, not copying — the same object becomes visible in multiple spaces). Use "*" in spaces_to_add to share to all spaces.

Parameters:
  • objects (list[dict[str, Any]]) – Saved objects to update, each a dict with "type" and "id" keys (max 1000). The object type must be shareable across spaces.

  • spaces_to_add (list[str]) – Identifiers of the spaces the objects should be added to (max 1000). Pass an empty list to only remove.

  • spaces_to_remove (list[str]) – Identifiers of the spaces the objects should be removed from (max 1000). Pass an empty list to only add.

Returns:

ObjectApiResponse with an objects list; each entry includes the object’s type, id, and updated spaces array (and an error field for objects that could not be updated).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.spaces.update_objects_spaces(
...     objects=[{"type": "dashboard", "id": "sales-dash"}],
...     spaces_to_add=["marketing"],
...     spaces_to_remove=[],
... )
>>> print(result.body["objects"][0]["spaces"])
['default', 'marketing']
__init__(client, default_space_id=None, validate_spaces=True)

Initialize NamespaceClient with optional space support.

Parameters:
  • client (BaseClient) – Parent BaseClient instance to delegate requests to

  • default_space_id (str | None) – Optional default space ID for all operations

  • validate_spaces (bool) – Whether to validate space existence (default: True)

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]

AsyncSpacesClient

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

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

Bases: AsyncNamespaceClient

Async client for Kibana Spaces API.

Spaces allow you to organize your Kibana objects (dashboards, visualizations, index patterns, etc.) into separate, isolated areas. Each space has its own set of saved objects and can be used to implement multi-tenancy, enabling different teams or projects to work independently within the same Kibana instance.

Key features of Spaces:
  • Isolated saved objects per space

  • Customizable appearance (color, initials, custom avatar image)

  • Solution views (“es”, “oblt”, “security”, “classic”) introduced in 9.x

  • Feature-level access control (disable specific features per space)

  • URL-based space selection (/s/space-id/app/…)

  • Copying and sharing saved objects between spaces

  • Default space always exists and cannot be deleted

Example

>>> from kibana import AsyncKibana
>>> client = AsyncKibana("http://localhost:5601", api_key="...")
>>>
>>> # Create a space for the marketing team
>>> space = await client.spaces.create(
...     id="marketing",
...     name="Marketing Team",
...     description="Space for marketing analytics",
...     color="#FF6B6B",
...     initials="MK",
...     solution="classic",
... )
>>>
>>> # List all spaces
>>> spaces = await client.spaces.get_all()
>>> for space in spaces.body:
...     print(f"{space['name']} ({space['id']})")
>>>
>>> # Work within a specific space
>>> marketing_client = client.space("marketing")
>>> connectors = await marketing_client.actions.get_all()

Usage

The AsyncSpacesClient provides the same methods as SpacesClient 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 space (async)
        space = await client.spaces.create(
            id="async-space",
            name="Async Space",
            description="Created with async client"
        )

        # Get all spaces (async)
        spaces = await client.spaces.get_all()

        # Update space (async)
        updated = await client.spaces.update(
            id="async-space",
            name="Updated Async Space"
        )

        # Delete space (async)
        await client.spaces.delete(id="async-space")

asyncio.run(main())

Concurrent Space Operations

Perform multiple space operations concurrently:

import asyncio

async def main():
    async with AsyncKibana("http://localhost:5601") as client:
        # Create multiple spaces concurrently
        spaces = await asyncio.gather(
            client.spaces.create(
                id="team-a",
                name="Team A",
                description="Team A workspace"
            ),
            client.spaces.create(
                id="team-b",
                name="Team B",
                description="Team B workspace"
            ),
            client.spaces.create(
                id="team-c",
                name="Team C",
                description="Team C workspace"
            )
        )

        print(f"Created {len(spaces)} spaces")

        # Get all spaces concurrently with their details
        space_details = await asyncio.gather(
            client.spaces.get(id="team-a"),
            client.spaces.get(id="team-b"),
            client.spaces.get(id="team-c")
        )

asyncio.run(main())
async create(*, id, name, description=None, color=None, initials=None, image_url=None, disabled_features=None, solution=None)[source]

Create a new space.

Creates a new Kibana space with the specified configuration. The space ID must be unique and URL-friendly (lowercase alphanumeric, hyphens and underscores only) and cannot be changed after creation.

Parameters:
  • id (str) – Unique identifier for the space. Limited to lowercase alphanumeric, underscore, and hyphen characters (a-z, 0-9, _, -). Examples: “marketing”, “team-a”, “prod_env”.

  • name (str) – Display name for the space. Shown in the Kibana UI and can contain any characters.

  • description (str | None) – Optional description explaining the purpose of the space. Displayed in the space selector.

  • color (str | None) – Optional hexadecimal color code for the space avatar (e.g., “#FF0000”). By default, the color is generated from the name.

  • initials (str | None) – Optional one or two characters shown in the space avatar. If not provided, Kibana generates them from the name.

  • image_url (str | None) – Optional data-URL encoded image to display in the space avatar instead of initials. For best results use a 64x64 image. Sent as the imageUrl body field.

  • disabled_features (list[str] | None) – Optional list of Kibana feature IDs to turn off in this space (e.g., “discover”, “dashboard”, “canvas”, “maps”, “ml”, “apm”, “slo”, “uptime”).

  • solution (str | None) – Optional solution view for the space. One of "es" (Elasticsearch), "oblt" (Observability), "security" (Security), or "classic". Controls which navigation and features the space presents.

Returns:

ObjectApiResponse containing the created space details including id, name, description, color, initials, disabledFeatures, and solution.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> # Create a basic space
>>> space = await client.spaces.create(id="engineering", name="Engineering")
>>>
>>> # Create an Observability solution space with full configuration
>>> space = await client.spaces.create(
...     id="oblt-team",
...     name="Observability Team",
...     description="O11y workspace",
...     color="#FF6B6B",
...     initials="OT",
...     disabled_features=["ml"],
...     solution="oblt",
... )
>>> print(space.body["solution"])
oblt
async get(*, id)[source]

Get a space by ID.

Retrieves detailed information about a specific space including its configuration, disabled features, and solution view.

Parameters:

id (str) – The space ID to retrieve (e.g., “default”, “marketing”).

Returns:

ObjectApiResponse containing the space details including id, name, description, color, initials, disabledFeatures, and solution.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> space = await client.spaces.get(id="marketing")
>>> print(space.body["name"])
Marketing Team
>>> print(space.body.get("disabledFeatures", []))
['ml', 'apm']
async get_all(*, purpose=None, include_authorized_purposes=None)[source]

Get all spaces.

Retrieves a list of all spaces in the Kibana instance that the authenticated user has access to view, optionally filtered by the purpose the user is authorized for.

Parameters:
  • purpose (str | None) – Optional purpose to filter spaces by user authorization. One of "any", "copySavedObjectsIntoSpace", or "shareSavedObjectsIntoSpace". Cannot be combined with include_authorized_purposes=True (Kibana rejects the combination with a 400 error).

  • include_authorized_purposes (bool | None) – When True, each returned space includes an authorizedPurposes map describing which purposes the current user is authorized for. Must be False (or omitted) when purpose is specified.

Returns:

ObjectApiResponse containing a list of all spaces. Each space includes id, name, description, color, initials, disabledFeatures, solution, and (if requested) authorizedPurposes.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> spaces = await client.spaces.get_all(include_authorized_purposes=True)
>>> for space in spaces.body:
...     print(space["id"], space.get("authorizedPurposes"))
>>>
>>> # Only spaces the user may copy saved objects into
>>> spaces = await client.spaces.get_all(purpose="copySavedObjectsIntoSpace")
async update(*, id, name, description=None, color=None, initials=None, image_url=None, disabled_features=None, solution=None)[source]

Update a space.

Sends an HTTP PUT that replaces the space configuration: Kibana requires both id and name in the request body (calls that omit the name are rejected with a 400 error). On Kibana 9.4.3, body fields with schema defaults are reset when omitted (notably disabled_features resets to []), while other omitted optional fields (description, color, initials, image_url, solution) are preserved. For predictable results treat this as a full replace: get() the space first and re-send every field you want to keep. The space ID itself cannot be changed after creation.

Parameters:
  • id (str) – The space ID to update (cannot be changed).

  • name (str) – Display name for the space (required by the PUT body schema, so the current name must be re-sent even if unchanged).

  • description (str | None) – Description for the space. Pass an empty string to clear an existing description; omitting it preserves it.

  • color (str | None) – Hexadecimal color code for the space avatar (e.g., “#00FF00”).

  • initials (str | None) – One or two characters shown in the space avatar.

  • image_url (str | None) – Data-URL encoded image for the space avatar. Sent as the imageUrl body field.

  • disabled_features (list[str] | None) – List of feature IDs turned off in the space. Replaces the entire list; omitting it re-enables all features.

  • solution (str | None) – Solution view for the space. One of "es", "oblt", "security", or "classic".

Returns:

ObjectApiResponse containing the updated space details.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> # Read-modify-write to change only the color
>>> current = (await client.spaces.get(id="marketing")).body
>>> space = await client.spaces.update(
...     id="marketing",
...     name=current["name"],
...     description=current.get("description"),
...     color="#00FF00",
...     disabled_features=current.get("disabledFeatures"),
... )
async delete(*, id)[source]

Delete a space.

Permanently deletes a space and all its associated saved objects (dashboards, visualizations, data views, etc.). This operation cannot be undone.

Warning

Deleting a space permanently deletes every saved object within that space. The default space cannot be deleted.

Parameters:

id (str) – The space ID to delete. Cannot be “default”.

Returns:

ObjectApiResponse, empty (HTTP 204) for successful deletion.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> await client.spaces.delete(id="old-project")
async copy_saved_objects(*, spaces, objects, include_references=None, create_new_copies=None, overwrite=None, compatibility_mode=None)[source]

Copy saved objects between spaces.

Copies saved objects from the current space (the one the client is scoped to, or the default space) into one or more target spaces. The response reports, per target space, whether the copy succeeded and any per-object errors (e.g., conflicts) that can subsequently be retried with resolve_copy_saved_objects_errors().

Parameters:
  • spaces (list[str]) – Identifiers of the target spaces to copy the objects into (max 100).

  • objects (list[dict[str, Any]]) – Saved objects to copy, each a dict with "type" and "id" keys (max 1000). Example: [{"type": "dashboard", "id": "my-dashboard"}].

  • include_references (bool | None) – When True, all saved objects related to the specified objects are also copied. Server default: False.

  • create_new_copies (bool | None) – Create new copies of the objects with regenerated identifiers and reset origin, avoiding conflict errors. Server default: True. Cannot be combined with overwrite or compatibility_mode.

  • overwrite (bool | None) – When True, conflicting objects in the target space are automatically overwritten. Server default: False. Cannot be combined with create_new_copies.

  • compatibility_mode (bool | None) – Apply adjustments to maintain compatibility between different Kibana versions. Server default: False. Cannot be combined with create_new_copies.

Returns:

ObjectApiResponse mapping each target space ID to a result object with success, successCount, successResults, and (on failure) errors.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.spaces.copy_saved_objects(
...     spaces=["marketing"],
...     objects=[{"type": "dashboard", "id": "sales-dash"}],
...     include_references=True,
... )
>>> print(result.body["marketing"]["success"])
True
async resolve_copy_saved_objects_errors(*, retries, objects, include_references=None, create_new_copies=None, compatibility_mode=None)[source]

Resolve conflicts encountered while copying saved objects.

Overwrites specific saved objects that failed to copy in a previous copy_saved_objects() call. Use the errors reported in that call’s response to build the retries map.

Parameters:
  • retries (dict[str, list[dict[str, Any]]]) – Map of target space ID to the list of retry instructions for that space. Each retry is a dict with required "type" and "id" keys and optional "overwrite" (bool), "destinationId" (str), "createNewCopy" (bool), and "ignoreMissingReferences" (bool) keys.

  • objects (list[dict[str, Any]]) – The same saved objects passed to the original copy call, each a dict with "type" and "id" keys (max 1000).

  • include_references (bool | None) – When True, related saved objects are also copied. Server default: False.

  • create_new_copies (bool | None) – Create new copies with regenerated identifiers. Server default: True.

  • compatibility_mode (bool | None) – Apply cross-version compatibility adjustments. Server default: False. Cannot be combined with create_new_copies.

Returns:

ObjectApiResponse mapping each target space ID to a result object with success, successCount, and successResults.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.spaces.resolve_copy_saved_objects_errors(
...     objects=[{"type": "dashboard", "id": "sales-dash"}],
...     retries={
...         "marketing": [
...             {"type": "dashboard", "id": "sales-dash", "overwrite": True}
...         ]
...     },
...     create_new_copies=False,
... )
>>> print(result.body["marketing"]["success"])
True
async disable_legacy_url_aliases(*, aliases)[source]

Disable legacy URL aliases.

Disables legacy URL aliases that were created when Kibana upgraded objects to be shareable across spaces, so that the old object URLs no longer redirect to the new objects.

Parameters:

aliases (list[dict[str, Any]]) – Legacy URL aliases to disable (max 1000). Each alias is a dict with required keys "targetSpace" (the space where the alias target object exists), "targetType" (the type of the target object), and "sourceId" (the legacy object identifier).

Returns:

ObjectApiResponse, empty (HTTP 204) on success.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> await client.spaces.disable_legacy_url_aliases(
...     aliases=[
...         {
...             "targetSpace": "marketing",
...             "targetType": "dashboard",
...             "sourceId": "legacy-dash-id",
...         }
...     ]
... )
async get_shareable_references(*, objects)[source]

Get shareable references for saved objects.

Collects references and spaces context for the given saved objects — used to determine which objects (and their transitive references) will be affected before sharing them to other spaces with update_objects_spaces().

Parameters:

objects (list[dict[str, Any]]) – Saved objects to collect references for, each a dict with "type" and "id" keys (max 1000).

Returns:

ObjectApiResponse with an objects list; each entry includes the object’s type, id, spaces, and any inbound/outbound reference information (e.g. inboundReferences, spacesWithMatchingAliases, spacesWithMatchingOrigins).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> refs = await client.spaces.get_shareable_references(
...     objects=[{"type": "dashboard", "id": "sales-dash"}]
... )
>>> for obj in refs.body["objects"]:
...     print(obj["type"], obj["id"], obj["spaces"])
async update_objects_spaces(*, objects, spaces_to_add, spaces_to_remove)[source]

Update the spaces that saved objects are shared to.

Adds the given saved objects to and/or removes them from the specified spaces (sharing, not copying — the same object becomes visible in multiple spaces). Use "*" in spaces_to_add to share to all spaces.

Parameters:
  • objects (list[dict[str, Any]]) – Saved objects to update, each a dict with "type" and "id" keys (max 1000). The object type must be shareable across spaces.

  • spaces_to_add (list[str]) – Identifiers of the spaces the objects should be added to (max 1000). Pass an empty list to only remove.

  • spaces_to_remove (list[str]) – Identifiers of the spaces the objects should be removed from (max 1000). Pass an empty list to only add.

Returns:

ObjectApiResponse with an objects list; each entry includes the object’s type, id, and updated spaces array (and an error field for objects that could not be updated).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.spaces.update_objects_spaces(
...     objects=[{"type": "dashboard", "id": "sales-dash"}],
...     spaces_to_add=["marketing"],
...     spaces_to_remove=[],
... )
>>> print(result.body["objects"][0]["spaces"])
['default', 'marketing']
__init__(client, default_space_id=None, validate_spaces=True)

Initialize AsyncNamespaceClient with optional space support.

Parameters:
  • client (AsyncBaseClient) – Parent AsyncBaseClient instance to delegate requests to

  • default_space_id (str | None) – Optional default space ID for all operations

  • validate_spaces (bool) – Whether to validate space existence (default: True)

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]