> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chataigne.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# AI clerk instructions

> Read and update restaurant-specific guidance used in customer conversations.

AI clerk instructions let a location provide additional restaurant-specific guidance for customer conversations. Use them for stable information or policies that the AI clerk should take into account.

| Action | Endpoint                                            | Permission |
| ------ | --------------------------------------------------- | ---------- |
| Read   | `GET /v1/locations/{location_id}/ai_instructions`   | `ai.read`  |
| Update | `PATCH /v1/locations/{location_id}/ai_instructions` | `ai.write` |

## Read the current instructions

```bash theme={null}
curl https://server.chataigne.ai/v1/locations/loc_r8v4n2c6tz/ai_instructions \
  -H "x-api-key: $CHATAIGNE_API_KEY"
```

## Update the instructions

<Warning>
  `chatbot_instructions` completely replaces the currently stored instructions. The new value is not
  merged with the previous one. Read the current instructions first and send the complete version
  that the AI clerk should use.
</Warning>

```bash theme={null}
curl https://server.chataigne.ai/v1/locations/loc_r8v4n2c6tz/ai_instructions \
  -X PATCH \
  -H "x-api-key: $CHATAIGNE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "chatbot_instructions": "Tell customers that the terrace is not reservable. For groups of eight or more, ask them to call the restaurant."
  }'
```

`PATCH` preserves omitted fields. Send `null` to clear `chatbot_instructions`. A replacement must be a non-blank string of at most 10,000 characters.

The response contains the new instructions together with the value that was active immediately before the update:

```json theme={null}
{
  "object": "ai_instructions",
  "location_id": "loc_r8v4n2c6tz",
  "previous_chatbot_instructions": "Always introduce the daily special first.",
  "chatbot_instructions": "Tell customers that the terrace is not reservable. For groups of eight or more, ask them to call the restaurant."
}
```

Keep this response if your integration may need to undo the update. To roll back, send the value of `previous_chatbot_instructions` in a new `PATCH` request.
