---
type: api
title: Reset the secret token for an APM resource.
description: Reset the token of an APM resource.
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/cloud-enterprise/operation/operation-deployment-apm-reset-secret-token
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/cloud-enterprise/operation/operation-deployment-apm-reset-secret-token
products:
  - Elastic Cloud Enterprise
---

# Reset the secret token for an APM resource.

## Paths

- `POST` `/deployments/{deployment_id}/apm/{ref_id}/_reset-token`

- [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.
- `ref_id` (string)
  User-specified RefId for the Resource (or '_main' if there is only one).

## Description

Reset the token of an APM resource.

## Responses

#### `202`

Response containing the new secret token, plan to apply it starts

`application/json`

- `apm_id` (string)
  For an operation creating or updating an APM server, the Id of that server
- `secret_token` (string)
  The secret token for accessing the server
- `diagnostics` (object)
  If the endpoint is called with URL param 'validate_only=true', then this contains advanced debug info (the internal plan representation)
#### `400`

Reset token is not supported when APM is managed by Elastic Agent. (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

#### `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

#### `500`

We have failed you. (code: `deployments.deployment_resource_no_longer_exists`)

`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}/apm/{ref_id}/_reset-token
```

#### curl

```curl
curl -X POST "/deployments/{deployment_id}/apm/{ref_id}/_reset-token"
```

