Delete agent

DELETE/v2/agents/{agentId}

Permanently delete an agent together with its sources, procedures, actions and conversations.

Working draft. These docs are illustrative: names, endpoints and examples describe the intended behaviour and can change before launch.

Deletes an agent and everything that belongs to it: its sources, procedures, actions and conversations. Call it when you retire an agent or clean up agents that were created for tests.

Deleting cannot be undone. If you want to keep the conversations, export them first with Export conversations. If you may need the configuration again, create a copy with Clone agent before you delete.

Request

DELETE /v2/agents/{agentId}

Path parameters:

Name Type Required Description
agentId string Yes The ID of the agent to delete, starting with agt_.

The call has no query parameters and no body. An embed script or widget that still uses the agent ID stops answering once the agent is deleted.

Example request

curl -X DELETE https://api.askocto.co/v2/agents/agt_2q7w5n \
  -H "Authorization: Bearer $OCTO_API_KEY"
const response = await fetch("https://api.askocto.co/v2/agents/agt_2q7w5n", {
  method: "DELETE",
  headers: { Authorization: `Bearer ${process.env.OCTO_API_KEY}` },
})

const result = await response.json()
console.log(result.deleted)

Example response

A successful call returns 200 OK.

{
  "id": "agt_2q7w5n",
  "deleted": true
}

Response fields

Name Type Description
id string The ID of the agent that was deleted.
deleted boolean Always true on success.

Errors

Status Code When
401 unauthorized The API key is missing, malformed or deleted.
404 not_found No agent has this ID in your workspace, or it was already deleted.
429 rate_limited Too many requests. Wait for the number of seconds in the Retry-After header.

A second DELETE for the same ID returns 404, so treat that status as success in cleanup scripts. See Error handling.

Something unclear or missing? Tell us and we will fix the page.