> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kapso.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete function secret

> 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.




## OpenAPI

````yaml /api/platform/v1/openapi-workflows.yaml delete /functions/{function_id}/secrets/{secret_name}
openapi: 3.1.0
info:
  title: Kapso Platform API – Advanced Resources
  version: 0.1.0
  description: >
    Build WhatsApp automation workflows and serverless functions. Create
    multi-step conversation flows, inspect executions, and deploy custom logic.
servers:
  - url: https://api.kapso.ai/platform/v1
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Workflows
    description: Create and manage conversation workflows and executions
  - name: Workflow Triggers
    description: Configure workflow triggers to automate execution
  - name: Functions
    description: Manage serverless functions, deployments, and secrets
  - name: WhatsApp Conversations
    description: Query WhatsApp conversation data and related resources
paths:
  /functions/{function_id}/secrets/{secret_name}:
    parameters:
      - name: function_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
        description: Function identifier
      - name: secret_name
        in: path
        required: true
        schema:
          type: string
          pattern: ^[A-Z0-9_]+$
        description: Secret name (uppercase alphanumeric with underscores)
        example: STRIPE_API_KEY
    delete:
      tags:
        - Functions
      summary: Delete function secret
      description: >
        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.
      operationId: deleteFunctionSecret
      responses:
        '204':
          description: Secret deleted successfully (no content returned)
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '404':
          $ref: '#/components/responses/NotFoundError'
        '422':
          description: Function not deployed or validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: Function must be deployed to manage secrets
        '502':
          description: Error communicating with Cloudflare API
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: Failed to delete secret from Cloudflare
components:
  responses:
    UnauthorizedError:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFoundError:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  schemas:
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Human-readable error message
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````