# Update agent > Change an agent's instructions, model, guardrails, notifications and voice through reviewed tool calls Each area of an agent's settings has its own update tool, matching a page of the dashboard. Send only the fields you want to change; everything else keeps its value. An update never applies on the first call: it returns a **review** listing each change with its value before and after. Nothing changes until you apply the review with `POST /public/v1/reviews/{reviewId}/apply`. This page shows `update_instructions`. The [other update tools](#other-update-tools) work the same way. ```http POST https://api.qwryai.com/public/v1/tools/update_instructions ``` ## Authentication Send your API key as `Authorization: Bearer `, or in an `x-api-key` header. The key needs **Change agent settings**. See [Authentication](/docs/api-reference/v2/authentication). ## Body parameters | Name | Type | Required | Description | | - | - | - | - | | `chatbotId` | `string` | Yes | The agent's id, from [List agents](/docs/api-reference/v2/agents/list-agents). | | `expectedUpdatedAt` | `string` | Yes | The `updatedAt` you just read from `agent_configuration` or `get_chat_interface`. If the agent changed since, the review is refused. | | `changes` | `array` | One of `changes` or `channel_specific_instructions` | Up to 20 `{ "field", "value" }` items, one per field. See the fields below. | | `channel_specific_instructions` | `array` | One of `changes` or `channel_specific_instructions` | Up to 9 `{ "channel", "instructions", "voice_instructions" }` items that give one channel its own instructions. | `changes` fields: | `field` | `value` | | - | - | | `systemPrompt` | The agent's instructions, up to 12,000 characters. Send the complete new text. | | `behaviorSystemPrompt` | Behavior instructions, up to 12,000 characters. | | `guardrails` | Up to 20 rules, each up to 1,000 characters. Send the whole list. | | `requiredDisclaimers` | Up to 20 disclaimers, each up to 1,000 characters. Send the whole list. | `channel_specific_instructions` items: | Field | Description | | - | - | | `channel` | `chat_widget`, `center_stage`, `slack`, `whatsapp`, `messenger`, `instagram`, `zendesk`, `zendesk_messaging`, `api`, `phone`, `android_sdk` or `ios_sdk`. | | `instructions` | The channel's own instructions, up to 20,000 characters, used instead of the agent's instructions on that channel. `null` makes the channel use the agent's instructions again. | | `voice_instructions` | `chat_widget` and `center_stage` only: instructions for voice mode. `null` makes voice use the chat instructions again. | > [!TIP] > > Instructions can be long. Read them in full with `agent_instructions` before you replace them, so you don't lose what's already there. ## Request example > [tab] cURL > > ```bash > curl -X POST 'https://api.qwryai.com/public/v1/tools/update_instructions' \ > -H 'Authorization: Bearer YOUR_API_KEY' \ > -H 'Content-Type: application/json' \ > -d '{ > "chatbotId": "YOUR_AGENT_ID", > "expectedUpdatedAt": "2026-11-30T21:14:08.512Z", > "channel_specific_instructions": [ > { "channel": "whatsapp", "instructions": "Keep answers under three sentences and never use tables." } > ] > }' > > # Apply the review it returns > curl -X POST 'https://api.qwryai.com/public/v1/reviews/REVIEW_ID/apply' \ > -H 'Authorization: Bearer YOUR_API_KEY' > ``` > [tab] JavaScript > > ```javascript > const API = "https://api.qwryai.com/public/v1"; > const headers = { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json" }; > > const { data: config } = await fetch(`${API}/tools/agent_configuration`, { > method: "POST", headers, body: JSON.stringify({ chatbotId: "YOUR_AGENT_ID" }), > }).then((r) => r.json()); > > const { data: review } = await fetch(`${API}/tools/update_instructions`, { > method: "POST", > headers, > body: JSON.stringify({ > chatbotId: "YOUR_AGENT_ID", > expectedUpdatedAt: config.updatedAt, > channel_specific_instructions: [ > { channel: "whatsapp", instructions: "Keep answers under three sentences and never use tables." }, > ], > }), > }).then((r) => r.json()); > > console.log(review.changes); // show these to whoever approves > await fetch(`${API}/reviews/${review.reviewId}/apply`, { method: "POST", headers }); > ``` > [tab] Python > > ```python > import requests > > API = "https://api.qwryai.com/public/v1" > headers = {"Authorization": "Bearer YOUR_API_KEY"} > > config = requests.post(f"{API}/tools/agent_configuration", headers=headers, > json={"chatbotId": "YOUR_AGENT_ID"}).json()["data"] > > review = requests.post(f"{API}/tools/update_instructions", headers=headers, json={ > "chatbotId": "YOUR_AGENT_ID", > "expectedUpdatedAt": config["updatedAt"], > "channel_specific_instructions": [ > {"channel": "whatsapp", "instructions": "Keep answers under three sentences and never use tables."} > ], > }).json()["data"] > > print(review["changes"]) # show these to whoever approves > requests.post(f"{API}/reviews/{review['reviewId']}/apply", headers=headers) > ``` ## Response The update tool returns the review: ```json { "success": true, "data": { "status": "review_required", "reviewId": "4e1d7b0a-6c2f-4f93-8a15-2b9e0d3c7a64", "tool": "update_instructions", "changes": [ { "title": "WhatsApp: use global instructions", "before": null, "after": false }, { "title": "WhatsApp instructions", "before": null, "after": "Keep answers under three sentences and never use tables." } ], "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." } } ``` Applying it returns what was saved: ```json { "success": true, "data": { "status": "succeeded", "reviewId": "4e1d7b0a-6c2f-4f93-8a15-2b9e0d3c7a64", "tool": "update_instructions", "data": { "operationId": "4e1d7b0a-6c2f-4f93-8a15-2b9e0d3c7a64", "chatbotId": "YOUR_AGENT_ID", "updatedAt": "2026-11-30T21:14:08.512Z", "fields": [], "applied": true, "drafted": ["ui.channels.whatsapp.syncGlobalInstructions", "ui.channels.whatsapp.instructions"], "coverage": "Saved to the agent draft. Customers keep the live settings until the draft is published." }, "receipt": { "applied": true, "drafted": ["ui.channels.whatsapp.syncGlobalInstructions", "ui.channels.whatsapp.instructions"], "current": { "exists": true, "fields": { "ui.channels.whatsapp.syncGlobalInstructions": false, "ui.channels.whatsapp.instructions": "Keep answers under three sentences and never use tables." } }, "matchesApprovedFields": true, "coverage": "Saved to the agent draft. Customers keep the live settings until the draft is published." } } } ``` | Field | Description | | - | - | | `changes` | Each change's `title`, `before` and `after`, for a person to approve. | | `unchanged` | Fields you sent that already had that value. | | `expiresAt` | The review works once, for this key, until this time: 15 minutes. | | `data.drafted` | Settings saved to the agent's draft. Customers get them once you publish the draft with `publish_draft` or in the dashboard. | Instructions, guardrails, the model, channel instructions and the Chat bubble's text and look save to the draft, as they do in the dashboard. `behaviorSystemPrompt`, `requiredDisclaimers`, the rate limit, spam detection, blocked countries, notification emails and **Voice** page settings go live as soon as the review is applied. See [Drafts and publishing](/docs/user-guides/chatbot/drafts-and-publishing). ## Other update tools Each takes `chatbotId` and needs **Change agent settings**. All but the notification and voice tools also need `expectedUpdatedAt`. | Tool | Changes | Arguments | | - | - | - | | `update_model` | The model and how it answers | `changes`: `responseModel`, `temperature` (0 to 2), `maxTokens` (1 to 32,000), `citationsEnabled`, `backstageModel`, `apiChannelModel`, `androidSdkModel`, `iosSdkModel`. Model values come from `list_available_models`. | | `update_chat_interface` | The Chat bubble's text and behaviour | `changes` such as `displayName`, `messagePlaceholder`, `welcomeMessages`, `suggestions`, `aiChat` and the `centerStage*` fields. | | `update_styles` | The Chat bubble's look | See [Update agent styles](/docs/api-reference/v2/agents/update-agent-styles). | | `update_rate_limit` | **Guardrails › Rate limit** | `rate_limit`: `messages` (1 to 200), `seconds` (1 to 3,600) and `message`. | | `update_spam_detection` | **Guardrails** spam detection | `spam_settings`: `{ "enabled", "prompt" }`, or `null` to turn it off. | | `update_country_blocking` | **Guardrails** blocked countries | `blocked_countries`: the complete list of ISO country codes, such as `["RU"]`; `null` or `[]` unblocks all. | | `update_notification_settings` | **Settings › Notifications** daily emails | `daily_conversations`, `daily_leads`: each `{ "active", "emails" }`, with up to 10 recipients. | | `update_voice_settings` | The **Voice** page | `pipeline`, `voice`, `transcriber_model`, `initial_message`, `error_message`, `allow_interruptions`, `recordings` and more. Needs a plan with voice. | ```bash curl -X POST 'https://api.qwryai.com/public/v1/tools/update_model' \ -H 'Authorization: Bearer YOUR_API_KEY' \ -H 'Content-Type: application/json' \ -d '{ "chatbotId": "YOUR_AGENT_ID", "expectedUpdatedAt": "2026-11-30T21:14:08.512Z", "changes": [{ "field": "temperature", "value": 0.5 }] }' ``` ## Errors | HTTP status | Code | When | | - | - | - | | 400 | `INVALID_ARGUMENTS` | A field is unknown, repeated or out of range, or neither `changes` nor `channel_specific_instructions` was sent. `issues` lists each problem. | | 400 | `CHATBOT_ID_REQUIRED` | The body has no valid `chatbotId`. | | 400 | `TOO_MANY_CHANGES` | More than 20 changes in one review. | | 401 | `API_KEY_REQUIRED` / `INVALID_API_KEY` | No credential, or an unknown, deleted or expired one. | | 403 | `INSUFFICIENT_PERMISSION` | The key doesn't hold **Change agent settings**. | | 404 | `CHATBOT_NOT_FOUND` | No agent with that `chatbotId` in your workspace. | | 404 | `REVIEW_NOT_FOUND` | Applying: no review with that id for this key. | | 409 | `NOTHING_TO_CHANGE` | Every value you sent is already set. | | 409 | `STALE_CONFIGURATION` | `expectedUpdatedAt` isn't the agent's current `updatedAt`. Read it again. | | 409 | `STALE_REVIEW` | Applying: the agent changed after the review. Call the tool again. | | 409 | `REVIEW_EXPIRED` / `REVIEW_ALREADY_USED` | Applying: the review is over 15 minutes old, or was already applied. | | 429 | `INTEGRATION_RATE_LIMIT_EXCEEDED` | More than 2,000 requests in 15 minutes. | See [Error Handling](/docs/api-reference/v2/error-handling) for every code.