---
type: api
title: Capture a new thread dump for the given instance
description: Captures a new thread dump for the given instance and returns the thread dump contents.
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/cloud-enterprise/v4/operation/operation-capture-deployment-instance-thread-dump
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/cloud-enterprise/v4/operation/operation-capture-deployment-instance-thread-dump
products:
  - Elastic Cloud Enterprise
---

# Capture a new thread dump for the given instance

## Paths

- `POST` `/deployments/{deployment_id}/{resource_kind}/{ref_id}/instances/{instance_id}/thread_dump/_capture`

#### Path parameters

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

## Description

Captures a new thread dump for the given instance and returns the thread dump contents.

## Authentication

- Basic: `Authorization: Basic <credentials>`
- Api key: `Authorization: <value>`

## Responses

#### `200`

The thread dump contents

`application/json`

Type: `string · format: byte`

#### `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`)
* The specified instance cannot be found. (code: `deployments.instance_not_found_error`)

`application/json`

- `errors` (object[])
  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

#### curl

```curl
curl -X POST "${API_URL}/deployments/${DEPLOYMENT_ID}/${RESOURCE_KIND}/${REF_ID}/instances/${INSTANCE_ID}/thread_dump/_capture" \
  -u "${USERNAME}:${PASSWORD}"
```

