> 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 knowledge source

PATCH https://example.ada.support/api/v2/knowledge/sources/{id}
Content-Type: application/json

Update a knowledge source

Reference: https://docs.ada.cx/reference/knowledge/sources/update

## Authentication

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

## Request

### Path parameters

- `id` (string, required) — id of the knowledge source to update

### Body (application/json)

This endpoint expects a KnowledgeSourceUpdateRequest.

- `external_id` (string, optional, nullable) — A unique identifier for the knowledge source
- `name` (string, optional) — The name of the knowledge source
- `metadata` (KnowledgeSourceUpdateRequestMetadata, optional, nullable) — A dictionary of arbitrary key,value pairs. This data is not used by Ada, but can be used by the client to store additional information about the knowledge source.
- `sync_frequency` (enum, optional) — The sync frequency for web scraper knowledge sources. Controls how often the source URLs are re-crawled.
  - Allowed values: `daily`, `weekly`, `never`
- `availability_rules` (AvailabilityRule, optional, nullable) — Replace the source's availability-rule template. Articles created after the change get the new template. Existing articles keep their own rules. Send `null` to remove the template. Omit to leave it unchanged.

## Response

### 200

Knowledge source updated

- `id` (string, required) — A unique identifier for the knowledge source
- `name` (string, required) — The name of the knowledge source
- `availability_rules` (AvailabilityRule, required, nullable) — The source's availability-rule template. Each new article created under the source whose request omits `availability_rules` gets it. `null` when the source has none.
- `external_id` (string, optional, nullable) — An external identifier for the knowledge source
- `metadata` (KnowledgeSourceResponseMetadata, optional, nullable) — A dictionary of arbitrary key,value pairs. This data is not used by Ada, but can be used by the client to store additional information about the knowledge source.
- `created` (string, optional) — The date the knowledge source was created
- `updated` (string, optional) — The date the knowledge source was last updated
- `last_sync` (string, optional) — The date the knowledge source was last synchronized
- `status` (enum, optional) — Deletion lifecycle status of the knowledge source: `deleting` while an asynchronous deletion is in progress, `delete_failed` if the deletion failed. `null` when no deletion is in progress.
  - Allowed values: `deleting`, `delete_failed`

## 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

### 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

### KnowledgeSourceUpdateRequestMetadata

A dictionary of arbitrary key,value pairs. This data is not used by Ada, but can be used by the client to store additional information about the knowledge source.

### AvailabilityRule

A two-level tree of conditions that determines availability based on variable values during a conversation. The root group has a `match` combinator and a list of conditions or condition groups. A rule may contain at most 1000 conditions in total, counting every condition across the root and all nested condition groups.

- `match` (enum, required) — Whether all conditions must pass (`all`) or any one condition must pass (`any`).
  - Allowed values: `all`, `any`
- `conditions` (list of AvailabilityRuleConditionsItems, required) — List of conditions or condition groups. Must contain at least one entry. Each entry is either a `Condition` object (with `variable`, `operator`, and optional `value`) or a `ConditionGroup` object (with its own `match` and nested `conditions` list).

### KnowledgeSourceResponseMetadata

A dictionary of arbitrary key,value pairs. This data is not used by Ada, but can be used by the client to store additional information about the knowledge source.

### ErrorsErrorsItems

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

### AvailabilityRuleConditionsItems

### AvailabilityRuleCondition

A single condition comparing a variable to a value.

- `variable` (AvailabilityRuleConditionVariable, required) — The variable to test, referenced by `id`. Look up the ids for your Agent through the variables endpoint. Not every variable can be used in a rule; referencing one that can't returns a `400`.
- `operator` (enum, required) — The comparison operator. Unary operators (`is_set`, `is_not_set`) must not include a `value` field.
  - Allowed values: `equals`, `does_not_equal`, `greater_than`, `less_than`, `starts_with`, `ends_with`, `contains`, `does_not_contain`, `is_set`, `is_not_set`
- `value` (AvailabilityRuleConditionValue, optional) — The value to compare against. Omit for unary operators (`is_set`, `is_not_set`).
- `case_sensitive` (boolean, optional) — Whether the comparison is case-sensitive. Defaults to `false`. Only meaningful for the equality (`equals`, `does_not_equal`) and string (`starts_with`, `ends_with`, `contains`, `does_not_contain`) operators. Omitted from responses when `false`.

### AvailabilityRuleConditionGroup

A nested group of conditions inside a rule's top-level `conditions` list. Condition groups may contain only `Condition` objects — further nesting is not supported.

- `match` (enum, required) — Whether all conditions must pass (`all`) or any one condition must pass (`any`).
  - Allowed values: `all`, `any`
- `conditions` (list of AvailabilityRuleCondition, required) — List of conditions inside this condition group. Must contain at least one entry.

### AvailabilityRuleConditionVariable

The variable to test, referenced by `id`. Look up the ids for your Agent through the variables endpoint. Not every variable can be used in a rule; referencing one that can't returns a `400`.

- `id` (string, required) — The id of the variable.

### AvailabilityRuleConditionValue

The value to compare against. Omit for unary operators (`is_set`, `is_not_set`).

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "id": "5df263b7db5a7e6ea03fae9b",
  "name": "Ada Knowledge Base",
  "availability_rules": {
    "match": "all",
    "conditions": [
      {
        "variable": {
          "id": "5df263b7db5a7e6ea03fae9b"
        },
        "operator": "equals",
        "value": "en"
      }
    ]
  },
  "external_id": "external_id_1",
  "metadata": {
    "example_key1": "example_string_value",
    "example_key2": true,
    "example_key3": 123
  },
  "created": "2020-09-20T00:00:00+00:00",
  "updated": "2020-09-20T00:00:00+00:00",
  "last_sync": "2020-09-20T00:00:00+00:00",
  "status": "deleting"
}
```

**SDK Code**

```python
import requests

url = "https://example.ada.support/api/v2/knowledge/sources/id"

payload = {}
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/knowledge/sources/id';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{}'
};

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/knowledge/sources/id"

	payload := strings.NewReader("{}")

	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/knowledge/sources/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 = "{}"

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/knowledge/sources/id")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://example.ada.support/api/v2/knowledge/sources/id', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://example.ada.support/api/v2/knowledge/sources/id");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://example.ada.support/api/v2/knowledge/sources/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()
```