---
type: api
title: Find and/or aggregate attack discovery alerts
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v9/operation/operation-searchattacks
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v9/operation/operation-searchattacks
products:
  - Kibana
---

# Find and/or aggregate attack discovery alerts

Availability: 9.5+

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

## Paths

- `POST` `/api/detection_engine/attacks/search`
- `POST` `/s/{space_id}/api/detection_engine/attacks/search`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/kibana/v9/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/kibana/v9/authentication#basicauth)

## Description

Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.

Find and/or aggregate attack discovery alerts that match the given query. Searches scheduled and ad hoc attack discovery alert indices for the active space only.

## Request Body

`application/json`

Search and/or aggregation query

- `_source` (union boolean | string | [] string) — optional
- `aggs` (object) — optional
- `fields` ([] string) — optional
- `query` (object) — optional
- `runtime_mappings` (object) — optional
- `size` (integer · min: 0) — optional
- `sort` (union) — optional
  One of: `AlertsSortCombinations[]` or `AlertsSortCombinations`
- `track_total_hits` (boolean) — optional

## Responses

#### `200`

Successful response

`application/json`

Type: `object`

#### `400`

Invalid input data response

`application/json`

One of:
- **PlatformErrorResponse**
  - `error` (string)
  - `message` (string)
  - `statusCode` (integer)
- **SiemErrorResponse**
  - `message` (string)
  - `status_code` (integer)
#### `401`

Unsuccessful authentication response

`application/json`

- `error` (string)
- `message` (string)
- `statusCode` (integer)
#### `500`

Internal server error response

`application/json`

- `message` (string)
- `status_code` (integer)
## Code Examples

#### Console

```console
POST /api/detection_engine/attacks/search
{
  "query": {
    "ids": {
      "values": [
        "80e1383f856e67c1b7f7a1634744fa6d66b6e2ef7aa26d226e57afb5a7b2b4a1"
      ]
    }
  }
}
```

#### curl

```curl
curl -X POST "https://{kibana_url}/api/detection_engine/attacks/search" \
  -H "Content-Type: application/json" \
  -d '{
  "query": {
    "ids": {
      "values": [
        "80e1383f856e67c1b7f7a1634744fa6d66b6e2ef7aa26d226e57afb5a7b2b4a1"
      ]
    }
  }
}'
```

## Response Examples

#### Success

```json
{
  "_shards": {
    "failed": 0,
    "skipped": 0,
    "successful": 1,
    "total": 1
  },
  "hits": {
    "hits": [
      {
        "_id": "80e1383f856e67c1b7f7a1634744fa6d66b6e2ef7aa26d226e57afb5a7b2b4a1",
        "_index": ".internal.adhoc.alerts-security.attack.discovery.alerts-default-000001",
        "_score": 1,
        "_source": {
          "@timestamp": "2025-06-23T15:16:52.984Z",
          "kibana.alert.attack_discovery.alert_ids": [
            "ee183cf525d7e9d0f47d1b2bb928d760a0f53756ffa61edcf0672f71c986ac21",
            "46ebac989ca72439b14b57d32102543c17d5f33e0f6532d8a5c148949d8ff7b5"
          ],
          "kibana.alert.attack_discovery.title_with_replacements": "Widespread Malware Campaign via Compromised Account",
          "kibana.alert.workflow_status": "open"
        }
      }
    ],
    "max_score": 1,
    "total": {
      "relation": "eq",
      "value": 1
    }
  },
  "timed_out": false,
  "took": 1
}
```

#### Bad

```json
{
  "error": "Bad Request",
  "message": "Failed to parse search request: unknown query clause in bool filter",
  "statusCode": 400
}
```

#### Unauthorized

```json
{
  "error": "Unauthorized",
  "message": "[security_exception\n\tRoot causes:\n\t\tsecurity_exception: unable to authenticate user [elastic] for REST request [/_security/_authenticate]]: unable to authenticate user [elastic] for REST request [/_security/_authenticate]",
  "statusCode": 401
}
```

#### Server error

```json
{
  "message": "Internal Server Error",
  "status_code": 500
}
```

