Share via


Delete agents programmatically with the Power Platform API

Copilot Studio provides administrators with robust tools to manage agent security and compliance, including the ability to delete agents through the Power Platform API.

Deleting agents is part of Copilot Studio's broader security framework and works in tandem with your overall security approach in Copilot Studio.

For example, agents that violate organizational requirements for security and authentication can be flagged as part of audits, runtime protection, or other admin reports or notifications. Admins can then use the delete operation to remove the noncompliant agents while investigating and remediating security and compliance issues.

Deleted agents are removed from your environment. Makers and previous users can no longer see them.

Important

The powervirtualgents namespace is deprecated. Use the copilotstudio namespace in your API calls.

Prerequisites

  • You have the Bot ID and Environment ID for the target agent.
  • You must obtain a user access token issued by Microsoft Entra ID OAuth2. To obtain a token, see Authentication.
    • The user associated with the token must have one of the following admin roles:
      • Global tenant administrator
      • AI administrator
      • Power Platform administrator
    • You must acquire the access token using the client ID of an app registration that has the CopilotStudio.AdminActions.Invoke scope granted under the Power Platform API.

API operations for agent deletion

Copilot Studio supports the REST API delete operation for removing or deleting agents, as part of the Power Platform API.

For more information on how and when to use the Power Platform API, see:

Delete agent

  • Endpoint: DELETE https://api.powerplatform.com/copilotstudio/environments/{EnvironmentId}/bots/{BotId}/api/botAdminOperations?api-version=1
  • Purpose: Permanently delete an agent
  • Response: Returns 204 OK if the agent was deleted successfully

Learn more in Delete Copilot Agent API reference documentation.