---
docId: doc_295cce566a014a43b4f2b1287f667486
title: Delete a secret
description: "Delete a secret: its value and all the authorizations it had are erased."
api:
  group: herramientas/secretos
  auth: bearer
  operations:
    - operationId: deleteSecret
      method: DELETE
      path: '/v1/secrets/{secretId}'
      postmanName: Delete a secret
---

<script>
  import { Ways, Note } from '$lib/components';
</script>

# Delete a secret

Delete a secret you no longer want to keep. First check `usedBy` with [Get a secret](/api-reference/secrets/get) to see which resources use it. Its value and all authorizations are erased; those slots need another secret to work.

<Note type="warning">

This cannot be undone. The APIs, MCP servers, and webhooks that used the secret stop working until you bind another one to them.

</Note>

## Example

<Ways tabs="api,sdk">
<Ways.Way name="api">

```bash
curl -X DELETE https://api.platic.ai/v1/secrets/$SECRET_ID \
  -H "Authorization: Bearer $PLATIC_API_KEY"
```

</Ways.Way>
<Ways.Way name="sdk">

```ts
await platic.secrets.delete("secret_123");
```

</Ways.Way>
</Ways>

## Path parameters

| Parameter | Type | Description | Required |
|-----------|------|-------------|----------|
| `secretId` | string | Id of the secret | ✓ |

## Response

```json
{
  "status": "success",
  "message": "Secret deleted successfully",
  "data": {
    "id": "5d0c7a1e9b3f4a6c8e2d1f0b7a9c3e5d6f8a0b2c4d6e8f1a3b5c7d9e0f2a4b6c"
  }
}
```

### Response fields

| Field | Type | Description |
|-------|------|-------------|
| `id` | string | Id of the deleted secret |

## Errors

| Status | `details.code` | When it happens |
|--------|----------------|-----------------|
| `403` | `FORBIDDEN` | The person behind the token cannot manage secrets |
| `404` | `SECRET_NOT_FOUND` | The secret does not exist in this workspace or was already deleted |
| `409` | `SECRET_CHANGED` | Another change arrived at the same time. Repeat the call |

## Notes

- Before deleting, check `usedBy` with [get a secret](/api-reference/secrets/get).
- Deleting an API, an MCP server, or a webhook does not delete its secrets: they are deleted here.
- Repeating the call on a secret that is already being deleted continues the deletion.
- When it finishes, the secret answers `404` on all its routes, the same as one that never existed.
