Skip to content
QwryAI
Documentation
Pages

Endpoints

Delete a procedure

Delete a procedure and its trigger through a review, after pausing it

delete_procedure deletes a procedure from the agent's Procedures page, together with the trigger that starts it. The call returns a review; nothing is deleted until you apply it. Published versions, releases and the history of past runs are kept.

POSThttps://api.qwryai.com/public/v1/tools/delete_procedure

Authentication

Send your API key as Authorization: Bearer YOUR_API_KEY; it needs the Change actions and procedures permission. See Authentication.

Body parameters

NameTypeRequiredDescription
chatbotIdstringYesThe agent's id, from list_agents.
draftIdstringYesThe procedure's id, from List procedures.
expectedRevisionintegerYesThe procedure's current revision.

Request example

Bash
curl -X POST 'https://api.qwryai.com/public/v1/tools/delete_procedure' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"chatbotId": "YOUR_AGENT_ID", "draftId": "PROCEDURE_ID", "expectedRevision": 3}'

Response

The review

JSON
{
  "success": true,
  "data": {
    "status": "review_required",
    "reviewId": "6c9a2f13-0e8b-4d47-b1a5-8f3e2d0c7b96",
    "tool": "delete_procedure",
    "changes": [
      {
        "title": "Delete Procedure draft: Speak to a manager",
        "before": { "name": "Speak to a manager" },
        "after": { "deleted": true, "retained": "Immutable compiled versions, releases and execution history" }
      }
    ],
    "unchanged": [],
    "expiresAt": "2026-12-01T10:15:00.000Z",
    "next": "Show these changes to the user. Call apply_change with this reviewId only after they approve; the review expires in 15 minutes."
  }
}

After you apply it

Apply with POST https://api.qwryai.com/public/v1/reviews/{reviewId}/apply:

JSON
{
  "success": true,
  "data": {
    "status": "succeeded",
    "reviewId": "6c9a2f13-0e8b-4d47-b1a5-8f3e2d0c7b96",
    "tool": "delete_procedure",
    "data": {
      "applied": true,
      "effect": "deleted_draft",
      "draftId": "playbook-draft:c0f7e3a5-21d8-4b9c-8e46-3a5b7d9f1c02",
      "deletedSkillDraftIds": ["skill-draft:c0f7e3a5-21d8-4b9c-8e46-3a5b7d9f1c02"],
      "retained": "Immutable compiled versions, releases and execution history",
      "receiptId": "<receiptId>"
    },
    "receipt": { "applied": true }
  }
}

deletedSkillDraftIds is the trigger removed with the procedure. The receipt is shortened here.

Errors

HTTP statuscodewhen
400INVALID_ARGUMENTSAn argument failed the schema, or the delete can't be prepared: no procedure has that id, expectedRevision isn't current, or the procedure is still live. message says which.
400CHATBOT_ID_REQUIREDchatbotId is missing or isn't a valid agent id.
403INSUFFICIENT_PERMISSIONThe key doesn't hold Change actions and procedures.
404CHATBOT_NOT_FOUNDNo agent with that chatbotId in your workspace.
409STALE_REVIEWOn apply: the procedure changed after the review. Read it again and call the tool again.
409REVIEW_ALREADY_USED / REVIEW_EXPIREDOn apply: the review was used already, or more than 15 minutes passed.
429INTEGRATION_RATE_LIMIT_EXCEEDEDMore than 2,000 requests in 15 minutes for this key.
500TOOL_FAILEDThe tool failed on our side. Try again.

Authentication and plan errors are listed in Error Handling.

Explore the documentation