Upsert documents
curl --request POST \
--url https://embed.breadbowl.ai/v1/indexes/{index_id}/documents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"documents": [
{
"doc_id": "help-center:refunds",
"text": "Refund requests are accepted within 30 days of purchase.",
"metadata": {
"source": "help-center",
"locale": "en",
"status": "published"
}
}
]
}
'import requests
url = "https://embed.breadbowl.ai/v1/indexes/{index_id}/documents"
payload = { "documents": [
{
"doc_id": "help-center:refunds",
"text": "Refund requests are accepted within 30 days of purchase.",
"metadata": {
"source": "help-center",
"locale": "en",
"status": "published"
}
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
documents: [
{
doc_id: 'help-center:refunds',
text: 'Refund requests are accepted within 30 days of purchase.',
metadata: {source: 'help-center', locale: 'en', status: 'published'}
}
]
})
};
fetch('https://embed.breadbowl.ai/v1/indexes/{index_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://embed.breadbowl.ai/v1/indexes/{index_id}/documents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'documents' => [
[
'doc_id' => 'help-center:refunds',
'text' => 'Refund requests are accepted within 30 days of purchase.',
'metadata' => [
'source' => 'help-center',
'locale' => 'en',
'status' => 'published'
]
]
]
]),
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://embed.breadbowl.ai/v1/indexes/{index_id}/documents"
payload := strings.NewReader("{\n \"documents\": [\n {\n \"doc_id\": \"help-center:refunds\",\n \"text\": \"Refund requests are accepted within 30 days of purchase.\",\n \"metadata\": {\n \"source\": \"help-center\",\n \"locale\": \"en\",\n \"status\": \"published\"\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", 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.post("https://embed.breadbowl.ai/v1/indexes/{index_id}/documents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"documents\": [\n {\n \"doc_id\": \"help-center:refunds\",\n \"text\": \"Refund requests are accepted within 30 days of purchase.\",\n \"metadata\": {\n \"source\": \"help-center\",\n \"locale\": \"en\",\n \"status\": \"published\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://embed.breadbowl.ai/v1/indexes/{index_id}/documents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"documents\": [\n {\n \"doc_id\": \"help-center:refunds\",\n \"text\": \"Refund requests are accepted within 30 days of purchase.\",\n \"metadata\": {\n \"source\": \"help-center\",\n \"locale\": \"en\",\n \"status\": \"published\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"index_id": "739c40ce-fa7e-4ba1-bcc2-46632fd13088",
"upserted_documents": 1,
"upserted_chunks": 3,
"failed": [],
"usage": {
"input_tokens": 420,
"document_count": 1,
"chunk_count": 3,
"candidate_count": 0,
"latency_ms": 1800
}
}Upsert documents
Creates or replaces one to 50 documents in an index. doc_id is the idempotency identity within the index.
A syntactically valid batch returns HTTP 200 after all items are evaluated, even if individual items fail. Clients must inspect failed before considering the batch complete.
POST
/
v1
/
indexes
/
{index_id}
/
documents
Upsert documents
curl --request POST \
--url https://embed.breadbowl.ai/v1/indexes/{index_id}/documents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"documents": [
{
"doc_id": "help-center:refunds",
"text": "Refund requests are accepted within 30 days of purchase.",
"metadata": {
"source": "help-center",
"locale": "en",
"status": "published"
}
}
]
}
'import requests
url = "https://embed.breadbowl.ai/v1/indexes/{index_id}/documents"
payload = { "documents": [
{
"doc_id": "help-center:refunds",
"text": "Refund requests are accepted within 30 days of purchase.",
"metadata": {
"source": "help-center",
"locale": "en",
"status": "published"
}
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
documents: [
{
doc_id: 'help-center:refunds',
text: 'Refund requests are accepted within 30 days of purchase.',
metadata: {source: 'help-center', locale: 'en', status: 'published'}
}
]
})
};
fetch('https://embed.breadbowl.ai/v1/indexes/{index_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://embed.breadbowl.ai/v1/indexes/{index_id}/documents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'documents' => [
[
'doc_id' => 'help-center:refunds',
'text' => 'Refund requests are accepted within 30 days of purchase.',
'metadata' => [
'source' => 'help-center',
'locale' => 'en',
'status' => 'published'
]
]
]
]),
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://embed.breadbowl.ai/v1/indexes/{index_id}/documents"
payload := strings.NewReader("{\n \"documents\": [\n {\n \"doc_id\": \"help-center:refunds\",\n \"text\": \"Refund requests are accepted within 30 days of purchase.\",\n \"metadata\": {\n \"source\": \"help-center\",\n \"locale\": \"en\",\n \"status\": \"published\"\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", 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.post("https://embed.breadbowl.ai/v1/indexes/{index_id}/documents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"documents\": [\n {\n \"doc_id\": \"help-center:refunds\",\n \"text\": \"Refund requests are accepted within 30 days of purchase.\",\n \"metadata\": {\n \"source\": \"help-center\",\n \"locale\": \"en\",\n \"status\": \"published\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://embed.breadbowl.ai/v1/indexes/{index_id}/documents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"documents\": [\n {\n \"doc_id\": \"help-center:refunds\",\n \"text\": \"Refund requests are accepted within 30 days of purchase.\",\n \"metadata\": {\n \"source\": \"help-center\",\n \"locale\": \"en\",\n \"status\": \"published\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"index_id": "739c40ce-fa7e-4ba1-bcc2-46632fd13088",
"upserted_documents": 1,
"upserted_chunks": 3,
"failed": [],
"usage": {
"input_tokens": 420,
"document_count": 1,
"chunk_count": 3,
"candidate_count": 0,
"latency_ms": 1800
}
}Authorizations
Tenant-scoped API key beginning with qkv_live_.
Path Parameters
Tenant-scoped index UUID returned by index creation.
Body
application/json
Document IDs must be unique within the request.
Required array length:
1 - 50 elementsShow child attributes
Show child attributes
⌘I