curl --request PUT \
--url https://api.statisfy.com/v1/knowledge_bases/{knowledge_base_id}/documents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"content": "<string>",
"external_id": "<string>",
"title": "<string>",
"url": "<string>"
}
'import requests
url = "https://api.statisfy.com/v1/knowledge_bases/{knowledge_base_id}/documents"
payload = {
"content": "<string>",
"external_id": "<string>",
"title": "<string>",
"url": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
content: '<string>',
external_id: '<string>',
title: '<string>',
url: '<string>'
})
};
fetch('https://api.statisfy.com/v1/knowledge_bases/{knowledge_base_id}/documents', 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://api.statisfy.com/v1/knowledge_bases/{knowledge_base_id}/documents",
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([
'content' => '<string>',
'external_id' => '<string>',
'title' => '<string>',
'url' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://api.statisfy.com/v1/knowledge_bases/{knowledge_base_id}/documents"
payload := strings.NewReader("{\n \"content\": \"<string>\",\n \"external_id\": \"<string>\",\n \"title\": \"<string>\",\n \"url\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.statisfy.com/v1/knowledge_bases/{knowledge_base_id}/documents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"content\": \"<string>\",\n \"external_id\": \"<string>\",\n \"title\": \"<string>\",\n \"url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.statisfy.com/v1/knowledge_bases/{knowledge_base_id}/documents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"content\": \"<string>\",\n \"external_id\": \"<string>\",\n \"title\": \"<string>\",\n \"url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"created_at": "<string>",
"format": "<string>",
"id": "<string>",
"knowledge_base_id": "<string>",
"result": "created",
"searchable": true,
"source": "<string>",
"status": "queued",
"title": "<string>",
"updated_at": "<string>",
"account_id": "<string>",
"error": "<string>",
"external_id": "<string>",
"source_url": "<string>",
"url": "<string>"
}{
"created_at": "<string>",
"format": "<string>",
"id": "<string>",
"knowledge_base_id": "<string>",
"result": "created",
"searchable": true,
"source": "<string>",
"status": "queued",
"title": "<string>",
"updated_at": "<string>",
"account_id": "<string>",
"error": "<string>",
"external_id": "<string>",
"source_url": "<string>",
"url": "<string>"
}Create or update a document
Creates the document with this external_id, or updates it. Returns it with result: created (201), updated or unchanged. A document is identified by your external_id, unique in its knowledge base (titles may repeat). Its words are stored and indexed in the background: the previous version keeps answering until the new one is ready. The same words, title and link again are unchanged: nothing is written or indexed again. A 503 that says the document was saved but its indexing could not be started: send it again, and indexing is asked for again. Writes go into a knowledge base this API made or one that takes uploads in the app (writable); a connector’s is a 409. A digital worker’s own key can’t write.
curl --request PUT \
--url https://api.statisfy.com/v1/knowledge_bases/{knowledge_base_id}/documents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"content": "<string>",
"external_id": "<string>",
"title": "<string>",
"url": "<string>"
}
'import requests
url = "https://api.statisfy.com/v1/knowledge_bases/{knowledge_base_id}/documents"
payload = {
"content": "<string>",
"external_id": "<string>",
"title": "<string>",
"url": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
content: '<string>',
external_id: '<string>',
title: '<string>',
url: '<string>'
})
};
fetch('https://api.statisfy.com/v1/knowledge_bases/{knowledge_base_id}/documents', 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://api.statisfy.com/v1/knowledge_bases/{knowledge_base_id}/documents",
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([
'content' => '<string>',
'external_id' => '<string>',
'title' => '<string>',
'url' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://api.statisfy.com/v1/knowledge_bases/{knowledge_base_id}/documents"
payload := strings.NewReader("{\n \"content\": \"<string>\",\n \"external_id\": \"<string>\",\n \"title\": \"<string>\",\n \"url\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.statisfy.com/v1/knowledge_bases/{knowledge_base_id}/documents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"content\": \"<string>\",\n \"external_id\": \"<string>\",\n \"title\": \"<string>\",\n \"url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.statisfy.com/v1/knowledge_bases/{knowledge_base_id}/documents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"content\": \"<string>\",\n \"external_id\": \"<string>\",\n \"title\": \"<string>\",\n \"url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"created_at": "<string>",
"format": "<string>",
"id": "<string>",
"knowledge_base_id": "<string>",
"result": "created",
"searchable": true,
"source": "<string>",
"status": "queued",
"title": "<string>",
"updated_at": "<string>",
"account_id": "<string>",
"error": "<string>",
"external_id": "<string>",
"source_url": "<string>",
"url": "<string>"
}{
"created_at": "<string>",
"format": "<string>",
"id": "<string>",
"knowledge_base_id": "<string>",
"result": "created",
"searchable": true,
"source": "<string>",
"status": "queued",
"title": "<string>",
"updated_at": "<string>",
"account_id": "<string>",
"error": "<string>",
"external_id": "<string>",
"source_url": "<string>",
"url": "<string>"
}Authorizations
An API key, sent as Authorization: Bearer stfy_live_…. See Authentication for how to get one and which scopes it needs.
Body
Response
Successful Response
Was this page helpful?