POST
/
v1
/
message

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.

Headers

Content-Type
string
required

Must be set to application/json

x-api-key
string
required

Your Personal AI API key

Body

Text
string
required

Message to send to your AI for a response

Example
"What is an SLM?"
Context
string

Message to add additional context to the AI for a response (Similar to Reply function)

Example
"Context": "Reply in one sentence."
DomainName
string

The domain part of the AI profile url

Example
"DomainName": "ai"
UserName
string

Name of the user sending the request

Example
"UserName": "Leila"
SessionId
string

Use the same sessionId to continue conversation on that session

Example
"SessionId": "d5e9f208-937c-4a9c-92bf-5fb90ce68ff6"
Events
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"
SourceName
string

Name of the source app of the inbound message, required if using with triggers

Example
"SourceName": "slack"
is_stack
boolean

Flag to also add the user message (Text) to memory. Defaults to false if nothing is entered.

Example
"is_stack": true
is_draft
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": "ai",
    "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

ai_message
string

The AI’s response message

ai_score
number

Confidence score of the AI’s response

SessionId
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?",
    "UserName": "Leila",
    "SourceName": "slack",
    "is_draft": true,
    "SessionId": "d5e9f208-937c-4a9c-92bf-5fb90ce68ff6",
    "Events": "How to train your AI"
}'

Error Codes

CodeDescription
503Authorization Failure - API key is invalid
503Threshold Failure - Generated AI message is below user threshold