---
title: "Delete function secret"
method: DELETE
path: "/functions/{function_id}/secrets/{secret_name}"
tags: ["Functions"]
---

# Delete function secret

`DELETE /functions/{function_id}/secrets/{secret_name}`

Permanently delete a secret from this function. The secret will be removed from the runtime environment and will no longer be available as an environment variable.

Requirements:
- Function must be in 'deployed' status (422 if not)
- Secret must exist (404 if not found)

After deletion:
- Secret is immediately removed from function runtime environment
- Function can no longer access the secret value
- Any function invocations referencing the deleted secret will fail

This operation cannot be undone. Make sure the secret is no longer needed before deletion. If the function code still references the deleted secret, invocations may fail with undefined variable errors.

## Response `204`

Secret deleted successfully (no content returned)

## Other responses

- `401` — Missing or invalid API key
- `404` — Resource not found
- `422` — Function not deployed or validation error
- `502` — Error communicating with Cloudflare API

---

[API](https://skmtc.net/kapso/apis/kapso-platform-api.md) · [All operations](https://skmtc.net/kapso/apis/kapso-platform-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/kapso/kapso-platform-api/versions/18ff5548a33f/schema)
