Create Document
curl --request POST \
--url https://platform.perso.ai/api/v1/document/ \
--header 'Content-Type: application/json' \
--header 'PersoPlatform-APIKey: <api-key>' \
--data '
{
"title": "<string>",
"file": "<string>",
"description": "<string>",
"search_count": -1,
"ef_search": 250
}
'import requests
url = "https://platform.perso.ai/api/v1/document/"
payload = {
"title": "<string>",
"file": "<string>",
"description": "<string>",
"search_count": -1,
"ef_search": 250
}
headers = {
"PersoPlatform-APIKey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'PersoPlatform-APIKey': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: '<string>',
file: '<string>',
description: '<string>',
search_count: -1,
ef_search: 250
})
};
fetch('https://platform.perso.ai/api/v1/document/', 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://platform.perso.ai/api/v1/document/",
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([
'title' => '<string>',
'file' => '<string>',
'description' => '<string>',
'search_count' => -1,
'ef_search' => 250
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"PersoPlatform-APIKey: <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://platform.perso.ai/api/v1/document/"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"file\": \"<string>\",\n \"description\": \"<string>\",\n \"search_count\": -1,\n \"ef_search\": 250\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("PersoPlatform-APIKey", "<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.post("https://platform.perso.ai/api/v1/document/")
.header("PersoPlatform-APIKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"file\": \"<string>\",\n \"description\": \"<string>\",\n \"search_count\": -1,\n \"ef_search\": 250\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://platform.perso.ai/api/v1/document/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["PersoPlatform-APIKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"<string>\",\n \"file\": \"<string>\",\n \"description\": \"<string>\",\n \"search_count\": -1,\n \"ef_search\": 250\n}"
response = http.request(request)
puts response.read_body{
"document_id": "<string>",
"title": "<string>",
"file": "<string>",
"processed": true,
"processed_v2": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"search_count": -1,
"ef_search": 250
}Session Resources
Create Document
Create a new document for use as a knowledge source.
Documents are uploaded files that can be referenced by the LLM during conversations to provide context-aware responses.
POST
/
api
/
v1
/
document
/
Create Document
curl --request POST \
--url https://platform.perso.ai/api/v1/document/ \
--header 'Content-Type: application/json' \
--header 'PersoPlatform-APIKey: <api-key>' \
--data '
{
"title": "<string>",
"file": "<string>",
"description": "<string>",
"search_count": -1,
"ef_search": 250
}
'import requests
url = "https://platform.perso.ai/api/v1/document/"
payload = {
"title": "<string>",
"file": "<string>",
"description": "<string>",
"search_count": -1,
"ef_search": 250
}
headers = {
"PersoPlatform-APIKey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'PersoPlatform-APIKey': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: '<string>',
file: '<string>',
description: '<string>',
search_count: -1,
ef_search: 250
})
};
fetch('https://platform.perso.ai/api/v1/document/', 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://platform.perso.ai/api/v1/document/",
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([
'title' => '<string>',
'file' => '<string>',
'description' => '<string>',
'search_count' => -1,
'ef_search' => 250
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"PersoPlatform-APIKey: <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://platform.perso.ai/api/v1/document/"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"file\": \"<string>\",\n \"description\": \"<string>\",\n \"search_count\": -1,\n \"ef_search\": 250\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("PersoPlatform-APIKey", "<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.post("https://platform.perso.ai/api/v1/document/")
.header("PersoPlatform-APIKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"file\": \"<string>\",\n \"description\": \"<string>\",\n \"search_count\": -1,\n \"ef_search\": 250\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://platform.perso.ai/api/v1/document/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["PersoPlatform-APIKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"<string>\",\n \"file\": \"<string>\",\n \"description\": \"<string>\",\n \"search_count\": -1,\n \"ef_search\": 250\n}"
response = http.request(request)
puts response.read_body{
"document_id": "<string>",
"title": "<string>",
"file": "<string>",
"processed": true,
"processed_v2": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"search_count": -1,
"ef_search": 250
}Authorizations
Body
application/jsonapplication/x-www-form-urlencodedmultipart/form-data
Required string length:
1 - 100Source document file (PDF, DOCX, or TXT) to ingest as a knowledge base.
Pattern:
(?:xls|xlsx|csv)$Number of search results to return per query (default depends on model).
Required range:
-2147483648 <= x <= 2147483647HNSW ef_search parameter for the vector index (1-500). Higher = more accurate, slower.
Required range:
1 <= x <= 500Response
Maximum string length:
100Source document file (PDF, DOCX, or TXT) to ingest as a knowledge base.
Pattern:
(?:xls|xlsx|csv)$Number of search results to return per query (default depends on model).
Required range:
-2147483648 <= x <= 2147483647HNSW ef_search parameter for the vector index (1-500). Higher = more accurate, slower.
Required range:
1 <= x <= 500
