AI Message
curl --request POST \
--url https://api.personal.ai/v1/message \
--header 'Content-Type: <content-type>' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"Text": "<string>",
"Context": "<string>",
"DomainName": "<string>",
"UserName": "<string>",
"SessionId": "<string>",
"Events": "<string>",
"SourceName": "<string>",
"is_stack": true,
"is_draft": true
}
'import requests
url = "https://api.personal.ai/v1/message"
payload = {
"Text": "<string>",
"Context": "<string>",
"DomainName": "<string>",
"UserName": "<string>",
"SessionId": "<string>",
"Events": "<string>",
"SourceName": "<string>",
"is_stack": True,
"is_draft": True
}
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({
Text: '<string>',
Context: '<string>',
DomainName: '<string>',
UserName: '<string>',
SessionId: '<string>',
Events: '<string>',
SourceName: '<string>',
is_stack: true,
is_draft: true
})
};
fetch('https://api.personal.ai/v1/message', 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/message",
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([
'Text' => '<string>',
'Context' => '<string>',
'DomainName' => '<string>',
'UserName' => '<string>',
'SessionId' => '<string>',
'Events' => '<string>',
'SourceName' => '<string>',
'is_stack' => true,
'is_draft' => true
]),
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/message"
payload := strings.NewReader("{\n \"Text\": \"<string>\",\n \"Context\": \"<string>\",\n \"DomainName\": \"<string>\",\n \"UserName\": \"<string>\",\n \"SessionId\": \"<string>\",\n \"Events\": \"<string>\",\n \"SourceName\": \"<string>\",\n \"is_stack\": true,\n \"is_draft\": true\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/message")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "<content-type>")
.body("{\n \"Text\": \"<string>\",\n \"Context\": \"<string>\",\n \"DomainName\": \"<string>\",\n \"UserName\": \"<string>\",\n \"SessionId\": \"<string>\",\n \"Events\": \"<string>\",\n \"SourceName\": \"<string>\",\n \"is_stack\": true,\n \"is_draft\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.personal.ai/v1/message")
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 \"Text\": \"<string>\",\n \"Context\": \"<string>\",\n \"DomainName\": \"<string>\",\n \"UserName\": \"<string>\",\n \"SessionId\": \"<string>\",\n \"Events\": \"<string>\",\n \"SourceName\": \"<string>\",\n \"is_stack\": true,\n \"is_draft\": true\n}"
response = http.request(request)
puts response.read_body{
"ai_message": "<string>",
"ai_score": 123,
"SessionId": "<string>"
}Personal AI APIs
AI Message
Send a message to your AI and receive a response
POST
/
v1
/
message
AI Message
curl --request POST \
--url https://api.personal.ai/v1/message \
--header 'Content-Type: <content-type>' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"Text": "<string>",
"Context": "<string>",
"DomainName": "<string>",
"UserName": "<string>",
"SessionId": "<string>",
"Events": "<string>",
"SourceName": "<string>",
"is_stack": true,
"is_draft": true
}
'import requests
url = "https://api.personal.ai/v1/message"
payload = {
"Text": "<string>",
"Context": "<string>",
"DomainName": "<string>",
"UserName": "<string>",
"SessionId": "<string>",
"Events": "<string>",
"SourceName": "<string>",
"is_stack": True,
"is_draft": True
}
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({
Text: '<string>',
Context: '<string>',
DomainName: '<string>',
UserName: '<string>',
SessionId: '<string>',
Events: '<string>',
SourceName: '<string>',
is_stack: true,
is_draft: true
})
};
fetch('https://api.personal.ai/v1/message', 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/message",
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([
'Text' => '<string>',
'Context' => '<string>',
'DomainName' => '<string>',
'UserName' => '<string>',
'SessionId' => '<string>',
'Events' => '<string>',
'SourceName' => '<string>',
'is_stack' => true,
'is_draft' => true
]),
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/message"
payload := strings.NewReader("{\n \"Text\": \"<string>\",\n \"Context\": \"<string>\",\n \"DomainName\": \"<string>\",\n \"UserName\": \"<string>\",\n \"SessionId\": \"<string>\",\n \"Events\": \"<string>\",\n \"SourceName\": \"<string>\",\n \"is_stack\": true,\n \"is_draft\": true\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/message")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "<content-type>")
.body("{\n \"Text\": \"<string>\",\n \"Context\": \"<string>\",\n \"DomainName\": \"<string>\",\n \"UserName\": \"<string>\",\n \"SessionId\": \"<string>\",\n \"Events\": \"<string>\",\n \"SourceName\": \"<string>\",\n \"is_stack\": true,\n \"is_draft\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.personal.ai/v1/message")
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 \"Text\": \"<string>\",\n \"Context\": \"<string>\",\n \"DomainName\": \"<string>\",\n \"UserName\": \"<string>\",\n \"SessionId\": \"<string>\",\n \"Events\": \"<string>\",\n \"SourceName\": \"<string>\",\n \"is_stack\": true,\n \"is_draft\": true\n}"
response = http.request(request)
puts response.read_body{
"ai_message": "<string>",
"ai_score": 123,
"SessionId": "<string>"
}Overview
API endpoint for interacting with your AI through messages. This endpoint allows you to have conversations with your AI and receive responses based on your AI’s training.Authorization
string
required
Your Personal AI API key
Headers
string
required
Must be set to application/json
Body
string
required
Message to send to your AI for a response
Example
"What is an SLM?"
string
Message to add additional context to the AI for a response (Similar to Reply function)
Example
"Context": "Reply in one sentence."
string
required
The hyphenated text below the AI’s name when clicked into a Persona.

