Skip to main content
POST
/
v1
/
document
Get Document
curl --request POST \
  --url https://api.personal.ai/v1/document \
  --header 'Content-Type: <content-type>' \
  --header 'x-api-key: <x-api-key>' \
  --data '
{
  "DomainName": "<string>",
  "Text": "<string>"
}
'
import requests

url = "https://api.personal.ai/v1/document"

payload = {
"DomainName": "<string>",
"Text": "<string>"
}
headers = {
"x-api-key": "<x-api-key>",
"Content-Type": "<content-type>"
}

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

print(response.text)
const options = {
method: 'POST',
headers: {'x-api-key': '<x-api-key>', 'Content-Type': '<content-type>'},
body: JSON.stringify({DomainName: '<string>', Text: '<string>'})
};

fetch('https://api.personal.ai/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://api.personal.ai/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([
'DomainName' => '<string>',
'Text' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: <content-type>",
"x-api-key: <x-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://api.personal.ai/v1/document"

payload := strings.NewReader("{\n \"DomainName\": \"<string>\",\n \"Text\": \"<string>\"\n}")

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

req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("Content-Type", "<content-type>")

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.personal.ai/v1/document")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "<content-type>")
.body("{\n \"DomainName\": \"<string>\",\n \"Text\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.personal.ai/v1/document")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["Content-Type"] = '<content-type>'
request.body = "{\n \"DomainName\": \"<string>\",\n \"Text\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "array": [
    {}
  ]
}

Overview

API endpoint for retrieving a specific document or list of documents from a persona. This endpoint allows you to access any document by name or pulling a series of documents using the query parameters for response size.

Authorization

x-api-key
string
required
Your Personal AI API key

Headers

Content-Type
string
required
Must be set to application/json

Query Parameters

size
integer
required
Your desired number of documents to be returned.

Body

DomainName
string
required
The hyphenated text below the AI’s name when clicked into a Persona.DomainName
Example Request
"DomainName": "product-demo-jebzrhw"
Text
string
Document name to retrieve a specific document. Leave blank if you want to retrieve mulitple documents.
Example Request
"Text": "Python Reflection"

Example Request

array
array
Array of conversation messages, including both user messages and AI responses
Example Request
{
  "Text": "Python Reflection",
  "DomainName": "product-demo-jebzrhw"
}

Example Response

Example Success Response
[
    {
        "id": "66c6706fe6fffd040957a7a3",
        "title": "Python Reflection",
        "text": "**Title: Reflecting on Python: My Journey Through a Language Revolution** When I first encountered Python, it was like meeting an old friend who instantly felt familiar and welcoming. I remember divin",
        "type": "Document",
        "timestamp": "2025-03-17T17:24:44.874+00:00"
    }
]

Example cURL

cURL
curl --location 'https://api.personal.ai/v1/document?size=5' \
--header 'x-api-key: <your-api-key>' \
--header 'Content-Type: application/json' \
--data '{
    "Text": "Python Reflection",
    "DomainName": "product-demo-jebzrhw"
}''

Error Codes

CodeDescription
403Forbidden - Check that API key is invalid