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"
}Update Document
Update a document’s document_name and tags.
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"
}https://docs.tavus.io/openapi.yaml for the full HTTP API contract.Authorizations
Path Parameters
The unique identifier of the document to update
Body
Response
Document updated successfully
Unique identifier for the document
"d8-5c71baca86fc"
Updated name of the document
"Updated Document Name"
URL of the document
"https://docs.example.com/"
Current status of the document processing. Possible values: started, processing, ready, error, recrawling.
started, processing, ready, error, recrawling "ready"
Processing progress as a percentage (0-100). Null when processing has not started or is complete.
null
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.
ISO 8601 timestamp of when the document was created
"2024-01-01T12:00:00Z"
ISO 8601 timestamp of when the document was last updated
"2024-01-01T13:00:00Z"
URL that receives status updates
"https://your-server.com/webhook"
Updated array of document tags
["docs", "website", "updated"]
The crawl configuration used for this document (only present for crawled websites)
Show child attributes
Show child attributes
List of URLs that were crawled (only present for crawled websites after processing completes)
[
"https://docs.example.com/",
"https://docs.example.com/getting-started",
"https://docs.example.com/api"
]
ISO 8601 timestamp of when the document was last crawled
"2024-01-01T12:00:00Z"
Number of times the document has been crawled
1

