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

# Delete Agent

> Delete an AI agent

Permanently delete an AI agent from your account.

<Warning>
  This action is irreversible. All agent configuration will be lost. Phone numbers assigned to this agent will be unassigned but not released.
</Warning>

## Request Body

<ParamField body="agent_id" type="string" required>
  The unique identifier of the agent to delete.
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Whether the agent was deleted successfully.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.magpipe.ai/functions/v1/delete-agent \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"agent_id": "550e8400-e29b-41d4-a716-446655440000"}'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    'https://api.magpipe.ai/functions/v1/delete-agent',
    {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        agent_id: '550e8400-e29b-41d4-a716-446655440000'
      }),
    }
  );

  const result = await response.json();
  console.log('Deleted:', result.success);
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.magpipe.ai/functions/v1/delete-agent',
      headers={
          'Authorization': 'Bearer YOUR_API_KEY',
          'Content-Type': 'application/json',
      },
      json={'agent_id': '550e8400-e29b-41d4-a716-446655440000'}
  )

  result = response.json()
  print(f"Deleted: {result['success']}")
  ```
</RequestExample>

<ResponseExample>
  ```json Success Response theme={null}
  {
    "success": true
  }
  ```

  ```json Error Response theme={null}
  {
    "error": {
      "code": "agent_not_found",
      "message": "Agent not found"
    }
  }
  ```
</ResponseExample>
