> This is a page from the ElevenLabs documentation. For an index of the documentation, fetch https://elevenlabs.io/docs/llms.txt.

# Aggiorna override del chunking

PATCH https://api.elevenlabs.io/v1/convai/knowledge-base/{documentation_id}/chunking-override
Content-Type: application/json

Imposta o rimuovi l'override del chunking RAG per un documento o una cartella.

Reference: https://elevenlabs.io/docs/api-reference/knowledge-base/update-chunking-override

## Servers

- `https://api.elevenlabs.io` (Production, default)
- `https://api.us.elevenlabs.io` (Production US)
- `https://api.eu.residency.elevenlabs.io` (Production EU)
- `https://api.in.residency.elevenlabs.io` (Production India)
- `https://api.sg.residency.elevenlabs.io` (Production Singapore)

## Request

### Path parameters

- `documentation_id` (string, required) — L'ID di un documento della knowledge base. Viene restituito all'aggiunta del documento.

### Body (application/json)

This endpoint expects an UpdateDocumentChunkingOverrideRequestModel.

- `chunking_override` (ChunkingOverrideRequestModel, required, nullable) — Override del chunking RAG per un documento o una cartella. Null rimuove l'override, così si applicano le impostazioni predefinite degli elementi superiori e del modello di embedding.

## Response

### 200

Risposta riuscita

- `id` (string, required) — ID del documento o della cartella il cui override di chunking è stato aggiornato.
- `chunking_override` (ChunkingOverride, required, nullable) — L'override di chunking risultante. Null indica che l'entità eredita dagli elementi superiori o dal valore predefinito del modello di embedding.
- `reindex_queued` (boolean, required) — Indica se la configurazione effettiva è cambiata e se è stata messa in coda una reindicizzazione in background.

## Errors

### 422 Unprocessable Entity Error

Errore di convalida

- `detail` (list of ValidationError, optional)

## Types

### ChunkingOverrideRequestModel

- `max_chunk_size` (integer, optional, nullable) — Maximum chunk size in tokens. Null inherits from ancestors or the embedding model default.
- `overlap_percentage` (integer, optional, nullable) — Sovrapposizione dei chunk come percentuale della dimensione finale del chunk, applicata dopo che la dimensione del chunk è stata limitata in base al modello di embedding. Null eredita dagli elementi superiori o dal valore predefinito del modello di embedding.
- `custom_separators` (list of string, optional, nullable) — Separatori di testo personalizzati usati durante la suddivisione. Null eredita dagli elementi superiori; una lista vuota rimuove i separatori ereditati.

### ChunkingOverride

- `max_chunk_size` (integer, required, nullable) — Maximum chunk size in tokens. Null uses the inherited value.
- `overlap_percentage` (integer, required, nullable) — Sovrapposizione dei chunk come percentuale della dimensione del chunk. Null usa il valore ereditato.
- `custom_separators` (list of string, required, nullable) — Separatori di testo personalizzati usati durante la suddivisione. Null usa il valore ereditato.

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)

### ValidationErrorLocItems

- string
- integer

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "id": "21m00Tcm4TlvDq8ikWAM",
  "chunking_override": {
    "max_chunk_size": 800,
    "overlap_percentage": 10,
    "custom_separators": [
      "\n## "
    ]
  },
  "reindex_queued": true
}
```

**SDK Code**

```python
import requests

url = "https://api.elevenlabs.io/v1/convai/knowledge-base/21m00Tcm4TlvDq8ikWAM/chunking-override"

payload = {}
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript
const url = 'https://api.elevenlabs.io/v1/convai/knowledge-base/21m00Tcm4TlvDq8ikWAM/chunking-override';
const options = {method: 'PATCH', headers: {'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://api.elevenlabs.io/v1/convai/knowledge-base/21m00Tcm4TlvDq8ikWAM/chunking-override"

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

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

	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://api.elevenlabs.io/v1/convai/knowledge-base/21m00Tcm4TlvDq8ikWAM/chunking-override")

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

request = Net::HTTP::Patch.new(url)
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://api.elevenlabs.io/v1/convai/knowledge-base/21m00Tcm4TlvDq8ikWAM/chunking-override")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.elevenlabs.io/v1/convai/knowledge-base/21m00Tcm4TlvDq8ikWAM/chunking-override', [
  'body' => '{}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.elevenlabs.io/v1/convai/knowledge-base/21m00Tcm4TlvDq8ikWAM/chunking-override");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/convai/knowledge-base/21m00Tcm4TlvDq8ikWAM/chunking-override")! 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()
```