Endpoints
Get a procedure
Read one procedure whole: its trigger, its steps, and the steps as a person reads them
get_automation_detail with kind set to playbook returns a procedure as the Procedures editor holds it: its name and description, its trigger (when to use it, the channels it runs on and any trigger chips), its steps in the format Create a procedure and Update a procedure take, and the same steps as numbered lines with Actions by name.
POST
https://api.qwryai.com/public/v1/tools/get_automation_detailAuthentication
Send your API key as Authorization: Bearer YOUR_API_KEY; it needs the Read actions and procedures permission. See Authentication.
Body parameters
| Name | Type | Required | Description |
|---|---|---|---|
chatbotId | string | Yes | The agent's id, from list_agents. |
kind | string | Yes | playbook. |
draftId | string | Yes | The procedure's id, from List procedures. |
offset | integer | Yes | Send 0. A procedure always comes back whole. |
Request example
curl -X POST 'https://api.qwryai.com/public/v1/tools/get_automation_detail' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"chatbotId": "YOUR_AGENT_ID", "kind": "playbook", "draftId": "PROCEDURE_ID", "offset": 0}'const response = await fetch(
"https://api.qwryai.com/public/v1/tools/get_automation_detail",
{
method: "POST",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
chatbotId: "YOUR_AGENT_ID",
kind: "playbook",
draftId: "PROCEDURE_ID",
offset: 0,
}),
}
);
const { data: procedure } = await response.json();
console.log(procedure.steps_readable.join("\n"));import requests
procedure = requests.post(
"https://api.qwryai.com/public/v1/tools/get_automation_detail",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"chatbotId": "YOUR_AGENT_ID", "kind": "playbook", "draftId": "PROCEDURE_ID", "offset": 0},
).json()["data"]Response
{
"success": true,
"data": {
"id": "playbook-draft:5a8d2c71-e94b-4f06-b3a2-7c1e0d9f4b68",
"revision": 1,
"updatedAt": "2026-11-30T18:47:24.973Z",
"kind": "playbook",
"name": "Lost loyalty card",
"description": "Handles a customer who says they lost their loyalty card: creates a ticket and arranges a replacement.",
"trigger": {
"whenToUse": "The customer says they lost their loyalty card.",
"channels": ["widget", "conversation", "email", "whatsapp"]
},
"steps": [
{ "kind": "instruction", "text": "Ask the customer for their loyalty card number and their email address." },
{ "kind": "instruction", "text": "Create a ticket for the lost loyalty card with [[action:create_ticket:2b7d9e41-0c3a-4e65-8f19-a4d2c6b8e017]]." },
{ "kind": "instruction", "text": "Tell the customer their ticket number is [[action:create_ticket:2b7d9e41-0c3a-4e65-8f19-a4d2c6b8e017#ticketId]]." },
{
"kind": "branch",
"branches": [
{
"condition": "The customer wants the new card posted to them",
"steps": [{ "kind": "instruction", "text": "Confirm their postal address." }]
}
],
"otherwise": [{ "kind": "instruction", "text": "Tell them they can collect it in store." }]
},
{ "kind": "message", "text": "Your new card will be ready in 5 working days, {{contact.first_name|there}}." }
],
"steps_readable": [
"1. Ask the customer for their loyalty card number and their email address.",
"2. Create a ticket for the lost loyalty card with @Create ticket.",
"3. Tell the customer their ticket number is @Create ticket → ticketId.",
"4. If The customer wants the new card posted to them:",
" - Confirm their postal address.",
" Otherwise:",
" - Tell them they can collect it in store.",
"5. Send message: Your new card will be ready in 5 working days, {{contact.first_name|there}}."
],
"url": "/<workspace>/<agentId>/ai-actions/playbooks/playbook-draft%3A5a8d2c71-e94b-4f06-b3a2-7c1e0d9f4b68",
"surface": "draft_not_publication"
}
}| Field | Type | Description |
|---|---|---|
id | string | The procedure's id. |
revision | integer | The saved revision. Send it as expectedRevision when you delete or pause. |
name, description | string | The name and description. description is left out when empty. |
trigger | object | whenToUse (the customer request that starts it) and channels, plus any trigger chips: noReply, repeat, schedules, api, ticketOpened, ticketClosed. null until a trigger is saved. |
steps | array | Each step is { "kind": "instruction", "text" }, { "kind": "message", "text", "subject"? } or a branch with branches (condition, steps) and otherwise. In text, [[actionId]] runs an Action, [[actionId#field]] uses a field of its result, and {{contact.email}} is a variable. |
steps_readable | array | The steps as numbered lines, with Actions by name. |
url | string | The procedure's page in the dashboard, relative to https://www.qwryai.com. |
surface | string | Always draft_not_publication: this is the saved draft. status in List procedures says whether it's live. |
Errors
| HTTP status | code | when |
|---|---|---|
| 400 | INVALID_ARGUMENTS | kind, draftId or offset is missing or invalid. |
| 400 | CHATBOT_ID_REQUIRED | chatbotId is missing or isn't a valid agent id. |
| 403 | INSUFFICIENT_PERMISSION | The key doesn't hold Read actions and procedures. |
| 404 | CHATBOT_NOT_FOUND | No agent with that chatbotId in your workspace. |
| 409 | VALIDATION_INVALID_BODY | No procedure has that id in this agent. message says so. |
| 413 | RESULT_TOO_LARGE | The procedure is over 40,000 bytes. |
| 429 | INTEGRATION_RATE_LIMIT_EXCEEDED | More than 2,000 requests in 15 minutes for this key. |
| 500 | TOOL_FAILED | The tool failed on our side. Try again. |
Authentication and plan errors are listed in Error Handling.