> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ada.cx/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ada.cx/_mcp/server.

# Update a custom instruction

PATCH https://example.ada.support/api/v2/custom-instructions/{custom_instruction_id}
Content-Type: application/json

Update a custom instruction. Only the fields provided in the request body are changed; omitted fields are left as they are.

Reference: https://docs.ada.cx/reference/custom-instructions/update-custom-instruction

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `custom_instruction_id` (string, required) — The id of the custom instruction

### Body (application/json)

This endpoint expects a CustomInstructionUpdate.

- `title` (string, optional) — Display name for the custom instruction (unique per Agent)
- `text` (string, optional) — The instruction content — the rule the Agent should follow
- `enabled` (boolean, optional) — Whether the instruction is enabled. False means inactive.
- `notes` (string, optional) — Internal notes about this instruction (not shown to the Agent). Send an empty string to blank it; omit it to leave the existing notes unchanged.
- `availability_rules` (string, optional, nullable) — Optional availability rule as a rule-expression string with `v("<variable_name>")` lookups. Send a non-empty string to set or replace it, `null` to clear it, or omit to leave it unchanged. A rule that references an unknown variable, or that is malformed or uses an unsupported operator, is rejected with 400.

## Response

### 200

OK

- `id` (string, required) — The unique identifier for the custom instruction
- `title` (string, required) — Display name for the custom instruction (unique per Agent)
- `text` (string, required) — The instruction content — the rule the Agent should follow
- `enabled` (boolean, required, default: false) — Whether the instruction is enabled. False means inactive.
- `notes` (string, optional, nullable) — Internal notes about this instruction (not shown to the Agent)
- `availability_rules` (string, optional, nullable) — Availability rule gating which end users this instruction applies to, as a rule-expression string with `v("<variable_name>")` variable lookups. `null` when no rule is set.

## Errors

### 400 Bad Request Error

Bad Request

- `errors` (list of ErrorsErrorsItems, required) — A list of errors

### 401 Unauthorized Error

Unauthorized

- `errors` (list of ErrorsErrorsItems, required) — A list of errors

### 404 Not Found Error

Not Found

- `errors` (list of ErrorsErrorsItems, required) — A list of errors

### 409 Conflict Error

Conflict — the new title is already used by another custom instruction, or enabling would exceed the AI Agent's enabled-instruction limit

- `errors` (list of ErrorsErrorsItems, required) — A list of errors

### 429 Too Many Requests Error

Too Many Requests

- `errors` (list of ErrorsErrorsItems, required) — A list of errors

### 500 Internal Server Error

Internal Server Error

- `errors` (list of ErrorsErrorsItems, required) — A list of errors

## Types

### ErrorsErrorsItems

- `type` (string, required) — The error type
- `message` (string, required) — The error message
- `details` (string, optional, nullable) — Extra information about the error

## Examples

**Request**

```json
{
  "text": "Always confirm the order number and the amount before issuing a refund."
}
```

**Response**

```json
{
  "id": "65a17e3f43bec88e2792d0eb",
  "title": "Refund policy",
  "text": "Always confirm the order number before issuing a refund.",
  "enabled": true,
  "notes": "Reviewed by the CX team."
}
```

**SDK Code**

```python
import requests

url = "https://example.ada.support/api/v2/custom-instructions/custom_instruction_id"

payload = { "text": "Always confirm the order number and the amount before issuing a refund." }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://example.ada.support/api/v2/custom-instructions/custom_instruction_id';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"text":"Always confirm the order number and the amount before issuing a refund."}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://example.ada.support/api/v2/custom-instructions/custom_instruction_id"

	payload := strings.NewReader("{\n  \"text\": \"Always confirm the order number and the amount before issuing a refund.\"\n}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://example.ada.support/api/v2/custom-instructions/custom_instruction_id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"text\": \"Always confirm the order number and the amount before issuing a refund.\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://example.ada.support/api/v2/custom-instructions/custom_instruction_id")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"text\": \"Always confirm the order number and the amount before issuing a refund.\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://example.ada.support/api/v2/custom-instructions/custom_instruction_id', [
  'body' => '{
  "text": "Always confirm the order number and the amount before issuing a refund."
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://example.ada.support/api/v2/custom-instructions/custom_instruction_id");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"text\": \"Always confirm the order number and the amount before issuing a refund.\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["text": "Always confirm the order number and the amount before issuing a refund."] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://example.ada.support/api/v2/custom-instructions/custom_instruction_id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```