---
title: "delete_secret"
description: "Generated reference for the management action delete_secret: its description, access metadata, payload contract, and registration status."
slug: /reference/actions/delete-secret
order: 42
visibility: public
redirects_from: []
---

# delete\_secret

Generated automatically from the [published contract sources](/cloud/reference/about/#contract-sources).

A script calls this action over HTTPS at `POST https://tzcloud.turnzero.ai/v1/delete_secret`, with a bearer credential and the action's payload as the JSON body. An MCP connection lists this action as the tool `tzcloud_delete_secret`.

OAuth access tokens and minted tokens, including the turnzero command's computer token, are bearer credentials. The action determines which kinds, scopes and grants it accepts ([Sign-in, sessions, and tokens](/cloud/concepts/sign-in-sessions-and-tokens/)).

**Build metadata:** Registered in this build. Registration describes the default dispatcher in this build. It does not guarantee that a caller has the required credential or grant, that a tool is listed for that connection, or that the required service is configured.

## Contract description

Delete your stored secret by name and scope\. This cannot be undone\. Use a signed\-in session or account\-wide token minted with `destructive`\. Give the account's owner `approval_url` for browser approval, then read `read_approval_status` to its end\. Nothing is deleted before approval\. End settings, upstream, sign\-in and push uses first or meet `secret_in_use`\. A platform\-managed secret cannot be deleted\. To change a value, use `store_secret` with `replace: true`\. Replace a leaked key at its issuer\.

## More about this action

If you store a value under the same name afterwards, it is a new value\.

A name is in use while a setting is bound to it in the recorded manifest, in a running copy, or in an act in progress such as a deploy\. It is also in use while it is an upstream's key, a realm route's credential, or a push provider's credential\. A use that begins before the approval ends the pending action declined\. A use that begins after the approval ends it failed with `secret_in_use`\.

If the value is already gone, or was re\-supplied, rotated, or stored again since the approval, the action completes with `deleted` false, and nothing is deleted\.

Pass `request_id` to make a repeat safe\. While the earlier pending action is still live \(requested, approved, or executing\), a call with the same `request_id` from the same account returns that action and creates no second one\. Once the action has completed, failed, been declined, or expired, the same `request_id` starts a new one\.

No action reads or restores a deleted value\. The vault keeps it soft\-deleted for its retention period\.

Deleting the environment, application or account removes its platform credentials\. Platform names `credential-<application id>`, `database-<application id>` and `issue-tracking-<application id>` refuse `platform_minted_name`\. An `issue-space:` token's colon fails validation before lookup\.

## Access and action metadata

```json
{
  "name": "delete_secret",
  "resource": "secret",
  "tier": "destructive",
  "surface": "tzcloud",
  "addresses": [
    "tzcloud"
  ],
  "product": "cloud",
  "clients": [
    "bearer",
    "browser_session"
  ],
  "summary": "End one stored value through the pending action, its description rendered from the custody index: the entry leaves the index and no caller reads the value again, the vault holding it in its soft delete for its retention window. A platform-minted name, and a name a binding, an upstream, a realm route, or a push provider uses, is refused.",
  "annotations": {
    "readOnlyHint": false,
    "destructiveHint": true,
    "openWorldHint": false
  }
}
```

## MCP catalog entry

```json
{
  "name": "delete_secret",
  "title": "Delete secret",
  "tier": "destructive",
  "scenario": "CHI-L0-08",
  "summary": "Delete your stored secret by name and scope. This cannot be undone. Use a signed-in session or account-wide token minted with `destructive`. Give the account's owner `approval_url` for browser approval, then read `read_approval_status` to its end. Nothing is deleted before approval. End settings, upstream, sign-in and push uses first or meet `secret_in_use`. A platform-managed secret cannot be deleted. To change a value, use `store_secret` with `replace: true`. Replace a leaked key at its issuer.",
  "owners": [
    "SCRT-L0-07",
    "SCRT-L0-08",
    "SEC-L0-07",
    "MAN-14",
    "API-L0-07",
    "MAPI-05"
  ]
}
```

## request

| JSON pointer | Description and constraints |
|---|---|
| "" \(root\) | Type: object<br>Required fields: \["name"\]<br>Additional properties: false |
| /<wbr>properties/<wbr>name | The stored name to delete, as `list_secrets` lists it\.<br><br>Type: string<br>Pattern: ^\[a\-zA\-Z0\-9\]\[a\-zA\-Z0\-9\_\-\]\{0,63\}$ |
| /<wbr>properties/<wbr>application | The application id whose scope holds the secret; omitted, the account scope\.<br><br>Type: string |
| /<wbr>properties/<wbr>environment | Optional, and only with `application`: the environment whose scope of that application holds the secret, `development` or `production`; leave it out for `production`\. Refused if given without `application`\. Each environment's value is deleted on its own call\.<br><br>Type: string<br>Pattern: ^\(development\|production\)$ |
| /<wbr>properties/<wbr>request\_id | Any string you choose\. A repeat from the same account while that pending action is live returns it again, creating no second one\. Omitted, every call creates a new one\.<br><br>Type: string |

## response

| JSON pointer | Description and constraints |
|---|---|
| "" \(root\) | The 202 creation envelope: the pending action and its approval link\. Read the terminal outcome on the pending record with read\_approval\_status\. A completed outcome holds `deleted`, the `secret` with its `name`, `scope`, `application`, and `environment`, and a `detail`\. Where `deleted` is false the value was already gone, or was re\-supplied, rotated, or stored again since the approval\. Where it is true the detail states the vault's retention window\. A use made after the approval ends the record `failed` with `secret_in_use`\.<br><br>Type: object<br>Required fields: \["contract\_version","pending\_action","approval\_url"\] |
| /<wbr>properties/<wbr>contract\_version | Required value: 1 |
| /<wbr>properties/<wbr>reference | The short reference the platform recorded your call under: ten lowercase hexadecimal characters, the value in the call’s record row\. Quote it when you report the call\.<br><br>Type: string<br>Pattern: ^\[0\-9a\-f\]\{10\}$ |
| /<wbr>properties/<wbr>pending\_action | $ref: \#/shapes/pending\_action |
| /<wbr>properties/<wbr>approval\_url | Type: string |
| /<wbr>properties/<wbr>detail | Type: string |

## Complete payload contract

```json
{
  "request": {
    "type": "object",
    "required": [
      "name"
    ],
    "properties": {
      "name": {
        "type": "string",
        "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$",
        "description": "The stored name to delete, as `list_secrets` lists it."
      },
      "application": {
        "type": "string",
        "description": "The application id whose scope holds the secret; omitted, the account scope."
      },
      "environment": {
        "type": "string",
        "pattern": "^(development|production)$",
        "description": "Optional, and only with `application`: the environment whose scope of that application holds the secret, `development` or `production`; leave it out for `production`. Refused if given without `application`. Each environment's value is deleted on its own call."
      },
      "request_id": {
        "type": "string",
        "description": "Any string you choose. A repeat from the same account while that pending action is live returns it again, creating no second one. Omitted, every call creates a new one."
      }
    },
    "additionalProperties": false
  },
  "response": {
    "type": "object",
    "description": "The 202 creation envelope: the pending action and its approval link. Read the terminal outcome on the pending record with read_approval_status (API-L0-07). A completed outcome holds `deleted`, the `secret` with its `name`, `scope`, `application`, and `environment`, and a `detail`. Where `deleted` is false the value was already gone, or was re-supplied, rotated, or stored again since the approval. Where it is true the detail states the vault's retention window (SCRT-L0-07). A use made after the approval ends the record `failed` with `secret_in_use`.",
    "required": [
      "contract_version",
      "pending_action",
      "approval_url"
    ],
    "properties": {
      "contract_version": {
        "const": 1
      },
      "reference": {
        "type": "string",
        "pattern": "^[0-9a-f]{10}$",
        "description": "The short reference the platform recorded your call under: ten lowercase hexadecimal characters, the value in the call’s record row. Quote it when you report the call."
      },
      "pending_action": {
        "$ref": "#/shapes/pending_action"
      },
      "approval_url": {
        "type": "string"
      },
      "detail": {
        "type": "string"
      }
    }
  }
}
```

## Shared contracts

- [Refusals](/cloud/reference/refusals/): every refusal, by surface, with its cause and its remedy
- [schemas/wire\_error\.schema\.json](/cloud/reference/sources/schemas/wire-error-schema/)
- [schemas/wire\_errors\.json](/cloud/reference/sources/schemas/wire-errors/)
- [schemas/action\_payloads\.json](/cloud/reference/sources/schemas/action-payloads/) (includes shared shapes)
- [management\_api\_contract\.md](/cloud/reference/sources/management-api-contract/)
