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

# Delete Agent

> Permanently deletes an agent configuration. Fails with `409` if
the agent is referenced by active campaigns.
Requires `agent_config:edit` permission.




## OpenAPI

````yaml DELETE /api/agent-config/{id}
openapi: 3.1.0
info:
  title: Naturalead Agent Config API
  version: 1.0.0
  description: >
    API for managing AI agent configurations in the Naturalead platform.

    Agent configs define how the AI converses with leads, including the system
    prompt,

    conversation stages, guardrails, and attached knowledge bases.


    All endpoints require API key authentication and are scoped to the caller's
    account.
servers:
  - url: '{baseUrl}'
    description: API server
    variables:
      baseUrl:
        default: http://localhost:3001
security:
  - BearerAuth: []
tags:
  - name: Agent Config
    description: AI agent configuration CRUD, templates, and knowledge base assignment
  - name: Templates
    description: Pre-built agent configuration templates
  - name: Knowledge Bases
    description: Attach and detach knowledge bases from agents
paths:
  /api/agent-config/{id}:
    delete:
      tags:
        - Agent Config
      summary: Delete agent
      description: |
        Permanently deletes an agent configuration. Fails with `409` if
        the agent is referenced by active campaigns.
        Requires `agent_config:edit` permission.
      operationId: deleteAgent
      parameters:
        - $ref: '#/components/parameters/AgentId'
      responses:
        '200':
          description: Agent deleted
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                required:
                  - success
        '404':
          $ref: '#/components/responses/AgentNotFound'
        '409':
          description: Agent has active campaigns
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: Cannot delete agent with active campaigns
                required:
                  - error
        '500':
          $ref: '#/components/responses/InternalError'
components:
  parameters:
    AgentId:
      name: id
      in: path
      required: true
      description: Agent configuration ObjectId
      schema:
        type: string
  responses:
    AgentNotFound:
      description: Agent not found
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: Agent not found
            required:
              - error
    InternalError:
      description: Internal server error
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
            required:
              - error
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Bearer token using an API key (format nl_live_* or nl_test_*)

````