FleetEpmClient¶
Client for the Kibana Fleet Elastic Package Manager (EPM) API.
The Elastic Package Manager APIs browse, install, upgrade, roll back and uninstall integration packages from the Elastic Package Registry, manage their Kibana and Elasticsearch assets, create custom integrations, and inspect the data streams shipped by installed packages.
All Fleet EPM operations are space-aware: every method accepts an optional
space_id to target a specific space.
- class kibana._sync.client.fleet_epm.FleetEpmClient(client, default_space_id=None, validate_spaces=True)[source]¶
Bases:
NamespaceClientClient for the Kibana Fleet Elastic Package Manager (EPM) API.
The Elastic Package Manager APIs browse, install, upgrade, roll back and uninstall integration packages from the Elastic Package Registry, manage their Kibana/Elasticsearch assets, create custom integrations, and inspect the data streams shipped by installed packages.
All Fleet EPM operations are space-aware: every method accepts an optional
space_idto target a specific space (Nonetargets the default space or the space the client is scoped to).Example
>>> from kibana import Kibana >>> client = Kibana("http://localhost:5601", api_key="...") >>> >>> # Browse the registry and install a pinned package version >>> client.fleet_epm.get_categories() >>> client.fleet_epm.install_package(pkg_name="tcp", pkg_version="2.3.1") >>> >>> # Inspect and uninstall it again >>> pkg = client.fleet_epm.get_package(pkg_name="tcp") >>> print(pkg.body["item"]["status"]) installed >>> client.fleet_epm.uninstall_package(pkg_name="tcp")
Browsing the Package Registry
from kibana import Kibana client = Kibana("http://localhost:5601", api_key="your_api_key") # Categories and packages categories = client.fleet_epm.get_categories() packages = client.fleet_epm.get_packages(category="custom") # A single package (latest, or a pinned version) pkg = client.fleet_epm.get_package(pkg_name="nginx") pinned = client.fleet_epm.get_package(pkg_name="nginx", pkg_version="2.3.1") # What is installed on this Kibana installed = client.fleet_epm.get_installed_packages(per_page=20) # Package content and metadata manifest = client.fleet_epm.get_package_file( pkg_name="nginx", pkg_version="2.3.1", file_path="manifest.yml" ) stats = client.fleet_epm.get_package_stats(pkg_name="nginx") deps = client.fleet_epm.get_package_dependencies( pkg_name="nginx", pkg_version="2.3.1" )
Installing, Upgrading and Uninstalling Packages
# Install the latest version from the registry client.fleet_epm.install_package(pkg_name="nginx") # Install a pinned (older) version — requires force client.fleet_epm.install_package( pkg_name="nginx", pkg_version="2.3.0", force=True ) # Install from an uploaded archive with open("my-package-1.0.0.zip", "rb") as f: client.fleet_epm.install_package_by_upload(content=f.read()) # Update package settings client.fleet_epm.update_package( pkg_name="nginx", keep_policies_up_to_date=True ) # Roll back to the previously installed version client.fleet_epm.rollback_package(pkg_name="nginx") # Uninstall client.fleet_epm.uninstall_package(pkg_name="nginx")
Bulk Operations
Bulk upgrade, uninstall and rollback are asynchronous: they return a
taskIdthat can be polled with the matching status method.# Bulk install is synchronous result = client.fleet_epm.bulk_install_packages( packages=["tcp", {"name": "udp", "version": "2.5.1"}] ) # Bulk upgrade + poll the task started = client.fleet_epm.bulk_upgrade_packages(packages=["tcp", "udp"]) status = client.fleet_epm.get_bulk_upgrade_status( task_id=started.body["taskId"] ) # Bulk uninstall (name and version are required per package) started = client.fleet_epm.bulk_uninstall_packages( packages=[{"name": "tcp", "version": "2.3.1"}] ) status = client.fleet_epm.get_bulk_uninstall_status( task_id=started.body["taskId"] )
Custom Integrations
# Create a custom integration with generated assets client.fleet_epm.create_custom_integration( integration_name="my_app", datasets=[{"name": "my_app.access", "type": "logs"}], ) # Update its README and categories (bumps the patch version) client.fleet_epm.update_custom_integration( pkg_name="my_app", read_me_data="# My app", categories=["custom"], ) # Custom integrations are deleted via the package delete endpoint client.fleet_epm.uninstall_package(pkg_name="my_app", force=True)
Data Streams and Inputs Templates
# Fleet data streams (with sizes and dashboards) streams = client.fleet_epm.get_data_streams() # EPM data stream names, filtered items = client.fleet_epm.find_data_streams(type="logs", dataset_query="nginx") # Standalone-agent inputs template for a package template = client.fleet_epm.get_inputs_template( pkg_name="nginx", pkg_version="2.3.1", format="json" )
- __init__(client, default_space_id=None, validate_spaces=True)[source]¶
Initialize the FleetEpmClient.
- Parameters:
Example
>>> fleet_epm_client = FleetEpmClient(kibana_client)
- get_categories(*, prerelease=None, include_policy_templates=None, space_id=None, validate_spaces=None)[source]¶
Get package categories.
GET /api/fleet/epm/categoriesRetrieves the list of integration categories known to the Elastic Package Registry together with the number of packages in each one.
- Parameters:
prerelease (bool | None) – Whether to include categories from prerelease (beta/technical preview) package versions.
include_policy_templates (bool | None) – Whether policy templates should be counted towards the category totals.
space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with an
itemsarray of categories, each withid,title,countand optionalparent_id/parent_title.- Raises:
BadRequestError – If the query parameters are invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> categories = client.fleet_epm.get_categories() >>> print(categories.body["items"][0]["id"]) advanced_analytics_ueba
- get_packages(*, category=None, prerelease=None, exclude_install_status=None, with_package_policies_count=None, space_id=None, validate_spaces=None)[source]¶
Get packages.
GET /api/fleet/epm/packagesLists the packages available from the Elastic Package Registry, merged with the installation status of each package on this Kibana.
- Parameters:
category (str | None) – Only return packages belonging to this category ID.
prerelease (bool | None) – Whether to include prerelease (beta/technical preview) package versions.
exclude_install_status (bool | None) – When True, the (potentially expensive) per-package install status is omitted from the response.
with_package_policies_count (bool | None) – When True, include the number of package policies that use each package.
space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with an
itemsarray of package summaries (name,version,title,status, …).- Raises:
BadRequestError – If the query parameters are invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> packages = client.fleet_epm.get_packages(category="custom") >>> print([p["name"] for p in packages.body["items"]][:3]) ['log', 'tcp', 'udp']
- get_installed_packages(*, data_stream_type=None, show_only_active_data_streams=None, name_query=None, search_after=None, per_page=None, sort_order=None, space_id=None, validate_spaces=None)[source]¶
Get installed packages.
GET /api/fleet/epm/packages/installedLists the packages installed on this Kibana, with their data streams and pagination support.
- Parameters:
data_stream_type (str | None) – Only include data streams of this type. One of
"logs","metrics","traces","synthetics"or"profiling".show_only_active_data_streams (bool | None) – Only include data streams that currently have backing indices.
name_query (str | None) – Filter installed packages by name substring.
search_after (list[str | float] | None) – Cursor from a previous response’s
searchAfterfor deep pagination.per_page (int | None) – Maximum number of packages to return.
sort_order (str | None) – Sort order for the results:
"asc"or"desc".space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with
items(installed packages withname,version,status,dataStreams),totaland an optionalsearchAftercursor.- Raises:
BadRequestError – If the query parameters are invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> installed = client.fleet_epm.get_installed_packages(per_page=10) >>> print(installed.body["total"]) 4
- get_limited_packages(*, space_id=None, validate_spaces=None)[source]¶
Get a limited package list.
GET /api/fleet/epm/packages/limitedLists the installed packages that are “limited”: packages that may only be added once to an agent policy (for example the Endpoint Security package).
- Parameters:
- Returns:
ObjectApiResponse with an
itemsarray of limited package names.- Raises:
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> limited = client.fleet_epm.get_limited_packages() >>> print(limited.body["items"]) []
- get_package(*, pkg_name, pkg_version=None, ignore_unverified=None, prerelease=None, full=None, with_metadata=None, space_id=None, validate_spaces=None)[source]¶
Get a package.
GET /api/fleet/epm/packages/{pkgName}orGET /api/fleet/epm/packages/{pkgName}/{pkgVersion}Retrieves detailed information about a package (latest version if
pkg_versionis omitted), including its installation status and assets.- Parameters:
pkg_name (str) – Name of the package (e.g.
"nginx").pkg_version (str | None) – Specific package version to fetch. When omitted, the latest available version is returned.
ignore_unverified (bool | None) – Whether to return the package even if its signature cannot be verified.
prerelease (bool | None) – Whether prerelease versions may be returned as the latest version.
full (bool | None) – When True, return the full package manifest and assets.
with_metadata (bool | None) – When True, include package metadata (e.g.
has_policies) in the response.space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with an
itemobject describing the package (name,version,status,latestVersion,installationInfowhen installed, …) and optionalmetadata.- Raises:
NotFoundError – If the package does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> pkg = client.fleet_epm.get_package(pkg_name="tcp") >>> print(pkg.body["item"]["latestVersion"]) 2.3.1
- get_package_stats(*, pkg_name, space_id=None, validate_spaces=None)[source]¶
Get package stats.
GET /api/fleet/epm/packages/{pkgName}/statsRetrieves usage statistics for a package: how many agent policies and package policies use it.
- Parameters:
- Returns:
ObjectApiResponse with a
responseobject containingagent_policy_countandpackage_policy_count.- Raises:
NotFoundError – If the package does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> stats = client.fleet_epm.get_package_stats(pkg_name="tcp") >>> print(stats.body["response"]["package_policy_count"]) 0
- get_package_file(*, pkg_name, pkg_version, file_path, space_id=None, validate_spaces=None)[source]¶
Get a package file.
GET /api/fleet/epm/packages/{pkgName}/{pkgVersion}/{filePath}Downloads a single file from a package archive (for example its manifest, docs or images).
- Parameters:
pkg_name (str) – Name of the package.
pkg_version (str) – Version of the package.
file_path (str) – Path of the file inside the package archive (e.g.
"manifest.yml"or"docs/README.md"). Slashes are preserved.space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
text files (YAML, Markdown, …) are returned as
str, binary files (images) asbytes, and JSON files as parsed objects.- Return type:
ApiResponse whose body is the raw file content
- Raises:
NotFoundError – If the package or file does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
Example
>>> manifest = client.fleet_epm.get_package_file( ... pkg_name="tcp", pkg_version="2.3.1", file_path="manifest.yml" ... ) >>> print(manifest.body.splitlines()[1]) name: tcp
- get_package_dependencies(*, pkg_name, pkg_version, space_id=None, validate_spaces=None)[source]¶
Get package dependencies.
GET /api/fleet/epm/packages/{pkgName}/{pkgVersion}/dependenciesLists the packages that a given package version depends on.
- Parameters:
- Returns:
ObjectApiResponse with an
itemsarray of dependency packages (nameandversioneach).- Raises:
NotFoundError – If the package does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> deps = client.fleet_epm.get_package_dependencies( ... pkg_name="tcp", pkg_version="2.3.1" ... ) >>> print(deps.body["items"]) []
- get_verification_key_id(*, space_id=None, validate_spaces=None)[source]¶
Get a package signature verification key ID.
GET /api/fleet/epm/verification_key_idReturns the ID of the PGP key used to verify package signatures, or
nullif package verification is disabled.- Parameters:
- Returns:
ObjectApiResponse with an
idstring (orNone).- Raises:
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> key = client.fleet_epm.get_verification_key_id() >>> print(key.body["id"]) d27d666cd88e42b4
- install_package(*, pkg_name, pkg_version=None, force=None, ignore_constraints=None, prerelease=None, ignore_mapping_update_errors=None, skip_data_stream_rollover=None, skip_dependency_check=None, space_id=None, validate_spaces=None)[source]¶
Install a package from the registry.
POST /api/fleet/epm/packages/{pkgName}orPOST /api/fleet/epm/packages/{pkgName}/{pkgVersion}Installs a package (latest version if
pkg_versionis omitted) from the Elastic Package Registry, creating all of its Kibana and Elasticsearch assets.Note: installing a version older than the latest available one is rejected by Kibana with a 400 (“out-of-date”) unless
force=True.- Parameters:
pkg_name (str) – Name of the package to install.
pkg_version (str | None) – Specific version to install. When omitted, the latest available version is installed.
force (bool | None) – Force installation (e.g. of an outdated version or over a failed install).
ignore_constraints (bool | None) – Ignore the package’s Kibana version constraints.
prerelease (bool | None) – Whether prerelease versions may be selected as the latest version.
ignore_mapping_update_errors (bool | None) – Continue the installation even if updating index mappings fails.
skip_data_stream_rollover (bool | None) – Do not roll over existing data streams when mappings change.
skip_dependency_check (bool | None) – Skip the check for packages this package depends on.
space_id (str | None) – Optional space ID to install the package in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with an
itemsarray of created assets and a_metaobject withinstall_sourceandname.- Raises:
BadRequestError – If the version is out-of-date and
forceis not set, or the request is otherwise invalid.NotFoundError – If the package does not exist.
ConflictError – If a concurrent installation is in progress.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> result = client.fleet_epm.install_package( ... pkg_name="tcp", pkg_version="2.3.1" ... ) >>> print(result.body["_meta"]["install_source"]) registry
- install_package_by_upload(*, content, content_type='application/zip', ignore_mapping_update_errors=None, skip_data_stream_rollover=None, space_id=None, validate_spaces=None)[source]¶
Install a package by upload.
POST /api/fleet/epm/packagesInstalls a package from an uploaded
.zipor.tar.gzarchive instead of the Elastic Package Registry. The archive bytes are sent as the raw request body.- Parameters:
content (bytes) – Raw bytes of the package archive.
content_type (str) – Content type of the archive:
"application/zip"(default) or"application/gzip".ignore_mapping_update_errors (bool | None) – Continue the installation even if updating index mappings fails.
skip_data_stream_rollover (bool | None) – Do not roll over existing data streams when mappings change.
space_id (str | None) – Optional space ID to install the package in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with an
itemsarray of created assets and a_metaobject withinstall_source: "upload"andname.- Raises:
BadRequestError – If the archive is invalid.
ConflictError – If a concurrent installation is in progress.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> with open("tcp-2.3.1.zip", "rb") as f: ... result = client.fleet_epm.install_package_by_upload( ... content=f.read() ... ) >>> print(result.body["_meta"]["install_source"]) upload
- update_package(*, pkg_name, pkg_version=None, keep_policies_up_to_date=None, namespace_customization_enabled_for=None, space_id=None, validate_spaces=None)[source]¶
Update package settings.
PUT /api/fleet/epm/packages/{pkgName}orPUT /api/fleet/epm/packages/{pkgName}/{pkgVersion}Updates settings of an installed package, such as whether its package policies should be automatically kept up to date.
- Parameters:
pkg_name (str) – Name of the installed package.
pkg_version (str | None) – Version of the installed package. Optional; the installed package is targeted either way.
keep_policies_up_to_date (bool | None) – Automatically upgrade the package’s policies when the package is upgraded.
namespace_customization_enabled_for (list[str] | None) – Namespaces for which namespace-level customization is enabled on this package.
space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with an
itemobject describing the updated package.- Raises:
BadRequestError – If the body is invalid or the package is not installed.
NotFoundError – If the package does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> updated = client.fleet_epm.update_package( ... pkg_name="tcp", keep_policies_up_to_date=False ... ) >>> print(updated.body["item"]["keepPoliciesUpToDate"]) False
- uninstall_package(*, pkg_name, pkg_version=None, force=None, space_id=None, validate_spaces=None)[source]¶
Delete (uninstall) a package.
DELETE /api/fleet/epm/packages/{pkgName}orDELETE /api/fleet/epm/packages/{pkgName}/{pkgVersion}Uninstalls a package, removing its Kibana and Elasticsearch assets.
- Parameters:
pkg_name (str) – Name of the package to uninstall.
pkg_version (str | None) – Version of the installed package. Optional; the installed package is targeted either way.
force (bool | None) – Force the uninstall even if the package is in use or required by policies.
space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with an
itemsarray of deleted assets.- Raises:
BadRequestError – If the package is in use and
forceis not set.NotFoundError – If the package is not installed.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> result = client.fleet_epm.uninstall_package(pkg_name="tcp") >>> print(len(result.body["items"]) >= 0) True
- rollback_package(*, pkg_name, space_id=None, validate_spaces=None)[source]¶
Rollback a package to its previous version.
POST /api/fleet/epm/packages/{pkgName}/rollbackRolls an upgraded package back to the previously installed version. Requires that the package was previously upgraded on this Kibana so a previous version is known.
- Parameters:
- Returns:
ObjectApiResponse with
version(the version rolled back to) andsuccess.- Raises:
BadRequestError – If there is no previous version to roll back to.
NotFoundError – If the package is not installed.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> result = client.fleet_epm.rollback_package(pkg_name="tcp") >>> print(result.body["success"]) True
- review_upgrade(*, pkg_name, action, target_version, space_id=None, validate_spaces=None)[source]¶
Review a pending policy upgrade for a package with deprecations.
POST /api/fleet/epm/packages/{pkgName}/review_upgradeRecords the review decision (accept/decline/pending) for a pending package policy upgrade that contains deprecated configuration.
- Parameters:
pkg_name (str) – Name of the package with a pending upgrade review.
action (str) – Review decision:
"accept","decline"or"pending".target_version (str) – The package version the pending upgrade targets.
space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse describing the review result.
- Raises:
NotFoundError – If there is no pending upgrade review for the package/version (message:
"No pending upgrade review for <pkg>@<version>").BadRequestError – If the body is invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> client.fleet_epm.review_upgrade( ... pkg_name="tcp", action="accept", target_version="2.3.1" ... )
- bulk_install_packages(*, packages, force=None, prerelease=None, space_id=None, validate_spaces=None)[source]¶
Bulk install packages.
POST /api/fleet/epm/packages/_bulkInstalls multiple packages from the Elastic Package Registry in one request. Unlike the other bulk package operations this endpoint is synchronous: the result for every package is in the response.
- Parameters:
packages (list[str | dict[str, Any]]) – Packages to install. Each entry is either a package name string (latest version) or a dict with
nameandversion(and optionalprerelease).force (bool | None) – Force installation of the packages.
prerelease (bool | None) – Whether prerelease versions may be selected as latest versions.
space_id (str | None) – Optional space ID to install the packages in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with an
itemsarray holding a success or error result per package.- Raises:
BadRequestError – If the body is invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> result = client.fleet_epm.bulk_install_packages( ... packages=["tcp", {"name": "udp", "version": "2.5.1"}] ... ) >>> print([i["name"] for i in result.body["items"]]) ['tcp', 'udp']
- bulk_upgrade_packages(*, packages, force=None, prerelease=None, upgrade_package_policies=None, space_id=None, validate_spaces=None)[source]¶
Bulk upgrade packages.
POST /api/fleet/epm/packages/_bulk_upgradeStarts an asynchronous bulk upgrade of installed packages. The response contains a
taskId; pollget_bulk_upgrade_status()for progress and results.- Parameters:
packages (list[str | dict[str, Any]]) – Packages to upgrade. Each entry is either a package name string or a dict with
nameand optionalversion(defaults to the latest available version).force (bool | None) – Force the upgrades.
prerelease (bool | None) – Whether prerelease versions may be upgrade targets.
upgrade_package_policies (bool | None) – Also upgrade the packages’ package policies.
space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with the
taskIdof the upgrade task.- Raises:
BadRequestError – If the body is invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> started = client.fleet_epm.bulk_upgrade_packages(packages=["tcp"]) >>> task_id = started.body["taskId"]
- get_bulk_upgrade_status(*, task_id, space_id=None, validate_spaces=None)[source]¶
Get bulk upgrade packages details.
GET /api/fleet/epm/packages/_bulk_upgrade/{taskId}Retrieves the status of an asynchronous bulk upgrade started with
bulk_upgrade_packages().- Parameters:
- Returns:
ObjectApiResponse with
status("pending","success"or"failed"), per-packageresultswhen finished, and anerrorobject on failure.- Raises:
NotFoundError – If no bulk upgrade task exists for the ID.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> status = client.fleet_epm.get_bulk_upgrade_status(task_id=task_id) >>> print(status.body["status"]) success
- bulk_uninstall_packages(*, packages, force=None, space_id=None, validate_spaces=None)[source]¶
Bulk uninstall packages.
POST /api/fleet/epm/packages/_bulk_uninstallStarts an asynchronous bulk uninstall of installed packages. The response contains a
taskId; pollget_bulk_uninstall_status()for progress and results.- Parameters:
packages (list[dict[str, Any]]) – Packages to uninstall. Each entry is a dict with
nameandversion(both required by the API).force (bool | None) – Force the uninstalls even if packages are in use.
space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with the
taskIdof the uninstall task.- Raises:
BadRequestError – If the body is invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> started = client.fleet_epm.bulk_uninstall_packages( ... packages=[{"name": "tcp", "version": "2.3.1"}] ... ) >>> task_id = started.body["taskId"]
- get_bulk_uninstall_status(*, task_id, space_id=None, validate_spaces=None)[source]¶
Get bulk uninstall packages details.
GET /api/fleet/epm/packages/_bulk_uninstall/{taskId}Retrieves the status of an asynchronous bulk uninstall started with
bulk_uninstall_packages().- Parameters:
- Returns:
ObjectApiResponse with
status("pending","success"or"failed"), per-packageresultswhen finished, and anerrorobject on failure.- Raises:
NotFoundError – If no bulk uninstall task exists for the ID.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> status = client.fleet_epm.get_bulk_uninstall_status(task_id=task_id) >>> print(status.body["status"]) success
- bulk_rollback_packages(*, packages, space_id=None, validate_spaces=None)[source]¶
Bulk rollback packages.
POST /api/fleet/epm/packages/_bulk_rollbackStarts an asynchronous bulk rollback of upgraded packages to their previous versions. The response contains a
taskId; pollget_bulk_rollback_status()for progress and results.- Parameters:
- Returns:
ObjectApiResponse with the
taskIdof the rollback task.- Raises:
BadRequestError – If the body is invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> started = client.fleet_epm.bulk_rollback_packages(packages=["tcp"]) >>> task_id = started.body["taskId"]
- get_bulk_rollback_status(*, task_id, space_id=None, validate_spaces=None)[source]¶
Get bulk rollback packages details.
GET /api/fleet/epm/packages/_bulk_rollback/{taskId}Retrieves the status of an asynchronous bulk rollback started with
bulk_rollback_packages().- Parameters:
- Returns:
ObjectApiResponse with
status("pending","success"or"failed"), per-packageresultswhen finished, and anerrorobject on failure.- Raises:
NotFoundError – If no bulk rollback task exists for the ID.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> status = client.fleet_epm.get_bulk_rollback_status(task_id=task_id) >>> print(status.body["status"]) success
- bulk_get_assets(*, asset_ids, space_id=None, validate_spaces=None)[source]¶
Bulk get assets.
POST /api/fleet/epm/bulk_assetsRetrieves details (including app links) for a set of package assets by ID and type, e.g. the assets listed in an install response.
- Parameters:
asset_ids (list[dict[str, Any]]) – Assets to fetch. Each entry is a dict with
idandtype(e.g.{"id": "logs-tcp.generic", "type": "index_template"}).space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with an
itemsarray of asset details (id,type,attributes,appLink).- Raises:
BadRequestError – If the body is invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> assets = client.fleet_epm.bulk_get_assets( ... asset_ids=[{"id": "logs-tcp.generic", "type": "index_template"}] ... ) >>> print(assets.body["items"][0]["appLink"]) /app/management/data/index_management/templates/logs-tcp.generic
- install_kibana_assets(*, pkg_name, pkg_version, force=None, space_ids=None, space_id=None, validate_spaces=None)[source]¶
Install Kibana assets for a package.
POST /api/fleet/epm/packages/{pkgName}/{pkgVersion}/kibana_assets(Re-)installs the Kibana assets (dashboards, visualizations, …) of an installed package, optionally into additional spaces.
- Parameters:
pkg_name (str) – Name of the installed package.
pkg_version (str) – Version of the installed package.
force (bool | None) – Force the asset installation.
space_ids (list[str] | None) – When provided, assets are installed in the specified spaces instead of the current space.
space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with
success: trueon success.- Raises:
BadRequestError – If the package is not installed.
NotFoundError – If the package does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> result = client.fleet_epm.install_kibana_assets( ... pkg_name="tcp", pkg_version="2.3.1" ... ) >>> print(result.body["success"]) True
- delete_kibana_assets(*, pkg_name, pkg_version, space_id=None, validate_spaces=None)[source]¶
Delete Kibana assets for a package.
DELETE /api/fleet/epm/packages/{pkgName}/{pkgVersion}/kibana_assetsRemoves the Kibana assets a package installed into the current space. Note: Kibana rejects deleting the assets from the space where the package itself was installed — uninstall the package instead.
- Parameters:
- Returns:
ObjectApiResponse with
success: trueon success.- Raises:
BadRequestError – If called in the space where the package was installed (message:
"Impossible to delete kibana assets from the space where the package was installed, you must uninstall the package.").NotFoundError – If the package does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> client.fleet_epm.delete_kibana_assets( ... pkg_name="tcp", pkg_version="2.3.1", space_id="other-space" ... )
- install_rule_assets(*, pkg_name, pkg_version, force=None, space_id=None, validate_spaces=None)[source]¶
Install Kibana alert rules for a package.
POST /api/fleet/epm/packages/{pkgName}/{pkgVersion}/rule_assetsInstalls the alerting rule assets shipped by an installed package.
- Parameters:
pkg_name (str) – Name of the installed package.
pkg_version (str) – Version of the installed package.
force (bool | None) – Force the rule asset installation.
space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with
success: trueon success.- Raises:
BadRequestError – If the package is not installed.
NotFoundError – If the package does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> result = client.fleet_epm.install_rule_assets( ... pkg_name="tcp", pkg_version="2.3.1" ... ) >>> print(result.body["success"]) True
- delete_datastream_assets(*, pkg_name, pkg_version, package_policy_id, space_id=None, validate_spaces=None)[source]¶
Delete assets for an input package.
DELETE /api/fleet/epm/packages/{pkgName}/{pkgVersion}/datastream_assetsDeletes the data-stream assets an input package created for a specific package policy.
- Parameters:
pkg_name (str) – Name of the installed input package.
pkg_version (str) – Version of the installed input package.
package_policy_id (str) – ID of the package policy whose data-stream assets should be deleted.
space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with
success: trueon success.- Raises:
NotFoundError – If the package policy does not exist (message:
"Package policy with id <id> not found").BadRequestError – If the package is not an installed input package.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> client.fleet_epm.delete_datastream_assets( ... pkg_name="tcp", pkg_version="2.3.1", ... package_policy_id="d5b1e4b0-...", ... )
- authorize_transforms(*, pkg_name, pkg_version, transforms, prerelease=None, space_id=None, validate_spaces=None)[source]¶
Authorize transforms.
POST /api/fleet/epm/packages/{pkgName}/{pkgVersion}/transforms/authorizeRe-authorizes the Elasticsearch transforms installed by a package so they run with the current user’s permissions.
- Parameters:
pkg_name (str) – Name of the installed package.
pkg_version (str) – Version of the installed package.
transforms (list[str | dict[str, Any]]) – Transforms to authorize. Each entry is either a transform ID string or a dict with
transformId.prerelease (bool | None) – Whether prerelease package versions are considered.
space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ApiResponse whose body is a list with one result per transform (
transformId,success, optionalerror).- Raises:
BadRequestError – If the body is invalid.
NotFoundError – If the package does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> result = client.fleet_epm.authorize_transforms( ... pkg_name="ti_util", pkg_version="1.1.0", ... transforms=["logs-ti_util.latest_ioc-default-1.1.0"], ... )
- create_custom_integration(*, integration_name, datasets, force=None, space_id=None, validate_spaces=None)[source]¶
Create a custom integration.
POST /api/fleet/epm/custom_integrationsCreates and installs a custom integration package with the given datasets (index templates, ingest pipelines and component templates are generated automatically).
- Parameters:
integration_name (str) – Name of the custom integration package.
datasets (list[dict[str, Any]]) – Datasets the integration ships. Each entry is a dict with
nameandtype(one of"logs","metrics","traces","synthetics","profiling"). Maximum of 10 datasets.force (bool | None) – Force creation even if the integration already exists.
space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with an
itemsarray of created assets and a_metaobject withinstall_source: "custom".- Raises:
BadRequestError – If the body is invalid.
ConflictError – If the integration already exists and
forceis not set.AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> created = client.fleet_epm.create_custom_integration( ... integration_name="my_custom_app", ... datasets=[{"name": "my_custom_app.access", "type": "logs"}], ... ) >>> print(created.body["_meta"]["install_source"]) custom
- update_custom_integration(*, pkg_name, read_me_data, categories=None, space_id=None, validate_spaces=None)[source]¶
Update a custom integration.
PUT /api/fleet/epm/custom_integrations/{pkgName}Updates a previously created custom integration (its README and categories), bumping the integration’s patch version.
- Parameters:
pkg_name (str) – Name of the custom integration package.
read_me_data (str) – README (Markdown) content for the integration. Required by the API.
categories (list[str] | None) – Categories to assign to the integration.
space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with the integration
idand aresultobject containing the newversionandstatus.- Raises:
BadRequestError – If
read_me_datais missing or the body is otherwise invalid.NotFoundError – If the custom integration does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> updated = client.fleet_epm.update_custom_integration( ... pkg_name="my_custom_app", ... read_me_data="# My custom app", ... categories=["custom"], ... ) >>> print(updated.body["result"]["version"]) 1.0.1
- get_data_streams(*, space_id=None, validate_spaces=None)[source]¶
Get Fleet data streams.
GET /api/fleet/data_streamsLists the data streams created by Fleet-managed integrations, including their size, last-activity timestamp and associated dashboards.
- Parameters:
- Returns:
ObjectApiResponse with a
data_streamsarray (each entry hasindex,dataset,namespace,type,package,size_in_bytes,dashboards, …).- Raises:
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> streams = client.fleet_epm.get_data_streams() >>> print(type(streams.body["data_streams"])) <class 'list'>
- find_data_streams(*, type=None, dataset_query=None, sort_order=None, uncategorised_only=None, space_id=None, validate_spaces=None)[source]¶
Find EPM data streams.
GET /api/fleet/epm/data_streamsLists existing data-stream names known to the Elastic Package Manager, filtered by type and dataset query (used e.g. when creating custom integrations).
- Parameters:
type (str | None) – Only include data streams of this type. One of
"logs","metrics","traces","synthetics"or"profiling".dataset_query (str | None) – Filter data streams by dataset name substring.
sort_order (str | None) – Sort order for the results:
"asc"or"desc".uncategorised_only (bool | None) – Only include data streams that do not belong to any installed package.
space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with an
itemsarray of data streams (each with aname).- Raises:
BadRequestError – If the query parameters are invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> streams = client.fleet_epm.find_data_streams(type="logs") >>> print(streams.body["items"][0]["name"]) logs-elastic_agent-default
- get_inputs_template(*, pkg_name, pkg_version, format=None, prerelease=None, ignore_unverified=None, space_id=None, validate_spaces=None)[source]¶
Get an inputs template.
GET /api/fleet/epm/templates/{pkgName}/{pkgVersion}/inputsRetrieves the agent inputs template of a package, as JSON or YAML — useful for standalone-agent configuration.
- Parameters:
pkg_name (str) – Name of the package.
pkg_version (str) – Version of the package.
format (str | None) – Response format:
"json","yml"or"yaml". Defaults to YAML on the server.prerelease (bool | None) – Whether prerelease package versions are considered.
ignore_unverified (bool | None) – Whether to use the package even if its signature cannot be verified.
space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ApiResponse whose body is an object with an
inputsarray forformat="json", or the raw YAML string otherwise.- Raises:
NotFoundError – If the package does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> template = client.fleet_epm.get_inputs_template( ... pkg_name="tcp", pkg_version="2.3.1", format="json" ... ) >>> print(template.body["inputs"][0]["type"]) tcp
AsyncFleetEpmClient¶
Asynchronous version of the FleetEpmClient for use with async/await syntax.
- class kibana._async.client.fleet_epm.AsyncFleetEpmClient(client, default_space_id=None, validate_spaces=True)[source]¶
Bases:
AsyncNamespaceClientAsync client for the Kibana Fleet Elastic Package Manager (EPM) API.
The Elastic Package Manager APIs browse, install, upgrade, roll back and uninstall integration packages from the Elastic Package Registry, manage their Kibana/Elasticsearch assets, create custom integrations, and inspect the data streams shipped by installed packages.
All Fleet EPM operations are space-aware: every method accepts an optional
space_idto target a specific space (Nonetargets the default space or the space the client is scoped to).Example
>>> from kibana import AsyncKibana >>> client = AsyncKibana("http://localhost:5601", api_key="...") >>> >>> # Browse the registry and install a pinned package version >>> await client.fleet_epm.get_categories() >>> await client.fleet_epm.install_package(pkg_name="tcp", pkg_version="2.3.1") >>> >>> # Inspect and uninstall it again >>> pkg = await client.fleet_epm.get_package(pkg_name="tcp") >>> print(pkg.body["item"]["status"]) installed >>> await client.fleet_epm.uninstall_package(pkg_name="tcp")
Usage
The AsyncFleetEpmClient provides the same methods as FleetEpmClient 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: # Install a package (async) await client.fleet_epm.install_package(pkg_name="tcp") # Inspect it pkg = await client.fleet_epm.get_package(pkg_name="tcp") print(pkg.body["item"]["status"]) # Uninstall it again await client.fleet_epm.uninstall_package(pkg_name="tcp") asyncio.run(main())
- __init__(client, default_space_id=None, validate_spaces=True)[source]¶
Initialize the AsyncFleetEpmClient.
- Parameters:
client (AsyncKibana) – The parent AsyncKibana client 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 before space-scoped operations (default: True).
Example
>>> fleet_epm_client = AsyncFleetEpmClient(kibana_client)
- async get_categories(*, prerelease=None, include_policy_templates=None, space_id=None, validate_spaces=None)[source]¶
Get package categories.
GET /api/fleet/epm/categoriesRetrieves the list of integration categories known to the Elastic Package Registry together with the number of packages in each one.
- Parameters:
prerelease (bool | None) – Whether to include categories from prerelease (beta/technical preview) package versions.
include_policy_templates (bool | None) – Whether policy templates should be counted towards the category totals.
space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with an
itemsarray of categories, each withid,title,countand optionalparent_id/parent_title.- Raises:
BadRequestError – If the query parameters are invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> categories = await client.fleet_epm.get_categories() >>> print(categories.body["items"][0]["id"]) advanced_analytics_ueba
- async get_packages(*, category=None, prerelease=None, exclude_install_status=None, with_package_policies_count=None, space_id=None, validate_spaces=None)[source]¶
Get packages.
GET /api/fleet/epm/packagesLists the packages available from the Elastic Package Registry, merged with the installation status of each package on this Kibana.
- Parameters:
category (str | None) – Only return packages belonging to this category ID.
prerelease (bool | None) – Whether to include prerelease (beta/technical preview) package versions.
exclude_install_status (bool | None) – When True, the (potentially expensive) per-package install status is omitted from the response.
with_package_policies_count (bool | None) – When True, include the number of package policies that use each package.
space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with an
itemsarray of package summaries (name,version,title,status, …).- Raises:
BadRequestError – If the query parameters are invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> packages = await client.fleet_epm.get_packages(category="custom") >>> print([p["name"] for p in packages.body["items"]][:3]) ['log', 'tcp', 'udp']
- async get_installed_packages(*, data_stream_type=None, show_only_active_data_streams=None, name_query=None, search_after=None, per_page=None, sort_order=None, space_id=None, validate_spaces=None)[source]¶
Get installed packages.
GET /api/fleet/epm/packages/installedLists the packages installed on this Kibana, with their data streams and pagination support.
- Parameters:
data_stream_type (str | None) – Only include data streams of this type. One of
"logs","metrics","traces","synthetics"or"profiling".show_only_active_data_streams (bool | None) – Only include data streams that currently have backing indices.
name_query (str | None) – Filter installed packages by name substring.
search_after (list[str | float] | None) – Cursor from a previous response’s
searchAfterfor deep pagination.per_page (int | None) – Maximum number of packages to return.
sort_order (str | None) – Sort order for the results:
"asc"or"desc".space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with
items(installed packages withname,version,status,dataStreams),totaland an optionalsearchAftercursor.- Raises:
BadRequestError – If the query parameters are invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> installed = await client.fleet_epm.get_installed_packages(per_page=10) >>> print(installed.body["total"]) 4
- async get_limited_packages(*, space_id=None, validate_spaces=None)[source]¶
Get a limited package list.
GET /api/fleet/epm/packages/limitedLists the installed packages that are “limited”: packages that may only be added once to an agent policy (for example the Endpoint Security package).
- Parameters:
- Returns:
ObjectApiResponse with an
itemsarray of limited package names.- Raises:
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> limited = await client.fleet_epm.get_limited_packages() >>> print(limited.body["items"]) []
- async get_package(*, pkg_name, pkg_version=None, ignore_unverified=None, prerelease=None, full=None, with_metadata=None, space_id=None, validate_spaces=None)[source]¶
Get a package.
GET /api/fleet/epm/packages/{pkgName}orGET /api/fleet/epm/packages/{pkgName}/{pkgVersion}Retrieves detailed information about a package (latest version if
pkg_versionis omitted), including its installation status and assets.- Parameters:
pkg_name (str) – Name of the package (e.g.
"nginx").pkg_version (str | None) – Specific package version to fetch. When omitted, the latest available version is returned.
ignore_unverified (bool | None) – Whether to return the package even if its signature cannot be verified.
prerelease (bool | None) – Whether prerelease versions may be returned as the latest version.
full (bool | None) – When True, return the full package manifest and assets.
with_metadata (bool | None) – When True, include package metadata (e.g.
has_policies) in the response.space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with an
itemobject describing the package (name,version,status,latestVersion,installationInfowhen installed, …) and optionalmetadata.- Raises:
NotFoundError – If the package does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> pkg = await client.fleet_epm.get_package(pkg_name="tcp") >>> print(pkg.body["item"]["latestVersion"]) 2.3.1
- async get_package_stats(*, pkg_name, space_id=None, validate_spaces=None)[source]¶
Get package stats.
GET /api/fleet/epm/packages/{pkgName}/statsRetrieves usage statistics for a package: how many agent policies and package policies use it.
- Parameters:
- Returns:
ObjectApiResponse with a
responseobject containingagent_policy_countandpackage_policy_count.- Raises:
NotFoundError – If the package does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> stats = await client.fleet_epm.get_package_stats(pkg_name="tcp") >>> print(stats.body["response"]["package_policy_count"]) 0
- async get_package_file(*, pkg_name, pkg_version, file_path, space_id=None, validate_spaces=None)[source]¶
Get a package file.
GET /api/fleet/epm/packages/{pkgName}/{pkgVersion}/{filePath}Downloads a single file from a package archive (for example its manifest, docs or images).
- Parameters:
pkg_name (str) – Name of the package.
pkg_version (str) – Version of the package.
file_path (str) – Path of the file inside the package archive (e.g.
"manifest.yml"or"docs/README.md"). Slashes are preserved.space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
text files (YAML, Markdown, …) are returned as
str, binary files (images) asbytes, and JSON files as parsed objects.- Return type:
ApiResponse whose body is the raw file content
- Raises:
NotFoundError – If the package or file does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
Example
>>> manifest = await client.fleet_epm.get_package_file( ... pkg_name="tcp", pkg_version="2.3.1", file_path="manifest.yml" ... ) >>> print(manifest.body.splitlines()[1]) name: tcp
- async get_package_dependencies(*, pkg_name, pkg_version, space_id=None, validate_spaces=None)[source]¶
Get package dependencies.
GET /api/fleet/epm/packages/{pkgName}/{pkgVersion}/dependenciesLists the packages that a given package version depends on.
- Parameters:
- Returns:
ObjectApiResponse with an
itemsarray of dependency packages (nameandversioneach).- Raises:
NotFoundError – If the package does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> deps = await client.fleet_epm.get_package_dependencies( ... pkg_name="tcp", pkg_version="2.3.1" ... ) >>> print(deps.body["items"]) []
- async get_verification_key_id(*, space_id=None, validate_spaces=None)[source]¶
Get a package signature verification key ID.
GET /api/fleet/epm/verification_key_idReturns the ID of the PGP key used to verify package signatures, or
nullif package verification is disabled.- Parameters:
- Returns:
ObjectApiResponse with an
idstring (orNone).- Raises:
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> key = await client.fleet_epm.get_verification_key_id() >>> print(key.body["id"]) d27d666cd88e42b4
- async install_package(*, pkg_name, pkg_version=None, force=None, ignore_constraints=None, prerelease=None, ignore_mapping_update_errors=None, skip_data_stream_rollover=None, skip_dependency_check=None, space_id=None, validate_spaces=None)[source]¶
Install a package from the registry.
POST /api/fleet/epm/packages/{pkgName}orPOST /api/fleet/epm/packages/{pkgName}/{pkgVersion}Installs a package (latest version if
pkg_versionis omitted) from the Elastic Package Registry, creating all of its Kibana and Elasticsearch assets.Note: installing a version older than the latest available one is rejected by Kibana with a 400 (“out-of-date”) unless
force=True.- Parameters:
pkg_name (str) – Name of the package to install.
pkg_version (str | None) – Specific version to install. When omitted, the latest available version is installed.
force (bool | None) – Force installation (e.g. of an outdated version or over a failed install).
ignore_constraints (bool | None) – Ignore the package’s Kibana version constraints.
prerelease (bool | None) – Whether prerelease versions may be selected as the latest version.
ignore_mapping_update_errors (bool | None) – Continue the installation even if updating index mappings fails.
skip_data_stream_rollover (bool | None) – Do not roll over existing data streams when mappings change.
skip_dependency_check (bool | None) – Skip the check for packages this package depends on.
space_id (str | None) – Optional space ID to install the package in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with an
itemsarray of created assets and a_metaobject withinstall_sourceandname.- Raises:
BadRequestError – If the version is out-of-date and
forceis not set, or the request is otherwise invalid.NotFoundError – If the package does not exist.
ConflictError – If a concurrent installation is in progress.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> result = await client.fleet_epm.install_package( ... pkg_name="tcp", pkg_version="2.3.1" ... ) >>> print(result.body["_meta"]["install_source"]) registry
- async install_package_by_upload(*, content, content_type='application/zip', ignore_mapping_update_errors=None, skip_data_stream_rollover=None, space_id=None, validate_spaces=None)[source]¶
Install a package by upload.
POST /api/fleet/epm/packagesInstalls a package from an uploaded
.zipor.tar.gzarchive instead of the Elastic Package Registry. The archive bytes are sent as the raw request body.- Parameters:
content (bytes) – Raw bytes of the package archive.
content_type (str) – Content type of the archive:
"application/zip"(default) or"application/gzip".ignore_mapping_update_errors (bool | None) – Continue the installation even if updating index mappings fails.
skip_data_stream_rollover (bool | None) – Do not roll over existing data streams when mappings change.
space_id (str | None) – Optional space ID to install the package in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with an
itemsarray of created assets and a_metaobject withinstall_source: "upload"andname.- Raises:
BadRequestError – If the archive is invalid.
ConflictError – If a concurrent installation is in progress.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> with open("tcp-2.3.1.zip", "rb") as f: ... result = await client.fleet_epm.install_package_by_upload( ... content=f.read() ... ) >>> print(result.body["_meta"]["install_source"]) upload
- async update_package(*, pkg_name, pkg_version=None, keep_policies_up_to_date=None, namespace_customization_enabled_for=None, space_id=None, validate_spaces=None)[source]¶
Update package settings.
PUT /api/fleet/epm/packages/{pkgName}orPUT /api/fleet/epm/packages/{pkgName}/{pkgVersion}Updates settings of an installed package, such as whether its package policies should be automatically kept up to date.
- Parameters:
pkg_name (str) – Name of the installed package.
pkg_version (str | None) – Version of the installed package. Optional; the installed package is targeted either way.
keep_policies_up_to_date (bool | None) – Automatically upgrade the package’s policies when the package is upgraded.
namespace_customization_enabled_for (list[str] | None) – Namespaces for which namespace-level customization is enabled on this package.
space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with an
itemobject describing the updated package.- Raises:
BadRequestError – If the body is invalid or the package is not installed.
NotFoundError – If the package does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> updated = await client.fleet_epm.update_package( ... pkg_name="tcp", keep_policies_up_to_date=False ... ) >>> print(updated.body["item"]["keepPoliciesUpToDate"]) False
- async uninstall_package(*, pkg_name, pkg_version=None, force=None, space_id=None, validate_spaces=None)[source]¶
Delete (uninstall) a package.
DELETE /api/fleet/epm/packages/{pkgName}orDELETE /api/fleet/epm/packages/{pkgName}/{pkgVersion}Uninstalls a package, removing its Kibana and Elasticsearch assets.
- Parameters:
pkg_name (str) – Name of the package to uninstall.
pkg_version (str | None) – Version of the installed package. Optional; the installed package is targeted either way.
force (bool | None) – Force the uninstall even if the package is in use or required by policies.
space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with an
itemsarray of deleted assets.- Raises:
BadRequestError – If the package is in use and
forceis not set.NotFoundError – If the package is not installed.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> result = await client.fleet_epm.uninstall_package(pkg_name="tcp") >>> print(len(result.body["items"]) >= 0) True
- async rollback_package(*, pkg_name, space_id=None, validate_spaces=None)[source]¶
Rollback a package to its previous version.
POST /api/fleet/epm/packages/{pkgName}/rollbackRolls an upgraded package back to the previously installed version. Requires that the package was previously upgraded on this Kibana so a previous version is known.
- Parameters:
- Returns:
ObjectApiResponse with
version(the version rolled back to) andsuccess.- Raises:
BadRequestError – If there is no previous version to roll back to.
NotFoundError – If the package is not installed.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> result = await client.fleet_epm.rollback_package(pkg_name="tcp") >>> print(result.body["success"]) True
- async review_upgrade(*, pkg_name, action, target_version, space_id=None, validate_spaces=None)[source]¶
Review a pending policy upgrade for a package with deprecations.
POST /api/fleet/epm/packages/{pkgName}/review_upgradeRecords the review decision (accept/decline/pending) for a pending package policy upgrade that contains deprecated configuration.
- Parameters:
pkg_name (str) – Name of the package with a pending upgrade review.
action (str) – Review decision:
"accept","decline"or"pending".target_version (str) – The package version the pending upgrade targets.
space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse describing the review result.
- Raises:
NotFoundError – If there is no pending upgrade review for the package/version (message:
"No pending upgrade review for <pkg>@<version>").BadRequestError – If the body is invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> await client.fleet_epm.review_upgrade( ... pkg_name="tcp", action="accept", target_version="2.3.1" ... )
- async bulk_install_packages(*, packages, force=None, prerelease=None, space_id=None, validate_spaces=None)[source]¶
Bulk install packages.
POST /api/fleet/epm/packages/_bulkInstalls multiple packages from the Elastic Package Registry in one request. Unlike the other bulk package operations this endpoint is synchronous: the result for every package is in the response.
- Parameters:
packages (list[str | dict[str, Any]]) – Packages to install. Each entry is either a package name string (latest version) or a dict with
nameandversion(and optionalprerelease).force (bool | None) – Force installation of the packages.
prerelease (bool | None) – Whether prerelease versions may be selected as latest versions.
space_id (str | None) – Optional space ID to install the packages in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with an
itemsarray holding a success or error result per package.- Raises:
BadRequestError – If the body is invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> result = await client.fleet_epm.bulk_install_packages( ... packages=["tcp", {"name": "udp", "version": "2.5.1"}] ... ) >>> print([i["name"] for i in result.body["items"]]) ['tcp', 'udp']
- async bulk_upgrade_packages(*, packages, force=None, prerelease=None, upgrade_package_policies=None, space_id=None, validate_spaces=None)[source]¶
Bulk upgrade packages.
POST /api/fleet/epm/packages/_bulk_upgradeStarts an asynchronous bulk upgrade of installed packages. The response contains a
taskId; pollget_bulk_upgrade_status()for progress and results.- Parameters:
packages (list[str | dict[str, Any]]) – Packages to upgrade. Each entry is either a package name string or a dict with
nameand optionalversion(defaults to the latest available version).force (bool | None) – Force the upgrades.
prerelease (bool | None) – Whether prerelease versions may be upgrade targets.
upgrade_package_policies (bool | None) – Also upgrade the packages’ package policies.
space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with the
taskIdof the upgrade task.- Raises:
BadRequestError – If the body is invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> started = await client.fleet_epm.bulk_upgrade_packages(packages=["tcp"]) >>> task_id = started.body["taskId"]
- async get_bulk_upgrade_status(*, task_id, space_id=None, validate_spaces=None)[source]¶
Get bulk upgrade packages details.
GET /api/fleet/epm/packages/_bulk_upgrade/{taskId}Retrieves the status of an asynchronous bulk upgrade started with
bulk_upgrade_packages().- Parameters:
- Returns:
ObjectApiResponse with
status("pending","success"or"failed"), per-packageresultswhen finished, and anerrorobject on failure.- Raises:
NotFoundError – If no bulk upgrade task exists for the ID.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> status = await client.fleet_epm.get_bulk_upgrade_status(task_id=task_id) >>> print(status.body["status"]) success
- async bulk_uninstall_packages(*, packages, force=None, space_id=None, validate_spaces=None)[source]¶
Bulk uninstall packages.
POST /api/fleet/epm/packages/_bulk_uninstallStarts an asynchronous bulk uninstall of installed packages. The response contains a
taskId; pollget_bulk_uninstall_status()for progress and results.- Parameters:
packages (list[dict[str, Any]]) – Packages to uninstall. Each entry is a dict with
nameandversion(both required by the API).force (bool | None) – Force the uninstalls even if packages are in use.
space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with the
taskIdof the uninstall task.- Raises:
BadRequestError – If the body is invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> started = await client.fleet_epm.bulk_uninstall_packages( ... packages=[{"name": "tcp", "version": "2.3.1"}] ... ) >>> task_id = started.body["taskId"]
- async get_bulk_uninstall_status(*, task_id, space_id=None, validate_spaces=None)[source]¶
Get bulk uninstall packages details.
GET /api/fleet/epm/packages/_bulk_uninstall/{taskId}Retrieves the status of an asynchronous bulk uninstall started with
bulk_uninstall_packages().- Parameters:
- Returns:
ObjectApiResponse with
status("pending","success"or"failed"), per-packageresultswhen finished, and anerrorobject on failure.- Raises:
NotFoundError – If no bulk uninstall task exists for the ID.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> status = await client.fleet_epm.get_bulk_uninstall_status(task_id=task_id) >>> print(status.body["status"]) success
- async bulk_rollback_packages(*, packages, space_id=None, validate_spaces=None)[source]¶
Bulk rollback packages.
POST /api/fleet/epm/packages/_bulk_rollbackStarts an asynchronous bulk rollback of upgraded packages to their previous versions. The response contains a
taskId; pollget_bulk_rollback_status()for progress and results.- Parameters:
- Returns:
ObjectApiResponse with the
taskIdof the rollback task.- Raises:
BadRequestError – If the body is invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> started = await client.fleet_epm.bulk_rollback_packages(packages=["tcp"]) >>> task_id = started.body["taskId"]
- async get_bulk_rollback_status(*, task_id, space_id=None, validate_spaces=None)[source]¶
Get bulk rollback packages details.
GET /api/fleet/epm/packages/_bulk_rollback/{taskId}Retrieves the status of an asynchronous bulk rollback started with
bulk_rollback_packages().- Parameters:
- Returns:
ObjectApiResponse with
status("pending","success"or"failed"), per-packageresultswhen finished, and anerrorobject on failure.- Raises:
NotFoundError – If no bulk rollback task exists for the ID.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> status = await client.fleet_epm.get_bulk_rollback_status(task_id=task_id) >>> print(status.body["status"]) success
- async bulk_get_assets(*, asset_ids, space_id=None, validate_spaces=None)[source]¶
Bulk get assets.
POST /api/fleet/epm/bulk_assetsRetrieves details (including app links) for a set of package assets by ID and type, e.g. the assets listed in an install response.
- Parameters:
asset_ids (list[dict[str, Any]]) – Assets to fetch. Each entry is a dict with
idandtype(e.g.{"id": "logs-tcp.generic", "type": "index_template"}).space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with an
itemsarray of asset details (id,type,attributes,appLink).- Raises:
BadRequestError – If the body is invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> assets = await client.fleet_epm.bulk_get_assets( ... asset_ids=[{"id": "logs-tcp.generic", "type": "index_template"}] ... ) >>> print(assets.body["items"][0]["appLink"]) /app/management/data/index_management/templates/logs-tcp.generic
- async install_kibana_assets(*, pkg_name, pkg_version, force=None, space_ids=None, space_id=None, validate_spaces=None)[source]¶
Install Kibana assets for a package.
POST /api/fleet/epm/packages/{pkgName}/{pkgVersion}/kibana_assets(Re-)installs the Kibana assets (dashboards, visualizations, …) of an installed package, optionally into additional spaces.
- Parameters:
pkg_name (str) – Name of the installed package.
pkg_version (str) – Version of the installed package.
force (bool | None) – Force the asset installation.
space_ids (list[str] | None) – When provided, assets are installed in the specified spaces instead of the current space.
space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with
success: trueon success.- Raises:
BadRequestError – If the package is not installed.
NotFoundError – If the package does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> result = await client.fleet_epm.install_kibana_assets( ... pkg_name="tcp", pkg_version="2.3.1" ... ) >>> print(result.body["success"]) True
- async delete_kibana_assets(*, pkg_name, pkg_version, space_id=None, validate_spaces=None)[source]¶
Delete Kibana assets for a package.
DELETE /api/fleet/epm/packages/{pkgName}/{pkgVersion}/kibana_assetsRemoves the Kibana assets a package installed into the current space. Note: Kibana rejects deleting the assets from the space where the package itself was installed — uninstall the package instead.
- Parameters:
- Returns:
ObjectApiResponse with
success: trueon success.- Raises:
BadRequestError – If called in the space where the package was installed (message:
"Impossible to delete kibana assets from the space where the package was installed, you must uninstall the package.").NotFoundError – If the package does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> await client.fleet_epm.delete_kibana_assets( ... pkg_name="tcp", pkg_version="2.3.1", space_id="other-space" ... )
- async install_rule_assets(*, pkg_name, pkg_version, force=None, space_id=None, validate_spaces=None)[source]¶
Install Kibana alert rules for a package.
POST /api/fleet/epm/packages/{pkgName}/{pkgVersion}/rule_assetsInstalls the alerting rule assets shipped by an installed package.
- Parameters:
pkg_name (str) – Name of the installed package.
pkg_version (str) – Version of the installed package.
force (bool | None) – Force the rule asset installation.
space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with
success: trueon success.- Raises:
BadRequestError – If the package is not installed.
NotFoundError – If the package does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> result = await client.fleet_epm.install_rule_assets( ... pkg_name="tcp", pkg_version="2.3.1" ... ) >>> print(result.body["success"]) True
- async delete_datastream_assets(*, pkg_name, pkg_version, package_policy_id, space_id=None, validate_spaces=None)[source]¶
Delete assets for an input package.
DELETE /api/fleet/epm/packages/{pkgName}/{pkgVersion}/datastream_assetsDeletes the data-stream assets an input package created for a specific package policy.
- Parameters:
pkg_name (str) – Name of the installed input package.
pkg_version (str) – Version of the installed input package.
package_policy_id (str) – ID of the package policy whose data-stream assets should be deleted.
space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with
success: trueon success.- Raises:
NotFoundError – If the package policy does not exist (message:
"Package policy with id <id> not found").BadRequestError – If the package is not an installed input package.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> await client.fleet_epm.delete_datastream_assets( ... pkg_name="tcp", pkg_version="2.3.1", ... package_policy_id="d5b1e4b0-...", ... )
- async authorize_transforms(*, pkg_name, pkg_version, transforms, prerelease=None, space_id=None, validate_spaces=None)[source]¶
Authorize transforms.
POST /api/fleet/epm/packages/{pkgName}/{pkgVersion}/transforms/authorizeRe-authorizes the Elasticsearch transforms installed by a package so they run with the current user’s permissions.
- Parameters:
pkg_name (str) – Name of the installed package.
pkg_version (str) – Version of the installed package.
transforms (list[str | dict[str, Any]]) – Transforms to authorize. Each entry is either a transform ID string or a dict with
transformId.prerelease (bool | None) – Whether prerelease package versions are considered.
space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ApiResponse whose body is a list with one result per transform (
transformId,success, optionalerror).- Raises:
BadRequestError – If the body is invalid.
NotFoundError – If the package does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> result = await client.fleet_epm.authorize_transforms( ... pkg_name="ti_util", pkg_version="1.1.0", ... transforms=["logs-ti_util.latest_ioc-default-1.1.0"], ... )
- async create_custom_integration(*, integration_name, datasets, force=None, space_id=None, validate_spaces=None)[source]¶
Create a custom integration.
POST /api/fleet/epm/custom_integrationsCreates and installs a custom integration package with the given datasets (index templates, ingest pipelines and component templates are generated automatically).
- Parameters:
integration_name (str) – Name of the custom integration package.
datasets (list[dict[str, Any]]) – Datasets the integration ships. Each entry is a dict with
nameandtype(one of"logs","metrics","traces","synthetics","profiling"). Maximum of 10 datasets.force (bool | None) – Force creation even if the integration already exists.
space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with an
itemsarray of created assets and a_metaobject withinstall_source: "custom".- Raises:
BadRequestError – If the body is invalid.
ConflictError – If the integration already exists and
forceis not set.AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> created = await client.fleet_epm.create_custom_integration( ... integration_name="my_custom_app", ... datasets=[{"name": "my_custom_app.access", "type": "logs"}], ... ) >>> print(created.body["_meta"]["install_source"]) custom
- async update_custom_integration(*, pkg_name, read_me_data, categories=None, space_id=None, validate_spaces=None)[source]¶
Update a custom integration.
PUT /api/fleet/epm/custom_integrations/{pkgName}Updates a previously created custom integration (its README and categories), bumping the integration’s patch version.
- Parameters:
pkg_name (str) – Name of the custom integration package.
read_me_data (str) – README (Markdown) content for the integration. Required by the API.
categories (list[str] | None) – Categories to assign to the integration.
space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with the integration
idand aresultobject containing the newversionandstatus.- Raises:
BadRequestError – If
read_me_datais missing or the body is otherwise invalid.NotFoundError – If the custom integration does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> updated = await client.fleet_epm.update_custom_integration( ... pkg_name="my_custom_app", ... read_me_data="# My custom app", ... categories=["custom"], ... ) >>> print(updated.body["result"]["version"]) 1.0.1
- async get_data_streams(*, space_id=None, validate_spaces=None)[source]¶
Get Fleet data streams.
GET /api/fleet/data_streamsLists the data streams created by Fleet-managed integrations, including their size, last-activity timestamp and associated dashboards.
- Parameters:
- Returns:
ObjectApiResponse with a
data_streamsarray (each entry hasindex,dataset,namespace,type,package,size_in_bytes,dashboards, …).- Raises:
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> streams = await client.fleet_epm.get_data_streams() >>> print(type(streams.body["data_streams"])) <class 'list'>
- async find_data_streams(*, type=None, dataset_query=None, sort_order=None, uncategorised_only=None, space_id=None, validate_spaces=None)[source]¶
Find EPM data streams.
GET /api/fleet/epm/data_streamsLists existing data-stream names known to the Elastic Package Manager, filtered by type and dataset query (used e.g. when creating custom integrations).
- Parameters:
type (str | None) – Only include data streams of this type. One of
"logs","metrics","traces","synthetics"or"profiling".dataset_query (str | None) – Filter data streams by dataset name substring.
sort_order (str | None) – Sort order for the results:
"asc"or"desc".uncategorised_only (bool | None) – Only include data streams that do not belong to any installed package.
space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse with an
itemsarray of data streams (each with aname).- Raises:
BadRequestError – If the query parameters are invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> streams = await client.fleet_epm.find_data_streams(type="logs") >>> print(streams.body["items"][0]["name"]) logs-elastic_agent-default
- async get_inputs_template(*, pkg_name, pkg_version, format=None, prerelease=None, ignore_unverified=None, space_id=None, validate_spaces=None)[source]¶
Get an inputs template.
GET /api/fleet/epm/templates/{pkgName}/{pkgVersion}/inputsRetrieves the agent inputs template of a package, as JSON or YAML — useful for standalone-agent configuration.
- Parameters:
pkg_name (str) – Name of the package.
pkg_version (str) – Version of the package.
format (str | None) – Response format:
"json","yml"or"yaml". Defaults to YAML on the server.prerelease (bool | None) – Whether prerelease package versions are considered.
ignore_unverified (bool | None) – Whether to use the package even if its signature cannot be verified.
space_id (str | None) – Optional space ID to run the operation in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ApiResponse whose body is an object with an
inputsarray forformat="json", or the raw YAML string otherwise.- Raises:
NotFoundError – If the package does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> template = await client.fleet_epm.get_inputs_template( ... pkg_name="tcp", pkg_version="2.3.1", format="json" ... ) >>> print(template.body["inputs"][0]["type"]) tcp