# Get an action > Read one Action: when the agent uses it, the channels it runs on, its settings, and whether it's live `get_action_build` returns an Action the way its editor shows it: its type, name, **When to use**, whether it runs only inside procedures, its channels and its settings, plus whether it's live. Pass back the same shape to [Update an action](/docs/api-reference/v2/actions/update-an-action). For the full stored definition, including the inputs the Action collects, `get_automation_detail` returns it as JSON in pages. ```http POST https://api.qwryai.com/public/v1/tools/get_action_build ``` ## Authentication Send your API key as `Authorization: Bearer YOUR_API_KEY`; it needs the **Read actions and procedures** permission. See [Authentication](/docs/api-reference/v2/authentication). ## Body parameters | Name | Type | Required | Description | | - | - | - | - | | `chatbotId` | `string` | Yes | The agent's id, from `list_agents`. | | `action_id` | `string` | Yes | The Action's `id` from [List actions](/docs/api-reference/v2/actions/list-actions). Its `actionId` reference works too. | ### The full definition `get_automation_detail` takes `chatbotId`, `kind: "ai_action"`, `draftId` (the Action's `id`) and `offset`. It returns the Action's definition as a JSON string, `specJson`, 8,000 characters at a time, with `revision`, `contentHash`, `nextOffset` and `totalCharacters`. Start at `0`, then send each `nextOffset` with `expectedHash` set to the `contentHash` until `nextOffset` is `null`. The inputs the Action collects are in the definition's `contract.inputSchema`. ## Request example > [tab] cURL > > ```bash > curl -X POST 'https://api.qwryai.com/public/v1/tools/get_action_build' \ > -H 'Authorization: Bearer YOUR_API_KEY' \ > -H 'Content-Type: application/json' \ > -d '{"chatbotId": "YOUR_AGENT_ID", "action_id": "ACTION_ID"}' > ``` > [tab] JavaScript > > ```javascript > const response = await fetch( > "https://api.qwryai.com/public/v1/tools/get_action_build", > { > method: "POST", > headers: { > Authorization: "Bearer YOUR_API_KEY", > "Content-Type": "application/json", > }, > body: JSON.stringify({ chatbotId: "YOUR_AGENT_ID", action_id: "ACTION_ID" }), > } > ); > const { data } = await response.json(); > console.log(data.build.when_to_use, data.build.channels, data.enabled); > ``` > [tab] Python > > ```python > import requests > > response = requests.post( > "https://api.qwryai.com/public/v1/tools/get_automation_detail", > headers={"Authorization": "Bearer YOUR_API_KEY"}, > json={"chatbotId": "YOUR_AGENT_ID", "kind": "ai_action", "draftId": "ACTION_ID", "offset": 0}, > ) > page = response.json()["data"] > spec_text, offset = page["specJson"], page["nextOffset"] > while offset is not None: > page = requests.post( > "https://api.qwryai.com/public/v1/tools/get_automation_detail", > headers={"Authorization": "Bearer YOUR_API_KEY"}, > json={"chatbotId": "YOUR_AGENT_ID", "kind": "ai_action", "draftId": "ACTION_ID", > "offset": offset, "expectedHash": page["contentHash"]}, > ).json()["data"] > spec_text, offset = spec_text + page["specJson"], page["nextOffset"] > ``` ## Response ```json { "success": true, "data": { "action_id": "action-draft:8c1e5b20-4a7d-4f3e-9b2c-6d0a1e7f3c58", "buildable": true, "build": { "type": "escalation", "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"], "config": { "platform": "qwryai", "details_collection": "conversation", "ticket_fields": [], "tags": [], "messages": { "informationRequest": "Please share the details for your support request.", "queued": "An agent will be connected to the chat shortly.", "assigned": "A support agent has joined the conversation.", "cancelled": "Ticket creation dismissed", "timeout": "Waiting for support agent to join", "failure": "Unable to connect to support." } } }, "live": true, "enabled": true } } ``` | Field | Type | Description | | - | - | - | | `build.type` | `string` | The Action type, such as `custom_api`, `collect_leads`, `collect_data`, `escalation` (Create ticket), `live_chat`, `web_search`, `calendly` or `shopify`. | | `build.name` | `string` | The Action's name. | | `build.when_to_use` | `string` | When the agent uses it. | | `build.procedure_only` | `boolean` | `true` when only procedures can run it. | | `build.channels` | `array` | Where it can run. `web` is the Chat bubble, `agent_page` the Help Page and `facebook` Messenger; the others are `api`, `email`, `whatsapp`, `instagram`, `telegram`, `slack`, `phone`, `android_sdk`, `ios_sdk` and so on. | | `build.config` | `object` | The type's own settings. `get_action_build_schema` describes them for each type. | | `live` | `boolean` | Whether customers can use the saved version. Lead forms, tickets, live chat and Shopify Actions save live; editor-built Actions (API, widgets, forms, integrations) go live when published. | | `enabled` | `boolean` | Lead forms, tickets, live chat and Shopify Actions: whether it's switched on. | | `test_status` | `string` | Editor-built Actions only: the last endpoint test's result, or `not_run`. | | `pending_change_key` | `string` | Editor-built Actions only: the key of a saved change that isn't published yet, or `null`. | | `buildable` | `boolean` | `false` for an Action whose settings only its dashboard editor can change; `reason` says why. Read its definition with `get_automation_detail`. | ## Errors | HTTP status | code | when | | - | - | - | | 400 | `INVALID_ARGUMENTS` | `action_id` is missing, or a `get_automation_detail` argument is out of range. | | 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 Action has that id, or `get_automation_detail`'s `expectedHash` no longer matches because the Action changed. `message` says which; start again at offset `0`. | | 413 | `RESULT_TOO_LARGE` | The answer 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](/docs/api-reference/v2/error-handling).