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

# Delete an ai message

> Soft-deletes a workspace-owned ai message. Fails with 409 when the entity is still referenced (active campaign steps, other AI entities embedding it). Requires the AI variable split to be enabled for the workspace; otherwise returns 403.

    > **Required scope:** `AI_VARIABLES_WRITE`
    >
    > **Rate limit:** 30 requests per minute



## OpenAPI

````yaml https://openapi.enginy.ai/definitions.json delete /v1/ai-variables/ai-messages/{aiMessageId}
openapi: 3.1.0
info:
  title: Enginy API
  version: 1.0.0
  description: Public API for Enginy platform
servers:
  - url: https://openapi.enginy.ai
    description: Configured server
security: []
tags:
  - name: AI Variables
    description: >-
      Manage AI variables and discover the entity fields you can reference in
      prompts and entity requests.
  - name: Inbox
    description: >-
      Inbox endpoints for listing contact threads, reading thread messages,
      managing tags, and sending manual replies.
  - name: Workflows
    description: >-
      Build, validate, publish, run, and inspect advanced (graph) workflows,
      plus the block/condition catalog needed to author a workflow plan.
paths:
  /v1/ai-variables/ai-messages/{aiMessageId}:
    delete:
      tags:
        - AI Variables
      summary: Delete an ai message
      description: >-
        Soft-deletes a workspace-owned ai message. Fails with 409 when the
        entity is still referenced (active campaign steps, other AI entities
        embedding it). Requires the AI variable split to be enabled for the
        workspace; otherwise returns 403.

            > **Required scope:** `AI_VARIABLES_WRITE`
            >
            > **Rate limit:** 30 requests per minute
      parameters:
        - schema:
            type: string
            minLength: 1
          required: true
          name: aiMessageId
          in: path
      responses:
        '200':
          description: AI message deleted successfully
        '403':
          description: >-
            AI variable split not enabled for this workspace, or the entity is a
            default one and cannot be deleted
        '404':
          description: AI message not found in this workspace
        '409':
          description: AI message is in use and cannot be deleted
      security:
        - apiKey: []
components:
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key

````