---
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/4493/api/doc/cloud-enterprise/v4/operation/operation-deployment-apm-reset-secret-token
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/cloud-enterprise/v4/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`

#### Path parameters

- `deployment_id` (string) — required
  Identifier for the Deployment.
- `ref_id` (string) — required
  User-specified RefId for the Resource (or '_main' if there is only one).

## Description

Reset the token of an APM resource.

## Authentication

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

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

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

#### `500`

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

`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}/apm/${REF_ID}/_reset-token" \
  -u "${USERNAME}:${PASSWORD}"
```

