# Delete function

> Permanently delete a function and cascade: triggers, secrets, deployment history, managed agents+tools, and revoke the auto-provisioned API key. The deployed runtime and its logs are torn down asynchronously.

`DELETE https://api.zavu.dev/v1/functions/{functionId}`

Permanently delete a function and cascade: triggers, secrets, deployment history, managed agents+tools, and revoke the auto-provisioned API key. The deployed runtime and its logs are torn down asynchronously.

## Parameters

- `functionId` (path, string, required): Zavu Function ID.

## Responses

### 200

Function deleted.

- `deleted` (boolean, required)
- `name` (string)
- `slug` (string)

### 400

Cannot delete while a deployment is in progress.

- `code` (string, required)
- `message` (string, required)
- `details` (object)

### 401

Unauthorized.

- `code` (string, required)
- `message` (string, required)
- `details` (object)

### 404

Function not found.

- `code` (string, required)
- `message` (string, required)
- `details` (object)

## Example

```bash
curl -X DELETE "https://api.zavu.dev/v1/functions/function_abc123" \
  -H "Authorization: Bearer $ZAVUDEV_API_KEY"
```

```typescript
import Zavudev from "@zavudev/sdk";

const zavu = new Zavudev({ apiKey: process.env.ZAVUDEV_API_KEY });

const result = await zavu.functions.delete("function_abc123");

console.log(result);
```