Example
"DomainName": "product-demo-jebzrhw"
string
Name of the user sending the request
Example
"UserName": "Leila"
string
Use the same sessionId to continue conversation on that session
Example
"SessionId": "d5e9f208-937c-4a9c-92bf-5fb90ce68ff6"
string
Name of the document you want to refer to in your AI’s Upload Library. This functions in the same way as the colon function does in the Personal AI platform.
Example
"Event": "How to train your AI"
string
Name of the source app of the inbound message, required if using with triggers
Example
"SourceName": "slack"
boolean
Flag to also add the user message (Text) to memory. Defaults to false if nothing is entered.
Example
"is_stack": true
boolean
Flag to create a copilot message for the AI. Defaults to false if nothing is entered.
Example
"is_draft": true
Example
{
"Text": "What is an SLM?",
"Context": "Reply in one sentence.",
"DomainName": "product-demo-jebzrhw",
"UserName": "Leila",
"SessionId": "d5e9f208-937c-4a9c-92bf-5fb90ce68ff6",
"Events": "How to train your AI",
"SourceName": "slack",
"is_draft": true,
"is_stack": true,
"Metadata": {
"key": "value"
}
}
Example Responses
string
The AI’s response message
number
Confidence score of the AI’s response
string
Session identifier for the conversation
Example Success Response
{
"ai_message": "SLMs or PLMS PLMs are artificial intelligence (AI) models capable of understanding and generating information within the domain of an individual user. ",
"ai_score": 47.18898852308854,
"ai_name": "AI Name",
"ai_picture": "https://example.com/picture.jpg",
"SessionId": "d5e9f208-937c-4a9c-92bf-5fb90ce68ff6",
"source_app": "api"
}
Example Error Response
{
"detail": "AI message api unauthorized."
}
Examlpe cURL
cURL
curl --location 'https://api.personal.ai/v1/message' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <your-api-key>' \
--data '{
"Text": "What is an SLM?",
"DomainName": "product-demo-jebzrhw",
"UserName": "Leila",
"SourceName": "slack",
"is_draft": true,
"SessionId": "d5e9f208-937c-4a9c-92bf-5fb90ce68ff6",
"Events": "How to train your AI"
}'
Error Codes
| Code | Description |
|---|---|
| 403 | Forbidden - Check that API key is invalid |
| 503 | Threshold Failure - Generated AI message is below user threshold |
⌘I