curl --request PUT \
--url https://realtime-api.voiceflow.com/v1alpha1/public/knowledge-base/document/{documentID} \
--header 'Content-Type: application/json' \
--header 'authorization: <api-key>' \
--data '
{
"data": {
"type": "url",
"url": "<string>",
"name": "<string>",
"folderID": "<string>",
"documentMetadata": [
{
"key": "<string>",
"values": [
"<string>"
]
}
],
"metadata": {},
"projectEnvironmentIDOrAlias": "<string>"
}
}
'import requests
url = "https://realtime-api.voiceflow.com/v1alpha1/public/knowledge-base/document/{documentID}"
payload = { "data": {
"type": "url",
"url": "<string>",
"name": "<string>",
"folderID": "<string>",
"documentMetadata": [
{
"key": "<string>",
"values": ["<string>"]
}
],
"metadata": {},
"projectEnvironmentIDOrAlias": "<string>"
} }
headers = {
"authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: {
type: 'url',
url: '<string>',
name: '<string>',
folderID: '<string>',
documentMetadata: [{key: '<string>', values: ['<string>']}],
metadata: {},
projectEnvironmentIDOrAlias: '<string>'
}
})
};
fetch('https://realtime-api.voiceflow.com/v1alpha1/public/knowledge-base/document/{documentID}', 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://realtime-api.voiceflow.com/v1alpha1/public/knowledge-base/document/{documentID}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'type' => 'url',
'url' => '<string>',
'name' => '<string>',
'folderID' => '<string>',
'documentMetadata' => [
[
'key' => '<string>',
'values' => [
'<string>'
]
]
],
'metadata' => [
],
'projectEnvironmentIDOrAlias' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"authorization: <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://realtime-api.voiceflow.com/v1alpha1/public/knowledge-base/document/{documentID}"
payload := strings.NewReader("{\n \"data\": {\n \"type\": \"url\",\n \"url\": \"<string>\",\n \"name\": \"<string>\",\n \"folderID\": \"<string>\",\n \"documentMetadata\": [\n {\n \"key\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"metadata\": {},\n \"projectEnvironmentIDOrAlias\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("authorization", "<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.put("https://realtime-api.voiceflow.com/v1alpha1/public/knowledge-base/document/{documentID}")
.header("authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"type\": \"url\",\n \"url\": \"<string>\",\n \"name\": \"<string>\",\n \"folderID\": \"<string>\",\n \"documentMetadata\": [\n {\n \"key\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"metadata\": {},\n \"projectEnvironmentIDOrAlias\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://realtime-api.voiceflow.com/v1alpha1/public/knowledge-base/document/{documentID}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": {\n \"type\": \"url\",\n \"url\": \"<string>\",\n \"name\": \"<string>\",\n \"folderID\": \"<string>\",\n \"documentMetadata\": [\n {\n \"key\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"metadata\": {},\n \"projectEnvironmentIDOrAlias\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"documentID": "<string>",
"data": {
"type": "url",
"name": "<string>",
"url": "<string>",
"lastSuccessUpdate": "<string>",
"accessTokenID": 123,
"integrationExternalID": "<string>"
},
"updatedAt": "2023-11-07T05:31:56Z",
"status": {
"data": "<unknown>"
}
}
}Replace document
Replaces the target document with the provided content. Supports both application/json and multipart/form-data content types.
curl --request PUT \
--url https://realtime-api.voiceflow.com/v1alpha1/public/knowledge-base/document/{documentID} \
--header 'Content-Type: application/json' \
--header 'authorization: <api-key>' \
--data '
{
"data": {
"type": "url",
"url": "<string>",
"name": "<string>",
"folderID": "<string>",
"documentMetadata": [
{
"key": "<string>",
"values": [
"<string>"
]
}
],
"metadata": {},
"projectEnvironmentIDOrAlias": "<string>"
}
}
'import requests
url = "https://realtime-api.voiceflow.com/v1alpha1/public/knowledge-base/document/{documentID}"
payload = { "data": {
"type": "url",
"url": "<string>",
"name": "<string>",
"folderID": "<string>",
"documentMetadata": [
{
"key": "<string>",
"values": ["<string>"]
}
],
"metadata": {},
"projectEnvironmentIDOrAlias": "<string>"
} }
headers = {
"authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: {
type: 'url',
url: '<string>',
name: '<string>',
folderID: '<string>',
documentMetadata: [{key: '<string>', values: ['<string>']}],
metadata: {},
projectEnvironmentIDOrAlias: '<string>'
}
})
};
fetch('https://realtime-api.voiceflow.com/v1alpha1/public/knowledge-base/document/{documentID}', 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://realtime-api.voiceflow.com/v1alpha1/public/knowledge-base/document/{documentID}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'type' => 'url',
'url' => '<string>',
'name' => '<string>',
'folderID' => '<string>',
'documentMetadata' => [
[
'key' => '<string>',
'values' => [
'<string>'
]
]
],
'metadata' => [
],
'projectEnvironmentIDOrAlias' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"authorization: <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://realtime-api.voiceflow.com/v1alpha1/public/knowledge-base/document/{documentID}"
payload := strings.NewReader("{\n \"data\": {\n \"type\": \"url\",\n \"url\": \"<string>\",\n \"name\": \"<string>\",\n \"folderID\": \"<string>\",\n \"documentMetadata\": [\n {\n \"key\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"metadata\": {},\n \"projectEnvironmentIDOrAlias\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("authorization", "<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.put("https://realtime-api.voiceflow.com/v1alpha1/public/knowledge-base/document/{documentID}")
.header("authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"type\": \"url\",\n \"url\": \"<string>\",\n \"name\": \"<string>\",\n \"folderID\": \"<string>\",\n \"documentMetadata\": [\n {\n \"key\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"metadata\": {},\n \"projectEnvironmentIDOrAlias\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://realtime-api.voiceflow.com/v1alpha1/public/knowledge-base/document/{documentID}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": {\n \"type\": \"url\",\n \"url\": \"<string>\",\n \"name\": \"<string>\",\n \"folderID\": \"<string>\",\n \"documentMetadata\": [\n {\n \"key\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"metadata\": {},\n \"projectEnvironmentIDOrAlias\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"documentID": "<string>",
"data": {
"type": "url",
"name": "<string>",
"url": "<string>",
"lastSuccessUpdate": "<string>",
"accessTokenID": 123,
"integrationExternalID": "<string>"
},
"updatedAt": "2023-11-07T05:31:56Z",
"status": {
"data": "<unknown>"
}
}
}Authorizations
Voiceflow API key
Headers
Path Parameters
ID of the document to target.
Query Parameters
Determines how granularly each document is broken up. Range available is 500-1500 tokens, default is 1000. Smaller chunk size means narrower context, faster response, less tokens consumed, and greater risk of less accurate answers. Max chunk size affects the total amount of chunks parsed from a document - i.e., larger chunks means less chunks retrieved.
Body
Hide child attributes
Hide child attributes
url daily, weekly, monthly, never An array of document metadata fields.
💡 Tip: This metadata can be used in agent KB metadata filter conditions. Learn more about metadata filtering.
The alias of the environment to target (ie. main). You can find this in the environments page of your agent.
💡 Tip: Learn more about Environments.
Response
The target document was successfully replaced.
Hide child attributes
Hide child attributes
Hide child attributes
Hide child attributes
url daily, weekly, monthly, never zendesk, shopify ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$Was this page helpful?