---
url: /en/build/internal-steps/cnb/destroy-token.md
---
`cnb:destroy-token`

A [CNB\_TOKEN](../../build-in-env.md#cnb_token) is created before the pipeline starts and is destroyed after it ends.
Use this task to proactively destroy the CNB\_TOKEN and remove this environment variable.

* [Applicable Events](#cnb-destroy-token-applicable-events)
* [Parameters](#cnb-destroy-token-parameters)
* [Output](#cnb-destroy-token-output)
* [Configuration Examples](#cnb-destroy-token-configuration-examples)

## Applicable Events {#cnb-destroy-token-applicable-events}

[All Events](../../trigger-rule.md#trigger-event)

## Parameters {#cnb-destroy-token-parameters}

None

## Output {#cnb-destroy-token-output}

None

## Configuration Examples {#cnb-destroy-token-configuration-examples}

Proactively destroy the CNB\_TOKEN after use in the pipeline to reduce the risk of CNB\_TOKEN misuse.

```yaml title=".cnb.yml"
main:
  push:
    - stages:
        - name: use CNB_TOKEN
          script: echo "Make API calls using the CNB_TOKEN."
        - name: destroy token
          type: cnb:destroy-token
```
