Skip to main content
PATCH
/
v1alpha1
/
public
/
knowledge-base
/
document
/
{documentID}
Update document metadata
curl --request PATCH \
  --url https://realtime-api.voiceflow.com/v1alpha1/public/knowledge-base/document/{documentID} \
  --header 'Content-Type: knowledgeBase' \
  --header 'authorization: <api-key>' \
  --data '
{
  "data": {
    "documentMetadata": [
      {
        "key": "<string>",
        "values": [
          "<string>"
        ]
      }
    ],
    "metadata": {},
    "projectEnvironmentIDOrAlias": "<string>"
  }
}
'
import requests

url = "https://realtime-api.voiceflow.com/v1alpha1/public/knowledge-base/document/{documentID}"

payload = { "data": {
"documentMetadata": [
{
"key": "<string>",
"values": ["<string>"]
}
],
"metadata": {},
"projectEnvironmentIDOrAlias": "<string>"
} }
headers = {
"authorization": "<api-key>",
"Content-Type": "knowledgeBase"
}

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

print(response.text)
const options = {
method: 'PATCH',
headers: {authorization: '<api-key>', 'Content-Type': 'knowledgeBase'},
body: JSON.stringify({
data: {
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 => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'documentMetadata' => [
[
'key' => '<string>',
'values' => [
'<string>'
]
]
],
'metadata' => [

],
'projectEnvironmentIDOrAlias' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: knowledgeBase",
"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 \"documentMetadata\": [\n {\n \"key\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"metadata\": {},\n \"projectEnvironmentIDOrAlias\": \"<string>\"\n }\n}")

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

req.Header.Add("authorization", "<api-key>")
req.Header.Add("Content-Type", "knowledgeBase")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.patch("https://realtime-api.voiceflow.com/v1alpha1/public/knowledge-base/document/{documentID}")
.header("authorization", "<api-key>")
.header("Content-Type", "knowledgeBase")
.body("{\n \"data\": {\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::Patch.new(url)
request["authorization"] = '<api-key>'
request["Content-Type"] = 'knowledgeBase'
request.body = "{\n \"data\": {\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

authorization
string
header
required

Voiceflow API key

Path Parameters

documentID
string
required

ID of the document to target.

Body

knowledgeBase
data
object
required

Response

200 - application/json

The target document was updated successfully.

data
object
required