Skip to content
QwryAI
Documentation
Pages

Endpoints

Update an action

Change an Action's name, When to use, channels or settings, switch it on or off, or turn it on or off for one channel

build_action with an action_id changes an existing Action the way its editor saves it. Read the Action with Get an action, change what you need, and send the whole build back; settings you leave out of config keep their current values. The call returns a review; nothing changes until you apply it.

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

Other tools change one thing at a time:

ToUse
Switch an Action on or off on one channel, as each channel's Actions list doesset_action_channel
Pause or resume a published Action everywheretoggle_action
Edit fields of the stored definition directly, such as the inputs it collectspatch_action_config

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.
action_idstringYes, to change an ActionThe Action's id from automation_drafts or get_action_build. Leave it out to build a new Action.
typestringYesThe Action's type, as get_action_build returns it. It can't change.
namestringYesThe Action's name, 1 to 64 characters.
when_to_usestringNoWhen the agent uses it, up to 7,500 characters. Not needed when procedure_only is true.
when_not_to_usestringNoWhen the agent shouldn't use it, up to 2,000 characters.
procedure_onlybooleanNotrue makes it usable only from procedures.
channelsarrayNoWhere it can run: web, agent_page, email, whatsapp, facebook, instagram, telegram, tiktok, sms, slack, zendesk, zendesk-messaging, api, phone, android_sdk, ios_sdk. 1 to 20 values; the list replaces the current one.
configobjectNoThe type's settings. get_action_build_schema with the type lists them.
enablebooleanNoLead forms, tickets, live chat and Shopify Actions: switch it on or off.

Request example

Bash
curl -X POST 'https://api.qwryai.com/public/v1/tools/build_action' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "chatbotId": "YOUR_AGENT_ID",
    "action_id": "ACTION_ID",
    "type": "escalation",
    "name": "Create ticket",
    "when_to_use": "Use this when a customer reports a damaged or faulty item.",
    "channels": ["web", "agent_page", "email", "whatsapp"]
  }'

Response

The review

JSON
{
  "success": true,
  "data": {
    "status": "review_required",
    "reviewId": "1f6b9d24-8c3e-4a75-b0e2-7d9c5a3f1e86",
    "tool": "build_action",
    "changes": [
      {
        "title": "Change Create ticket Action: Create ticket",
        "before": {
          "type": "Create ticket",
          "name": "Create ticket",
          "when_to_use": "Use this when a customer reports a damaged or faulty item. First ask for their email address and what is wrong with the item, then create the ticket.",
          "procedure_only": false,
          "channels": ["api", "web", "agent_page", "email", "facebook", "instagram", "whatsapp"],
          "enabled": true,
          "platform": "qwryai",
          "details_collection": "conversation"
        },
        "after": {
          "type": "Create ticket",
          "name": "Create ticket",
          "when_to_use": "Use this when a customer reports a damaged or faulty item.",
          "procedure_only": false,
          "channels": ["web", "agent_page", "email", "whatsapp"],
          "enabled": true,
          "platform": "qwryai",
          "details_collection": "conversation"
        }
      }
    ],
    "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."
  }
}

The review shows the Action's settings before and after, with its type by name; config settings appear on both sides even when they don't change (shortened here).

After you apply it

Apply with POST https://api.qwryai.com/public/v1/reviews/{reviewId}/apply. data.data holds the Action's action_id and what to do next:

JSON
{
  "success": true,
  "data": {
    "status": "succeeded",
    "reviewId": "1f6b9d24-8c3e-4a75-b0e2-7d9c5a3f1e86",
    "tool": "build_action",
    "data": {
      "applied": true,
      "action_id": "action-draft:8c1e5b20-4a7d-4f3e-9b2c-6d0a1e7f3c58",
      "next": "Saved on the live agent."
    },
    "receipt": { "applied": true, "action_id": "action-draft:8c1e5b20-4a7d-4f3e-9b2c-6d0a1e7f3c58" }
  }
}

Errors

HTTP statuscodewhen
400INVALID_ARGUMENTSAn argument failed the schema, or the change can't be made: no Action has that id, the type doesn't match the Action, the Action already has these settings, or a patch_action_config targets an editor-built Action. 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.
404AUTOMATION_NOT_FOUNDtoggle_action: no draft or deployment with those ids.
409AUTOMATION_CONFLICTtoggle_action: the revision or sequence changed since you read them, or the Action is already in the state you asked for. Read get_automation_publication again.
409STALE_REVIEWOn apply: the Action changed after the review. Read it again and call the tool again.
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