---
type: api
title: Capture diagnostics for an Elasticsearch or Kibana resource
description: Retrieves a diagnostic bundle from an active cluster. To successfully retrieve a diagnostic bundle, the cluster must be responsive.
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/cloud-enterprise/operation/operation-capture-deployment-resource-diagnostics
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/cloud-enterprise/operation/operation-capture-deployment-resource-diagnostics
products:
  - Elastic Cloud Enterprise
---

# Capture diagnostics for an Elasticsearch or Kibana resource

## Paths

- `POST` `/deployments/{deployment_id}/{resource_kind}/{ref_id}/diagnostics/_capture`

- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/cloud-enterprise/authentication#basicauth)
- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/cloud-enterprise/authentication#apikey)

#### Path Parameters

- `deployment_id` (string)
  Identifier for the Deployment
- `resource_kind` (string)
  The kind of resource (one of elasticsearch or kibana).
- `ref_id` (string)
  User-specified RefId for the Resource (or '_main' if there is only one).

## Description

Retrieves a diagnostic bundle from an active cluster. To successfully retrieve a diagnostic bundle, the cluster must be responsive.

## Query String Parameters

- `mode` (enum  · default: full)
  Capture mode - whether to obtain all the diagnostics data or the lightweight, essential-only subset of it. Applicable only to Elasticsearch, ignored for any other components which have just one capture mode implemented.
  Values: `full`, `light`

## Responses

#### `200`

The diagnostic bundle as a zip file

`application/json`

Type: `string`

#### `404`

* The Deployment specified by {deployment_id} cannot be found. (code: `deployments.deployment_not_found`)
* The Resource specified by {ref_id} cannot be found. (code: `deployments.deployment_resource_not_found`)

`application/json`

- `errors` ([] BasicFailedReplyElement)
  A list of errors that occurred in the failing request
  - `code` (string)
    A structured code representing the error type that occurred
  - `message` (string)
    A human readable message describing the error that occurred
  - `fields` ([] string)
    If the error can be tied to a specific field or fields in the user request, this lists those fields
##### Response Headers

- `x-cloud-error-codes` (enum)
  The error codes associated with the response

#### `412`

The diagnostics cannot be generated because the cluster is either stopped or initializing. (code: `clusters.cluster_plan_state_error`)

`application/json`

- `errors` ([] BasicFailedReplyElement)
  A list of errors that occurred in the failing request
  - `code` (string)
    A structured code representing the error type that occurred
  - `message` (string)
    A human readable message describing the error that occurred
  - `fields` ([] string)
    If the error can be tied to a specific field or fields in the user request, this lists those fields
##### Response Headers

- `x-cloud-error-codes` (enum)
  The error codes associated with the response

## Code Examples

#### Console

```console
POST /deployments/{deployment_id}/{resource_kind}/{ref_id}/diagnostics/_capture
```

#### curl

```curl
curl -X POST "/deployments/{deployment_id}/{resource_kind}/{ref_id}/diagnostics/_capture"
```

