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

# Delete Agent Variable

> Delete an environment variable from an agent.

### Overview

Removes one variable from one of the agent's environments. If the variable was saved with `is_secret`, the stored secret is deleted with it. The request succeeds even when no variable with that key exists. Calls that run as this environment and still reference `{{env.KEY}}` fail until the variable is set again with [Set Agent Variable](https://docs.bland.ai/api-v2/put/agents-id-environments-env-variables-key.md).

Requires an admin, owner, operator, or prompter role.

### Headers

**authorization** `string` *required*

Your API key for authentication.

### Path Parameters

**agent\_id** `string` *required*

The agent's unique identifier.

**env** `string` *required*

One of `dev`, `staging`, `production`. Any other value returns `400 INVALID_ENV`.

**key** `string` *required*

The variable key to remove, matched exactly after trimming surrounding whitespace.

### Response

**data.deleted** `boolean`

Always `true` on success, whether or not a variable with that key existed.

**errors** `null | array`

`null` on success, or a list of error objects if the request failed.

```json Response theme={null}
{
  "data": {
    "deleted": true
  },
  "errors": null
}
```

```json Invalid Env theme={null}
{
  "data": null,
  "errors": [
    {
      "error": "INVALID_ENV",
      "message": "env must be one of: dev, staging, production"
    }
  ]
}
```

```json Not Found theme={null}
{
  "data": null,
  "errors": [
    {
      "error": "NOT_FOUND",
      "message": "Agent not found"
    }
  ]
}
```

***

Docs for agents: [llms.txt](https://docs.bland.ai/llms.txt)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.