CasesClient¶
Client for the Kibana Cases API.
Cases are used to open and track issues directly in Kibana. You can add assignees and tags to your cases, set their severity and status, and add alerts, comments, and visualizations. You can also send cases to external incident management systems by configuring connectors.
Cases are space-scoped: every method accepts an optional space_id to
target a specific space (None targets the default space or the space the
client is scoped to).
- class kibana._sync.client.cases.CasesClient(client, default_space_id=None, validate_spaces=True)[source]¶
Bases:
NamespaceClientClient for the Kibana Cases API.
Cases are used to open and track issues directly in Kibana. You can add assignees and tags to your cases, set their severity and status, and add alerts, comments, and visualizations. You can also send cases to external incident management systems by configuring connectors.
Cases are space-scoped: 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="...") >>> >>> # Create a case, comment on it, then close and delete it >>> case = client.cases.create( ... title="Suspicious login activity", ... description="Multiple failed logins detected.", ... tags=["security"], ... ) >>> case_id = case.body["id"] >>> client.cases.add_comment( ... case_id=case_id, comment="Investigating.", owner="cases" ... ) >>> updated = client.cases.update( ... id=case_id, version=case.body["version"], status="closed" ... ) >>> client.cases.delete(ids=[case_id])
Creating and Updating Cases
Create a case, comment on it, then close it:
from kibana import Kibana client = Kibana("http://localhost:5601", api_key="your_api_key") # Create a case case = client.cases.create( title="Suspicious login activity", description="Multiple failed logins detected.", tags=["security"], ) case_id = case.body["id"] # Add a comment client.cases.add_comment( case_id=case_id, comment="Investigating.", owner="cases" ) # Close the case (updates are versioned) updated = client.cases.update( id=case_id, version=case.body["version"], status="closed" )
Finding Cases
Search cases with
find(). The response contains the page ofcasesplus per-status counts:results = client.cases.find(tags=["security"]) print(f"Open cases: {results.body['count_open_cases']}") for case in results.body["cases"]: print(case["id"], case["title"], case["status"])
Comments and User Actions
# List comments on a case comments = client.cases.get_comments(case_id=case_id) # Retrieve the full activity (user actions) of a case actions = client.cases.find_user_actions(case_id=case_id)
External Incident Management Systems
Cases can be pushed to external systems (Jira, ServiceNow, …) through connectors:
# List connectors available for cases connectors = client.cases.find_connectors() # Configure the default connector and settings for an owner config = client.cases.create_configuration( owner="cases", connector={ "id": "jira-connector-id", "name": "Jira", "type": ".jira", "fields": None, }, closure_type="close-by-user", ) # Push a case to the configured external system client.cases.push(case_id=case_id, connector_id="jira-connector-id")
Alerts Attached to Cases
# Get all alerts attached to a case alerts = client.cases.get_alerts(case_id=case_id) # Find the cases an alert is attached to cases = client.cases.get_cases_by_alert(alert_id="alert-id")
Deleting Cases
# Delete one or more cases by ID client.cases.delete(ids=[case_id])
- __init__(client, default_space_id=None, validate_spaces=True)[source]¶
Initialize the CasesClient.
- Parameters:
Example
>>> cases_client = CasesClient(kibana_client)
- create(*, title, description, owner='cases', tags=None, connector=None, settings=None, assignees=None, category=None, custom_fields=None, severity=None, space_id=None, validate_spaces=None)[source]¶
Create a case.
You must have
allprivileges for the Cases feature in the Management, Observability, or Security section of the Kibana feature privileges, depending on the owner of the case you’re creating.- Parameters:
title (str) – A title for the case (maximum 160 characters).
description (str) – The description for the case.
owner (str) – The application that owns the case:
"cases"(Stack Management, the default),"observability", or"securitySolution".tags (list[str] | None) – Words and phrases that help categorize cases. Defaults to an empty list (the API requires the field to be present).
connector (dict[str, Any] | None) – An object that contains the connector configuration (
id,name,type,fields). Defaults to the “none” connector when omitted.settings (dict[str, Any] | None) – An object that contains the case settings, e.g.
{"syncAlerts": True}. Defaults to{"syncAlerts": False}when omitted (the API requires the field to be present).assignees (list[dict[str, Any]] | None) – A list of users assigned to the case, each an object with a
uid(user profile unique identifier). Requires a Platinum or Enterprise license.category (str | None) – A word or phrase that categorizes the case (maximum 50 characters).
custom_fields (list[dict[str, Any]] | None) – Custom field values for the case, each an object with
key,typeandvalue. Any optional custom fields not specified are set to null.severity (str | None) – The severity of the case:
"critical","high","low"(server default), or"medium".space_id (str | None) – Optional space ID to create the case in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the created case, including its
id,version,status,created_at/created_bymetadata, and the fields supplied on creation.- Raises:
BadRequestError – If the request 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
>>> case = client.cases.create( ... title="Suspicious login activity", ... description="Multiple failed logins detected.", ... tags=["security", "auth"], ... severity="high", ... ) >>> print(case.body["status"]) open
- get(*, case_id, space_id=None, validate_spaces=None)[source]¶
Get case information.
Returns details about a case, including its comments and alerts.
- Parameters:
- Returns:
ObjectApiResponse containing the case, including
comments,totalComment,totalAlertsand the case fields.- Raises:
NotFoundError – If the case 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
>>> case = client.cases.get(case_id="a18b38a0-...-aad599a8564f") >>> print(case.body["title"])
- update(*, id=None, version=None, assignees=None, category=None, close_reason=None, connector=None, custom_fields=None, description=None, settings=None, severity=None, status=None, tags=None, title=None, cases=None, space_id=None, validate_spaces=None)[source]¶
Update one or more cases.
The Cases update API is a bulk endpoint (
PATCH /api/caseswith a{"cases": [...]}body). This method offers a single-case-friendly signature: passidandversionplus the fields to change, or passcaseswith a list of case-update objects to update several cases at once.- Parameters:
id (str | None) – The identifier of the case to update (single-case form).
version (str | None) – The current version of the case, as returned by
get()orfind()(single-case form; used for optimistic concurrency control).assignees (list[dict[str, Any]] | None) – A list of users assigned to the case, each an object with a
uid.category (str | None) – A word or phrase that categorizes the case.
close_reason (str | None) – The reason the case was closed (sent as
closeReason).connector (dict[str, Any] | None) – An object that contains the connector configuration.
custom_fields (list[dict[str, Any]] | None) – Custom field values (sent as
customFields).description (str | None) – An updated description for the case.
settings (dict[str, Any] | None) – An object that contains the case settings, e.g.
{"syncAlerts": False}.severity (str | None) – The severity of the case:
"critical","high","low", or"medium".status (str | None) – The status of the case:
"open","in-progress", or"closed".title (str | None) – An updated title for the case.
cases (list[dict[str, Any]] | None) – Bulk form — a list of case-update objects, each with
id,versionand the fields to change (raw API field names, e.g.customFields). Mutually exclusive withid/versionand the per-field arguments.space_id (str | None) – Optional space ID the cases live in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse whose body is a list of the updated cases.
- Raises:
ValueError – If neither
casesnor bothidandversionare provided, or if both forms are mixed.BadRequestError – If the request body is invalid.
ConflictError – If the version doesn’t match the current case version.
NotFoundError – If a case 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
>>> case = client.cases.get(case_id="a18b38a0-...") >>> updated = client.cases.update( ... id=case.body["id"], ... version=case.body["version"], ... status="closed", ... ) >>> print(updated.body[0]["status"]) closed
- delete(*, ids, space_id=None, validate_spaces=None)[source]¶
Delete one or more cases.
You must have
allprivileges for the Cases feature in the Management, Observability, or Security section of the Kibana feature privileges, depending on the owner of the cases you’re deleting.Note: the live API requires the
idsquery parameter to be a JSON-array string (e.g.ids=["id1","id2"]); this method encodes it for you.- Parameters:
- Returns:
ObjectApiResponse with an empty body on success (HTTP 204).
- Raises:
NotFoundError – If a case 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.cases.delete(ids=["a18b38a0-...-aad599a8564f"])
- find(*, assignees=None, category=None, default_search_operator=None, from_=None, owner=None, page=None, per_page=None, reporters=None, search=None, search_fields=None, severity=None, sort_field=None, sort_order=None, status=None, tags=None, to=None, space_id=None, validate_spaces=None)[source]¶
Search cases.
Retrieves a paginated subset of cases. By default the response includes the first page with 20 cases per page.
- Parameters:
assignees (str | list[str] | None) – Filter cases by assignee user profile
uid. To filter for cases without assignees, use"none".category (str | list[str] | None) – Filter cases by category.
default_search_operator (str | None) – Operator (
"AND"or"OR", server default"OR") used to combine the search acrosssearch_fields.from – Return cases created on or after this date/time (sent as the
fromquery parameter; accepts date math like"now-1d").owner (str | list[str] | None) – Filter by case owner application:
"cases","observability", or"securitySolution". Defaults to all owners the user has access to.page (int | None) – The page number to return (server default 1).
per_page (int | None) – The number of cases per page (server default 20, maximum 100).
reporters (str | list[str] | None) – Filter cases by the usernames of their reporters.
search (str | None) – A simple query string to filter cases.
search_fields (str | list[str] | None) – The fields to perform the
searchagainst (e.g."title","description").severity (str | None) – Filter by severity:
"critical","high","low", or"medium".sort_field (str | None) – Field to sort results by:
"createdAt"(server default),"updatedAt","closedAt","title","category","status", or"severity".sort_order (str | None) – Sort order:
"asc"or"desc"(server default).status (str | None) – Filter by case status:
"open","in-progress", or"closed".to (str | None) – Return cases created on or before this date/time.
space_id (str | None) – Optional space ID to search cases in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing
cases(the page of results),total,page,per_pageand per-status counts (count_open_cases,count_in_progress_cases,count_closed_cases).- Raises:
BadRequestError – If a filter value is invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> found = client.cases.find(tags="security", status="open") >>> print(found.body["total"])
- get_alerts(*, case_id, space_id=None, validate_spaces=None)[source]¶
Get all alerts attached to a case.
Technical preview in 9.4; this functionality may be changed or removed in a future release.
- Parameters:
- Returns:
ObjectApiResponse whose body is a list of alerts, each with
id,indexandattached_at.- Raises:
NotFoundError – If the case 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
>>> alerts = client.cases.get_alerts(case_id="a18b38a0-...") >>> for alert in alerts.body: ... print(alert["id"], alert["index"])
- get_cases_by_alert(*, alert_id, owner=None, space_id=None, validate_spaces=None)[source]¶
Get the cases an alert is attached to.
Technical preview in 9.4; this functionality may be changed or removed in a future release.
- Parameters:
alert_id (str) – The identifier for the alert.
owner (str | list[str] | None) – Filter by case owner application:
"cases","observability", or"securitySolution".space_id (str | None) – Optional space ID to search in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse whose body is a list of objects with the case
idandtitlefor each case the alert is attached to.- Raises:
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> cases = client.cases.get_cases_by_alert(alert_id="09f0c261...") >>> for case in cases.body: ... print(case["id"], case["title"])
- add_comment(*, case_id, type='user', owner='cases', comment=None, alert_id=None, index=None, rule=None, space_id=None, validate_spaces=None)[source]¶
Add a comment or alert to a case.
- Parameters:
case_id (str) – The identifier for the case.
type (str) – The attachment type:
"user"(a text comment, the default) or"alert".owner (str) – The application that owns the case:
"cases"(default),"observability", or"securitySolution".comment (str | None) – The comment text (required when
type="user"; maximum 30,000 characters).alert_id (str | list[str] | None) – The alert identifier(s) (required when
type="alert").index (str | list[str] | None) – The alert index(es); the order must match
alert_id(required whentype="alert").rule (dict[str, Any] | None) – The rule that is associated with the alerts (an object with
idandname; required whentype="alert").space_id (str | None) – Optional space ID the case lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the updated case, including the new attachment in
comments.- Raises:
BadRequestError – If the attachment body is invalid.
NotFoundError – If the case 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.cases.add_comment( ... case_id="a18b38a0-...", ... comment="Investigating the failed logins.", ... ) >>> print(updated.body["totalComment"]) 1
- update_comment(*, case_id, id, version, type='user', owner='cases', comment=None, alert_id=None, index=None, rule=None, space_id=None, validate_spaces=None)[source]¶
Update a comment or alert attached to a case.
- Parameters:
case_id (str) – The identifier for the case.
id (str) – The identifier of the comment being updated.
version (str) – The current version of the comment, as returned by
get_comment()orget_comments()(used for optimistic concurrency control).type (str) – The attachment type:
"user"(default) or"alert".owner (str) – The application that owns the case:
"cases"(default),"observability", or"securitySolution".comment (str | None) – The updated comment text (required when
type="user").alert_id (str | list[str] | None) – The alert identifier(s) (required when
type="alert").index (str | list[str] | None) – The alert index(es) (required when
type="alert").rule (dict[str, Any] | None) – The rule associated with the alerts (required when
type="alert").space_id (str | None) – Optional space ID the case lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the updated case, including the modified attachment in
comments.- Raises:
BadRequestError – If the attachment body is invalid.
ConflictError – If the version doesn’t match the current comment version.
NotFoundError – If the case or comment 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.cases.update_comment( ... case_id="a18b38a0-...", ... id="8af6ac20-...", ... version="Wzk1LDFd", ... comment="Root cause identified.", ... )
- get_comment(*, case_id, comment_id, space_id=None, validate_spaces=None)[source]¶
Get a case comment or alert.
- Parameters:
- Returns:
ObjectApiResponse containing the attachment (
id,version,type,commentor alert fields, and audit metadata).- Raises:
NotFoundError – If the case or comment 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
>>> comment = client.cases.get_comment( ... case_id="a18b38a0-...", comment_id="8af6ac20-..." ... ) >>> print(comment.body["comment"])
- get_comments(*, case_id, page=None, per_page=None, sort_order=None, space_id=None, validate_spaces=None)[source]¶
Find comments and alerts attached to a case.
Retrieves a paginated list of case attachments via the
GET /api/cases/{caseId}/comments/_findendpoint.- Parameters:
case_id (str) – The identifier for the case.
page (int | None) – The page number to return (server default 1).
per_page (int | None) – The number of items per page (server default 20, maximum 100).
sort_order (str | None) – Sort order:
"asc"or"desc"(server default).space_id (str | None) – Optional space ID the case lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing
comments(the page of attachments),total,pageandper_page.- Raises:
NotFoundError – If the case 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
>>> comments = client.cases.get_comments( ... case_id="a18b38a0-...", per_page=10 ... ) >>> print(comments.body["total"])
- delete_comment(*, case_id, comment_id, space_id=None, validate_spaces=None)[source]¶
Delete a comment or alert from a case.
- Parameters:
- Returns:
ObjectApiResponse with an empty body on success (HTTP 204).
- Raises:
NotFoundError – If the case or comment 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.cases.delete_comment( ... case_id="a18b38a0-...", comment_id="8af6ac20-..." ... )
- delete_all_comments(*, case_id, space_id=None, validate_spaces=None)[source]¶
Delete all comments and alerts from a case.
- Parameters:
- Returns:
ObjectApiResponse with an empty body on success (HTTP 204).
- Raises:
NotFoundError – If the case 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.cases.delete_all_comments(case_id="a18b38a0-...")
- find_user_actions(*, case_id, page=None, per_page=None, sort_order=None, types=None, space_id=None, validate_spaces=None)[source]¶
Find case activity (user actions).
Retrieves a paginated list of user activity for a case, such as status changes, comments, tag updates and connector changes.
- Parameters:
case_id (str) – The identifier for the case.
page (int | None) – The page number to return (server default 1).
per_page (int | None) – The number of items per page (server default 20, maximum 100).
sort_order (str | None) – Sort order:
"asc"or"desc"(server default).types (list[str] | None) – Filter activity by type. Valid values include
"action","alert","assignees","attachment","comment","connector","create_case","description","pushed","settings","severity","status","tags","title"and"user".space_id (str | None) – Optional space ID the case lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing
userActions(the page of activity records),total,pageandperPage.- Raises:
NotFoundError – If the case 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
>>> activity = client.cases.find_user_actions( ... case_id="a18b38a0-...", types=["status"] ... ) >>> for action in activity.body["userActions"]: ... print(action["action"], action["type"])
- push(*, case_id, connector_id, space_id=None, validate_spaces=None)[source]¶
Push a case to an external service.
Sends the case to the external incident management system configured for the given connector (for example Jira, ServiceNow, or IBM Resilient).
- Parameters:
case_id (str) – The identifier for the case.
connector_id (str) – The identifier for the connector. To retrieve connector IDs, use
find_connectors().space_id (str | None) – Optional space ID the case lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the case, including the
external_servicepush details.- Raises:
NotFoundError – If the case or connector does not exist.
BadRequestError – If the connector is not usable for pushing.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> pushed = client.cases.push( ... case_id="a18b38a0-...", ... connector_id="0c3b3bc0-...", ... ) >>> print(pushed.body["external_service"]["external_url"])
- add_file(*, case_id, file, filename, mime_type='text/plain', space_id=None, validate_spaces=None)[source]¶
Attach a file to a case.
The file is uploaded as
multipart/form-data. Note that the server restricts the allowed MIME types (images, text, CSV, JSON, PDF, and Office/zip documents by default) and the maximum file size (100 MiB by default, 10 MiB for images).- Parameters:
case_id (str) – The identifier for the case.
filename (str) – The desired name of the file (also sent as the
filenameform field).mime_type (str) – The MIME type of the file (default
"text/plain").space_id (str | None) – Optional space ID the case lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the updated case; the file appears as an attachment in
comments.- Raises:
BadRequestError – If the file type or size is not allowed.
NotFoundError – If the case 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.cases.add_file( ... case_id="a18b38a0-...", ... file=b"investigation notes", ... filename="notes.txt", ... )
- get_configuration(*, owner=None, space_id=None, validate_spaces=None)[source]¶
Get case settings (configuration).
Retrieves the case configurations, which include the closure type, default connector, custom fields and templates. There is one configuration per case owner application.
- Parameters:
owner (str | list[str] | None) – Filter by case owner application:
"cases","observability", or"securitySolution". Defaults to all owners the user has access to.space_id (str | None) – Optional space ID to read the configuration from.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse whose body is a list of configuration objects (
id,version,owner,closure_type,connector,customFields,templates, …).- Raises:
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> configs = client.cases.get_configuration(owner="cases") >>> for config in configs.body: ... print(config["id"], config["closure_type"])
- create_configuration(*, closure_type, connector=None, owner='cases', custom_fields=None, templates=None, space_id=None, validate_spaces=None)[source]¶
Add case settings (configuration).
Case settings include external connection details, custom fields and templates. Connectors are used to interface with external systems. You must create a connector before you can use it in your cases. If you set a default connector, it is automatically selected when you create cases in Kibana. If you use the create configuration API for an owner that already has a configuration, it is replaced.
- Parameters:
closure_type (str) – Whether a case is closed when it is pushed to an external system:
"close-by-pushing"or"close-by-user".connector (dict[str, Any] | None) – An object that contains the default connector configuration (
id,name,type,fields). Defaults to the “none” connector when omitted.owner (str) – The application that owns the configuration:
"cases"(default),"observability", or"securitySolution".custom_fields (list[dict[str, Any]] | None) – Custom field definitions, each an object with
key,label,typeandrequired.templates (list[dict[str, Any]] | None) – Case templates (technical preview in 9.4).
space_id (str | None) – Optional space ID to store the configuration in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the created configuration, including its
idandversion.- Raises:
BadRequestError – If the configuration 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
>>> config = client.cases.create_configuration( ... closure_type="close-by-user", ... owner="cases", ... ) >>> print(config.body["id"])
- update_configuration(*, configuration_id, version, closure_type=None, connector=None, custom_fields=None, templates=None, space_id=None, validate_spaces=None)[source]¶
Update case settings (configuration).
Updates external connection details, custom fields and templates for a case configuration. Connectors are used to interface with external systems.
- Parameters:
configuration_id (str) – The identifier for the configuration. To retrieve configuration IDs, use
get_configuration().version (str) – The current version of the configuration, as returned by
get_configuration()(used for optimistic concurrency control).closure_type (str | None) – Whether a case is closed when it is pushed to an external system:
"close-by-pushing"or"close-by-user".connector (dict[str, Any] | None) – An object that contains the default connector configuration.
custom_fields (list[dict[str, Any]] | None) – Custom field definitions.
templates (list[dict[str, Any]] | None) – Case templates (technical preview in 9.4).
space_id (str | None) – Optional space ID the configuration lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the updated configuration, with its new
version.- Raises:
BadRequestError – If the configuration body is invalid.
ConflictError – If the version doesn’t match the current configuration version.
NotFoundError – If the configuration 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.cases.update_configuration( ... configuration_id="3297a0f0-...", ... version="WzIwMiwxXQ==", ... closure_type="close-by-pushing", ... )
- find_connectors(*, space_id=None, validate_spaces=None)[source]¶
Get case connectors.
Retrieves information about the connectors that are supported for use in cases (Jira, ServiceNow, Swimlane, IBM Resilient, and Cases Webhook types).
- Parameters:
- Returns:
ObjectApiResponse whose body is a list of connectors usable in cases.
- Raises:
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> connectors = client.cases.find_connectors() >>> for connector in connectors.body: ... print(connector["id"], connector["actionTypeId"])
- get_reporters(*, owner=None, space_id=None, validate_spaces=None)[source]¶
Get case creators (reporters).
Returns information about the users who opened cases.
- Parameters:
owner (str | list[str] | None) – Filter by case owner application:
"cases","observability", or"securitySolution". Defaults to all owners the user has access to.space_id (str | None) – Optional space ID to search in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse whose body is a list of reporters, each with
username,full_name,emailandprofile_uid.- Raises:
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> reporters = client.cases.get_reporters(owner="cases") >>> for reporter in reporters.body: ... print(reporter["username"])
- get_tags(*, owner=None, space_id=None, validate_spaces=None)[source]¶
Get case tags.
Aggregates and returns a list of all unique tags used in cases.
- Parameters:
owner (str | list[str] | None) – Filter by case owner application:
"cases","observability", or"securitySolution". Defaults to all owners the user has access to.space_id (str | None) – Optional space ID to search in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse whose body is a list of tag strings.
- Raises:
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> tags = client.cases.get_tags() >>> print(tags.body) ['security', 'auth']
AsyncCasesClient¶
Asynchronous version of the CasesClient for use with async/await syntax.
- class kibana._async.client.cases.AsyncCasesClient(client, default_space_id=None, validate_spaces=True)[source]¶
Bases:
AsyncNamespaceClientAsync client for the Kibana Cases API.
Cases are used to open and track issues directly in Kibana. You can add assignees and tags to your cases, set their severity and status, and add alerts, comments, and visualizations. You can also send cases to external incident management systems by configuring connectors.
Cases are space-scoped: 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="...") >>> >>> # Create a case, comment on it, then close and delete it >>> case = await client.cases.create( ... title="Suspicious login activity", ... description="Multiple failed logins detected.", ... tags=["security"], ... ) >>> case_id = case.body["id"] >>> await client.cases.add_comment( ... case_id=case_id, comment="Investigating.", owner="cases" ... ) >>> updated = await client.cases.update( ... id=case_id, version=case.body["version"], status="closed" ... ) >>> await client.cases.delete(ids=[case_id])
Usage
The AsyncCasesClient provides the same methods as CasesClient 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 a case (async) case = await client.cases.create( title="Async case", description="Created with the async client.", ) # Comment and find (async) await client.cases.add_comment( case_id=case.body["id"], comment="Looking into it.", owner="cases", ) results = await client.cases.find(search="Async case") # Delete (async) await client.cases.delete(ids=[case.body["id"]]) asyncio.run(main())
- __init__(client, default_space_id=None, validate_spaces=True)[source]¶
Initialize the AsyncCasesClient.
- 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
>>> cases_client = AsyncCasesClient(kibana_client)
- async create(*, title, description, owner='cases', tags=None, connector=None, settings=None, assignees=None, category=None, custom_fields=None, severity=None, space_id=None, validate_spaces=None)[source]¶
Create a case.
You must have
allprivileges for the Cases feature in the Management, Observability, or Security section of the Kibana feature privileges, depending on the owner of the case you’re creating.- Parameters:
title (str) – A title for the case (maximum 160 characters).
description (str) – The description for the case.
owner (str) – The application that owns the case:
"cases"(Stack Management, the default),"observability", or"securitySolution".tags (list[str] | None) – Words and phrases that help categorize cases. Defaults to an empty list (the API requires the field to be present).
connector (dict[str, Any] | None) – An object that contains the connector configuration (
id,name,type,fields). Defaults to the “none” connector when omitted.settings (dict[str, Any] | None) – An object that contains the case settings, e.g.
{"syncAlerts": True}. Defaults to{"syncAlerts": False}when omitted (the API requires the field to be present).assignees (list[dict[str, Any]] | None) – A list of users assigned to the case, each an object with a
uid(user profile unique identifier). Requires a Platinum or Enterprise license.category (str | None) – A word or phrase that categorizes the case (maximum 50 characters).
custom_fields (list[dict[str, Any]] | None) – Custom field values for the case, each an object with
key,typeandvalue. Any optional custom fields not specified are set to null.severity (str | None) – The severity of the case:
"critical","high","low"(server default), or"medium".space_id (str | None) – Optional space ID to create the case in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the created case, including its
id,version,status,created_at/created_bymetadata, and the fields supplied on creation.- Raises:
BadRequestError – If the request 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
>>> case = await client.cases.create( ... title="Suspicious login activity", ... description="Multiple failed logins detected.", ... tags=["security", "auth"], ... severity="high", ... ) >>> print(case.body["status"]) open
- async get(*, case_id, space_id=None, validate_spaces=None)[source]¶
Get case information.
Returns details about a case, including its comments and alerts.
- Parameters:
- Returns:
ObjectApiResponse containing the case, including
comments,totalComment,totalAlertsand the case fields.- Raises:
NotFoundError – If the case 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
>>> case = await client.cases.get(case_id="a18b38a0-...") >>> print(case.body["title"])
- async update(*, id=None, version=None, assignees=None, category=None, close_reason=None, connector=None, custom_fields=None, description=None, settings=None, severity=None, status=None, tags=None, title=None, cases=None, space_id=None, validate_spaces=None)[source]¶
Update one or more cases.
The Cases update API is a bulk endpoint (
PATCH /api/caseswith a{"cases": [...]}body). This method offers a single-case-friendly signature: passidandversionplus the fields to change, or passcaseswith a list of case-update objects to update several cases at once.- Parameters:
id (str | None) – The identifier of the case to update (single-case form).
version (str | None) – The current version of the case, as returned by
get()orfind()(single-case form; used for optimistic concurrency control).assignees (list[dict[str, Any]] | None) – A list of users assigned to the case, each an object with a
uid.category (str | None) – A word or phrase that categorizes the case.
close_reason (str | None) – The reason the case was closed (sent as
closeReason).connector (dict[str, Any] | None) – An object that contains the connector configuration.
custom_fields (list[dict[str, Any]] | None) – Custom field values (sent as
customFields).description (str | None) – An updated description for the case.
settings (dict[str, Any] | None) – An object that contains the case settings, e.g.
{"syncAlerts": False}.severity (str | None) – The severity of the case:
"critical","high","low", or"medium".status (str | None) – The status of the case:
"open","in-progress", or"closed".title (str | None) – An updated title for the case.
cases (list[dict[str, Any]] | None) – Bulk form — a list of case-update objects, each with
id,versionand the fields to change (raw API field names, e.g.customFields). Mutually exclusive withid/versionand the per-field arguments.space_id (str | None) – Optional space ID the cases live in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse whose body is a list of the updated cases.
- Raises:
ValueError – If neither
casesnor bothidandversionare provided, or if both forms are mixed.BadRequestError – If the request body is invalid.
ConflictError – If the version doesn’t match the current case version.
NotFoundError – If a case 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
>>> case = await client.cases.get(case_id="a18b38a0-...") >>> updated = await client.cases.update( ... id=case.body["id"], ... version=case.body["version"], ... status="closed", ... ) >>> print(updated.body[0]["status"]) closed
- async delete(*, ids, space_id=None, validate_spaces=None)[source]¶
Delete one or more cases.
You must have
allprivileges for the Cases feature in the Management, Observability, or Security section of the Kibana feature privileges, depending on the owner of the cases you’re deleting.Note: the live API requires the
idsquery parameter to be a JSON-array string (e.g.ids=["id1","id2"]); this method encodes it for you.- Parameters:
- Returns:
ObjectApiResponse with an empty body on success (HTTP 204).
- Raises:
NotFoundError – If a case 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.cases.delete(ids=["a18b38a0-...-aad599a8564f"])
- async find(*, assignees=None, category=None, default_search_operator=None, from_=None, owner=None, page=None, per_page=None, reporters=None, search=None, search_fields=None, severity=None, sort_field=None, sort_order=None, status=None, tags=None, to=None, space_id=None, validate_spaces=None)[source]¶
Search cases.
Retrieves a paginated subset of cases. By default the response includes the first page with 20 cases per page.
- Parameters:
assignees (str | list[str] | None) – Filter cases by assignee user profile
uid. To filter for cases without assignees, use"none".category (str | list[str] | None) – Filter cases by category.
default_search_operator (str | None) – Operator (
"AND"or"OR", server default"OR") used to combine the search acrosssearch_fields.from – Return cases created on or after this date/time (sent as the
fromquery parameter; accepts date math like"now-1d").owner (str | list[str] | None) – Filter by case owner application:
"cases","observability", or"securitySolution". Defaults to all owners the user has access to.page (int | None) – The page number to return (server default 1).
per_page (int | None) – The number of cases per page (server default 20, maximum 100).
reporters (str | list[str] | None) – Filter cases by the usernames of their reporters.
search (str | None) – A simple query string to filter cases.
search_fields (str | list[str] | None) – The fields to perform the
searchagainst (e.g."title","description").severity (str | None) – Filter by severity:
"critical","high","low", or"medium".sort_field (str | None) – Field to sort results by:
"createdAt"(server default),"updatedAt","closedAt","title","category","status", or"severity".sort_order (str | None) – Sort order:
"asc"or"desc"(server default).status (str | None) – Filter by case status:
"open","in-progress", or"closed".to (str | None) – Return cases created on or before this date/time.
space_id (str | None) – Optional space ID to search cases in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing
cases(the page of results),total,page,per_pageand per-status counts (count_open_cases,count_in_progress_cases,count_closed_cases).- Raises:
BadRequestError – If a filter value is invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> found = await client.cases.find(tags="security", status="open") >>> print(found.body["total"])
- async get_alerts(*, case_id, space_id=None, validate_spaces=None)[source]¶
Get all alerts attached to a case.
Technical preview in 9.4; this functionality may be changed or removed in a future release.
- Parameters:
- Returns:
ObjectApiResponse whose body is a list of alerts, each with
id,indexandattached_at.- Raises:
NotFoundError – If the case 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
>>> alerts = await client.cases.get_alerts(case_id="a18b38a0-...") >>> for alert in alerts.body: ... print(alert["id"], alert["index"])
- async get_cases_by_alert(*, alert_id, owner=None, space_id=None, validate_spaces=None)[source]¶
Get the cases an alert is attached to.
Technical preview in 9.4; this functionality may be changed or removed in a future release.
- Parameters:
alert_id (str) – The identifier for the alert.
owner (str | list[str] | None) – Filter by case owner application:
"cases","observability", or"securitySolution".space_id (str | None) – Optional space ID to search in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse whose body is a list of objects with the case
idandtitlefor each case the alert is attached to.- Raises:
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> cases = await client.cases.get_cases_by_alert( ... alert_id="09f0c261..." ... ) >>> for case in cases.body: ... print(case["id"], case["title"])
- async add_comment(*, case_id, type='user', owner='cases', comment=None, alert_id=None, index=None, rule=None, space_id=None, validate_spaces=None)[source]¶
Add a comment or alert to a case.
- Parameters:
case_id (str) – The identifier for the case.
type (str) – The attachment type:
"user"(a text comment, the default) or"alert".owner (str) – The application that owns the case:
"cases"(default),"observability", or"securitySolution".comment (str | None) – The comment text (required when
type="user"; maximum 30,000 characters).alert_id (str | list[str] | None) – The alert identifier(s) (required when
type="alert").index (str | list[str] | None) – The alert index(es); the order must match
alert_id(required whentype="alert").rule (dict[str, Any] | None) – The rule that is associated with the alerts (an object with
idandname; required whentype="alert").space_id (str | None) – Optional space ID the case lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the updated case, including the new attachment in
comments.- Raises:
BadRequestError – If the attachment body is invalid.
NotFoundError – If the case 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.cases.add_comment( ... case_id="a18b38a0-...", ... comment="Investigating the failed logins.", ... ) >>> print(updated.body["totalComment"]) 1
- async update_comment(*, case_id, id, version, type='user', owner='cases', comment=None, alert_id=None, index=None, rule=None, space_id=None, validate_spaces=None)[source]¶
Update a comment or alert attached to a case.
- Parameters:
case_id (str) – The identifier for the case.
id (str) – The identifier of the comment being updated.
version (str) – The current version of the comment, as returned by
get_comment()orget_comments()(used for optimistic concurrency control).type (str) – The attachment type:
"user"(default) or"alert".owner (str) – The application that owns the case:
"cases"(default),"observability", or"securitySolution".comment (str | None) – The updated comment text (required when
type="user").alert_id (str | list[str] | None) – The alert identifier(s) (required when
type="alert").index (str | list[str] | None) – The alert index(es) (required when
type="alert").rule (dict[str, Any] | None) – The rule associated with the alerts (required when
type="alert").space_id (str | None) – Optional space ID the case lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the updated case, including the modified attachment in
comments.- Raises:
BadRequestError – If the attachment body is invalid.
ConflictError – If the version doesn’t match the current comment version.
NotFoundError – If the case or comment 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.cases.update_comment( ... case_id="a18b38a0-...", ... id="8af6ac20-...", ... version="Wzk1LDFd", ... comment="Root cause identified.", ... )
- async get_comment(*, case_id, comment_id, space_id=None, validate_spaces=None)[source]¶
Get a case comment or alert.
- Parameters:
- Returns:
ObjectApiResponse containing the attachment (
id,version,type,commentor alert fields, and audit metadata).- Raises:
NotFoundError – If the case or comment 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
>>> comment = await client.cases.get_comment( ... case_id="a18b38a0-...", comment_id="8af6ac20-..." ... ) >>> print(comment.body["comment"])
- async get_comments(*, case_id, page=None, per_page=None, sort_order=None, space_id=None, validate_spaces=None)[source]¶
Find comments and alerts attached to a case.
Retrieves a paginated list of case attachments via the
GET /api/cases/{caseId}/comments/_findendpoint.- Parameters:
case_id (str) – The identifier for the case.
page (int | None) – The page number to return (server default 1).
per_page (int | None) – The number of items per page (server default 20, maximum 100).
sort_order (str | None) – Sort order:
"asc"or"desc"(server default).space_id (str | None) – Optional space ID the case lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing
comments(the page of attachments),total,pageandper_page.- Raises:
NotFoundError – If the case 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
>>> comments = await client.cases.get_comments( ... case_id="a18b38a0-...", per_page=10 ... ) >>> print(comments.body["total"])
- async delete_comment(*, case_id, comment_id, space_id=None, validate_spaces=None)[source]¶
Delete a comment or alert from a case.
- Parameters:
- Returns:
ObjectApiResponse with an empty body on success (HTTP 204).
- Raises:
NotFoundError – If the case or comment 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.cases.delete_comment( ... case_id="a18b38a0-...", comment_id="8af6ac20-..." ... )
- async delete_all_comments(*, case_id, space_id=None, validate_spaces=None)[source]¶
Delete all comments and alerts from a case.
- Parameters:
- Returns:
ObjectApiResponse with an empty body on success (HTTP 204).
- Raises:
NotFoundError – If the case 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.cases.delete_all_comments(case_id="a18b38a0-...")
- async find_user_actions(*, case_id, page=None, per_page=None, sort_order=None, types=None, space_id=None, validate_spaces=None)[source]¶
Find case activity (user actions).
Retrieves a paginated list of user activity for a case, such as status changes, comments, tag updates and connector changes.
- Parameters:
case_id (str) – The identifier for the case.
page (int | None) – The page number to return (server default 1).
per_page (int | None) – The number of items per page (server default 20, maximum 100).
sort_order (str | None) – Sort order:
"asc"or"desc"(server default).types (list[str] | None) – Filter activity by type. Valid values include
"action","alert","assignees","attachment","comment","connector","create_case","description","pushed","settings","severity","status","tags","title"and"user".space_id (str | None) – Optional space ID the case lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing
userActions(the page of activity records),total,pageandperPage.- Raises:
NotFoundError – If the case 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
>>> activity = await client.cases.find_user_actions( ... case_id="a18b38a0-...", types=["status"] ... ) >>> for action in activity.body["userActions"]: ... print(action["action"], action["type"])
- async push(*, case_id, connector_id, space_id=None, validate_spaces=None)[source]¶
Push a case to an external service.
Sends the case to the external incident management system configured for the given connector (for example Jira, ServiceNow, or IBM Resilient).
- Parameters:
case_id (str) – The identifier for the case.
connector_id (str) – The identifier for the connector. To retrieve connector IDs, use
find_connectors().space_id (str | None) – Optional space ID the case lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the case, including the
external_servicepush details.- Raises:
NotFoundError – If the case or connector does not exist.
BadRequestError – If the connector is not usable for pushing.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> pushed = await client.cases.push( ... case_id="a18b38a0-...", ... connector_id="0c3b3bc0-...", ... ) >>> print(pushed.body["external_service"]["external_url"])
- async add_file(*, case_id, file, filename, mime_type='text/plain', space_id=None, validate_spaces=None)[source]¶
Attach a file to a case.
The file is uploaded as
multipart/form-data. Note that the server restricts the allowed MIME types (images, text, CSV, JSON, PDF, and Office/zip documents by default) and the maximum file size (100 MiB by default, 10 MiB for images).- Parameters:
case_id (str) – The identifier for the case.
filename (str) – The desired name of the file (also sent as the
filenameform field).mime_type (str) – The MIME type of the file (default
"text/plain").space_id (str | None) – Optional space ID the case lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the updated case; the file appears as an attachment in
comments.- Raises:
BadRequestError – If the file type or size is not allowed.
NotFoundError – If the case 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.cases.add_file( ... case_id="a18b38a0-...", ... file=b"investigation notes", ... filename="notes.txt", ... )
- async get_configuration(*, owner=None, space_id=None, validate_spaces=None)[source]¶
Get case settings (configuration).
Retrieves the case configurations, which include the closure type, default connector, custom fields and templates. There is one configuration per case owner application.
- Parameters:
owner (str | list[str] | None) – Filter by case owner application:
"cases","observability", or"securitySolution". Defaults to all owners the user has access to.space_id (str | None) – Optional space ID to read the configuration from.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse whose body is a list of configuration objects (
id,version,owner,closure_type,connector,customFields,templates, …).- Raises:
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> configs = await client.cases.get_configuration(owner="cases") >>> for config in configs.body: ... print(config["id"], config["closure_type"])
- async create_configuration(*, closure_type, connector=None, owner='cases', custom_fields=None, templates=None, space_id=None, validate_spaces=None)[source]¶
Add case settings (configuration).
Case settings include external connection details, custom fields and templates. Connectors are used to interface with external systems. You must create a connector before you can use it in your cases. If you set a default connector, it is automatically selected when you create cases in Kibana. If you use the create configuration API for an owner that already has a configuration, it is replaced.
- Parameters:
closure_type (str) – Whether a case is closed when it is pushed to an external system:
"close-by-pushing"or"close-by-user".connector (dict[str, Any] | None) – An object that contains the default connector configuration (
id,name,type,fields). Defaults to the “none” connector when omitted.owner (str) – The application that owns the configuration:
"cases"(default),"observability", or"securitySolution".custom_fields (list[dict[str, Any]] | None) – Custom field definitions, each an object with
key,label,typeandrequired.templates (list[dict[str, Any]] | None) – Case templates (technical preview in 9.4).
space_id (str | None) – Optional space ID to store the configuration in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the created configuration, including its
idandversion.- Raises:
BadRequestError – If the configuration 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
>>> config = await client.cases.create_configuration( ... closure_type="close-by-user", ... owner="cases", ... ) >>> print(config.body["id"])
- async update_configuration(*, configuration_id, version, closure_type=None, connector=None, custom_fields=None, templates=None, space_id=None, validate_spaces=None)[source]¶
Update case settings (configuration).
Updates external connection details, custom fields and templates for a case configuration. Connectors are used to interface with external systems.
- Parameters:
configuration_id (str) – The identifier for the configuration. To retrieve configuration IDs, use
get_configuration().version (str) – The current version of the configuration, as returned by
get_configuration()(used for optimistic concurrency control).closure_type (str | None) – Whether a case is closed when it is pushed to an external system:
"close-by-pushing"or"close-by-user".connector (dict[str, Any] | None) – An object that contains the default connector configuration.
custom_fields (list[dict[str, Any]] | None) – Custom field definitions.
templates (list[dict[str, Any]] | None) – Case templates (technical preview in 9.4).
space_id (str | None) – Optional space ID the configuration lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the updated configuration, with its new
version.- Raises:
BadRequestError – If the configuration body is invalid.
ConflictError – If the version doesn’t match the current configuration version.
NotFoundError – If the configuration 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.cases.update_configuration( ... configuration_id="3297a0f0-...", ... version="WzIwMiwxXQ==", ... closure_type="close-by-pushing", ... )
- async find_connectors(*, space_id=None, validate_spaces=None)[source]¶
Get case connectors.
Retrieves information about the connectors that are supported for use in cases (Jira, ServiceNow, Swimlane, IBM Resilient, and Cases Webhook types).
- Parameters:
- Returns:
ObjectApiResponse whose body is a list of connectors usable in cases.
- Raises:
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> connectors = await client.cases.find_connectors() >>> for connector in connectors.body: ... print(connector["id"], connector["actionTypeId"])
- async get_reporters(*, owner=None, space_id=None, validate_spaces=None)[source]¶
Get case creators (reporters).
Returns information about the users who opened cases.
- Parameters:
owner (str | list[str] | None) – Filter by case owner application:
"cases","observability", or"securitySolution". Defaults to all owners the user has access to.space_id (str | None) – Optional space ID to search in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse whose body is a list of reporters, each with
username,full_name,emailandprofile_uid.- Raises:
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> reporters = await client.cases.get_reporters(owner="cases") >>> for reporter in reporters.body: ... print(reporter["username"])
- async get_tags(*, owner=None, space_id=None, validate_spaces=None)[source]¶
Get case tags.
Aggregates and returns a list of all unique tags used in cases.
- Parameters:
owner (str | list[str] | None) – Filter by case owner application:
"cases","observability", or"securitySolution". Defaults to all owners the user has access to.space_id (str | None) – Optional space ID to search in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse whose body is a list of tag strings.
- Raises:
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
SpaceNotFoundError – If the space doesn’t exist and validation is enabled.
- Return type:
Example
>>> tags = await client.cases.get_tags() >>> print(tags.body) ['security', 'auth']