Update Document
curl --request PATCH \
--url https://tavusapi.com/v2/documents/{document_id} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"document_name": "Updated Document Name",
"tags": [
"docs",
"website",
"updated"
]
}
'import requests
url = "https://tavusapi.com/v2/documents/{document_id}"
payload = {
"document_name": "Updated Document Name",
"tags": ["docs", "website", "updated"]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({document_name: 'Updated Document Name', tags: ['docs', 'website', 'updated']})
};
fetch('https://tavusapi.com/v2/documents/{document_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://tavusapi.com/v2/documents/{document_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'document_name' => 'Updated Document Name',
'tags' => [
'docs',
'website',
'updated'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://tavusapi.com/v2/documents/{document_id}"
payload := strings.NewReader("{\n \"document_name\": \"Updated Document Name\",\n \"tags\": [\n \"docs\",\n \"website\",\n \"updated\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://tavusapi.com/v2/documents/{document_id}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"document_name\": \"Updated Document Name\",\n \"tags\": [\n \"docs\",\n \"website\",\n \"updated\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://tavusapi.com/v2/documents/{document_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"document_name\": \"Updated Document Name\",\n \"tags\": [\n \"docs\",\n \"website\",\n \"updated\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"document_id": "d8-5c71baca86fc",
"document_name": "Updated Document Name",
"document_url": "https://docs.example.com/",
"status": "ready",
"progress": null,
"error_message": "<string>",
"created_at": "2024-01-01T12:00:00Z",
"updated_at": "2024-01-01T13:00:00Z",
"callback_url": "https://your-server.com/webhook",
"tags": [
"docs",
"website",
"updated"
],
"crawl_config": {
"depth": 2,
"max_pages": 10
},
"crawled_urls": [
"https://docs.example.com/",
"https://docs.example.com/getting-started",
"https://docs.example.com/api"
],
"last_crawled_at": "2024-01-01T12:00:00Z",
"crawl_count": 1
}{
"error": "Invalid request: document_name must be a string"
}{
"message": "Invalid access token"
}{
"message": "Document not found"
}Knowledge Base
Update Document
Update a document’s document_name and tags.
PATCH
/
v2
/
documents
/
{document_id}
Update Document
curl --request PATCH \
--url https://tavusapi.com/v2/documents/{document_id} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"document_name": "Updated Document Name",
"tags": [
"docs",
"website",
"updated"
]
}
'import requests
url = "https://tavusapi.com/v2/documents/{document_id}"
payload = {
"document_name": "Updated Document Name",
"tags": ["docs", "website", "updated"]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({document_name: 'Updated Document Name', tags: ['docs', 'website', 'updated']})
};
fetch('https://tavusapi.com/v2/documents/{document_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://tavusapi.com/v2/documents/{document_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'document_name' => 'Updated Document Name',
'tags' => [
'docs',
'website',
'updated'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://tavusapi.com/v2/documents/{document_id}"
payload := strings.NewReader("{\n \"document_name\": \"Updated Document Name\",\n \"tags\": [\n \"docs\",\n \"website\",\n \"updated\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://tavusapi.com/v2/documents/{document_id}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"document_name\": \"Updated Document Name\",\n \"tags\": [\n \"docs\",\n \"website\",\n \"updated\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://tavusapi.com/v2/documents/{document_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"document_name\": \"Updated Document Name\",\n \"tags\": [\n \"docs\",\n \"website\",\n \"updated\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"document_id": "d8-5c71baca86fc",
"document_name": "Updated Document Name",
"document_url": "https://docs.example.com/",
"status": "ready",
"progress": null,
"error_message": "<string>",
"created_at": "2024-01-01T12:00:00Z",
"updated_at": "2024-01-01T13:00:00Z",
"callback_url": "https://your-server.com/webhook",
"tags": [
"docs",
"website",
"updated"
],
"crawl_config": {
"depth": 2,
"max_pages": 10
},
"crawled_urls": [
"https://docs.example.com/",
"https://docs.example.com/getting-started",
"https://docs.example.com/api"
],
"last_crawled_at": "2024-01-01T12:00:00Z",
"crawl_count": 1
}{
"error": "Invalid request: document_name must be a string"
}{
"message": "Invalid access token"
}{
"message": "Document not found"
}For AI agents, use
https://docs.tavus.io/openapi.yaml for the full HTTP API contract.Body
application/json
Response
Document updated successfully
Error code indicating why processing failed. Only present when status is error. Possible values include: file_download_failed, file_format_unsupported, file_size_too_large, file_empty, invalid_file_url, document_processing_failed, website_processing_failed, chunking_failed, embedding_failed, vector_store_failed, contact_support.

