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

# Delete function

> Archive a function on a branch. Returns 409 Conflict if the function is still referenced by flow steps, topics, stop keywords, behaviours, or variables — pass ?force=true to delete anyway and leave those references orphaned. Call get-function-references first to see what would break. Deletion is not visible to a running agent until the branch is deployed.



## OpenAPI

````yaml api-reference/agents/openapi.json DELETE /v1/agents/{agentId}/branches/{branchId}/functions/{functionId}
openapi: 3.1.0
info:
  title: PolyAI Agents API
  version: 1.0.11
  description: Manage PolyAI agents, telephony, deployments, and real-time configs.
servers:
  - url: https://api.us.poly.ai
    description: US region
  - url: https://api.eu.poly.ai
    description: EU region
  - url: https://api.uk.poly.ai
    description: UK region
  - url: https://api.studio.poly.ai
    description: Studio region
security:
  - polyApiKey: []
paths:
  /v1/agents/{agentId}/branches/{branchId}/functions/{functionId}:
    parameters:
      - name: agentId
        in: path
        required: true
        schema:
          type: string
      - name: branchId
        in: path
        required: true
        schema:
          type: string
      - name: functionId
        in: path
        required: true
        schema:
          type: string
    delete:
      tags:
        - Functions
      summary: Delete a function
      description: >-
        Archive a function on a branch. Returns 409 Conflict if the function is
        still referenced by flow steps, topics, stop keywords, behaviours, or
        variables — pass ?force=true to delete anyway and leave those references
        orphaned. Call get-function-references first to see what would break.
        Deletion is not visible to a running agent until the branch is deployed.
      responses:
        '204':
          description: Function deleted
        '404':
          description: Function not found
        '409':
          description: Function is referenced by other entities
components:
  securitySchemes:
    polyApiKey:
      type: apiKey
      in: header
      name: X-API-KEY

````