Add documents
curl --request POST \
--url https://api.conare.ai/namespaces/{namespace}/documents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"documents": [
{
"id": "refunds",
"text": "Refunds are available for 30 days after purchase.",
"metadata": {
"team": "support",
"year": 2025
}
}
]
}
'import requests
url = "https://api.conare.ai/namespaces/{namespace}/documents"
payload = { "documents": [
{
"id": "refunds",
"text": "Refunds are available for 30 days after purchase.",
"metadata": {
"team": "support",
"year": 2025
}
}
] }
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: [
{
id: 'refunds',
text: 'Refunds are available for 30 days after purchase.',
metadata: {team: 'support', year: 2025}
}
]
})
};
fetch('https://api.conare.ai/namespaces/{namespace}/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.conare.ai/namespaces/{namespace}/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' => [
[
'id' => 'refunds',
'text' => 'Refunds are available for 30 days after purchase.',
'metadata' => [
'team' => 'support',
'year' => 2025
]
]
]
]),
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.conare.ai/namespaces/{namespace}/documents"
payload := strings.NewReader("{\n \"documents\": [\n {\n \"id\": \"refunds\",\n \"text\": \"Refunds are available for 30 days after purchase.\",\n \"metadata\": {\n \"team\": \"support\",\n \"year\": 2025\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://api.conare.ai/namespaces/{namespace}/documents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"documents\": [\n {\n \"id\": \"refunds\",\n \"text\": \"Refunds are available for 30 days after purchase.\",\n \"metadata\": {\n \"team\": \"support\",\n \"year\": 2025\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.conare.ai/namespaces/{namespace}/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 \"id\": \"refunds\",\n \"text\": \"Refunds are available for 30 days after purchase.\",\n \"metadata\": {\n \"team\": \"support\",\n \"year\": 2025\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"ids": [
"refunds"
]
}{
"error": {
"code": "invalid_request",
"message": "text is required",
"request_id": "req_8f3a2c"
}
}{
"error": {
"code": "invalid_request",
"message": "text is required",
"request_id": "req_8f3a2c"
}
}{
"error": {
"code": "invalid_request",
"message": "text is required",
"request_id": "req_8f3a2c"
}
}{
"error": {
"code": "invalid_request",
"message": "text is required",
"request_id": "req_8f3a2c"
}
}{
"error": {
"code": "invalid_request",
"message": "text is required",
"request_id": "req_8f3a2c"
}
}Documents
Add documents
Adds 1-100 documents. A document with an existing id replaces it. The namespace is created if it does not exist yet.
POST
/
namespaces
/
{namespace}
/
documents
Add documents
curl --request POST \
--url https://api.conare.ai/namespaces/{namespace}/documents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"documents": [
{
"id": "refunds",
"text": "Refunds are available for 30 days after purchase.",
"metadata": {
"team": "support",
"year": 2025
}
}
]
}
'import requests
url = "https://api.conare.ai/namespaces/{namespace}/documents"
payload = { "documents": [
{
"id": "refunds",
"text": "Refunds are available for 30 days after purchase.",
"metadata": {
"team": "support",
"year": 2025
}
}
] }
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: [
{
id: 'refunds',
text: 'Refunds are available for 30 days after purchase.',
metadata: {team: 'support', year: 2025}
}
]
})
};
fetch('https://api.conare.ai/namespaces/{namespace}/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.conare.ai/namespaces/{namespace}/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' => [
[
'id' => 'refunds',
'text' => 'Refunds are available for 30 days after purchase.',
'metadata' => [
'team' => 'support',
'year' => 2025
]
]
]
]),
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.conare.ai/namespaces/{namespace}/documents"
payload := strings.NewReader("{\n \"documents\": [\n {\n \"id\": \"refunds\",\n \"text\": \"Refunds are available for 30 days after purchase.\",\n \"metadata\": {\n \"team\": \"support\",\n \"year\": 2025\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://api.conare.ai/namespaces/{namespace}/documents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"documents\": [\n {\n \"id\": \"refunds\",\n \"text\": \"Refunds are available for 30 days after purchase.\",\n \"metadata\": {\n \"team\": \"support\",\n \"year\": 2025\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.conare.ai/namespaces/{namespace}/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 \"id\": \"refunds\",\n \"text\": \"Refunds are available for 30 days after purchase.\",\n \"metadata\": {\n \"team\": \"support\",\n \"year\": 2025\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"ids": [
"refunds"
]
}{
"error": {
"code": "invalid_request",
"message": "text is required",
"request_id": "req_8f3a2c"
}
}{
"error": {
"code": "invalid_request",
"message": "text is required",
"request_id": "req_8f3a2c"
}
}{
"error": {
"code": "invalid_request",
"message": "text is required",
"request_id": "req_8f3a2c"
}
}{
"error": {
"code": "invalid_request",
"message": "text is required",
"request_id": "req_8f3a2c"
}
}{
"error": {
"code": "invalid_request",
"message": "text is required",
"request_id": "req_8f3a2c"
}
}Authorizations
An API key from conare.ai/console/keys. It can read and write every namespace in its organization.
Path Parameters
The namespace name.
1-64 characters of a-z 0-9 _ -, starting with a letter or digit.
Pattern:
^[a-z0-9][a-z0-9_-]{0,63}$Examples:
"docs"
"user-42"
Body
application/json
Required array length:
1 - 100 elementsShow child attributes
Show child attributes
Response
The ids of the written documents, in request order.