POST
/
v1
/
instruction

Overview

API endpoint for sending specific instructions to your AI. This endpoint allows you to interact with different AI models and execute specific commands.

Headers

Content-Type
string
required

Must be set to application/json

x-api-key
string
required

Your Personal AI API key

Query Parameters

cmd=
string
required

Command to execute (e.g., “chatgpt”, “search”)

Body

Text
string
required

Text instruction to send to your AI

Example
    "Text": "who is Einstein""
Context
string

Additional context for the instruction

Example
    "Context": "Respond in 2 sentences or less."
DomainName
string

The domain part of the AI profile url

Example
    "DomainName": "pai-developer"
UserName
string

Name of the user sending the request

Example
    "UserName": "Leila"
SessionId
string

Session identifier for maintaining conversation context

Example
    "SessionId": "d5e9f208-937c-4a9c-92bf-5fb90ce68ff6"
SourceName
string

Source application name

Example
    "SourceName": "slack"
is_message
boolean

Flag to indicate if the instruction should be treated as a message

Example
    "is_message": true

Example Request

Example
{
    "Text": "who is Einstein",
    "Context": "Respond in two sentences or less.",
    "DomainName": "pai-developer",
    "UserName": "Leila",
    "SessionId": "d5e9f208-937c-4a9c-92bf-5fb90ce68ff6",
    "SourceName": "slack",
    "is_message": true
}

Example Response

ai_message
string

The AI’s response to the instruction

ai_score
number

Confidence score of the AI’s response

Example Success Response
{
    "ai_message": "Einstein was a renowned physicist who developed the theory of relativity. He is considered one of the most influential scientists of the 20th century.",
    "ai_score": 95.5,
    "ai_name": "AI Name",
    "SessionId": "d5e9f208-937c-4a9c-92bf-5fb90ce68ff6",
    "source_app": "api"
}

Example cURL

cURL
curl --location 'https://api.personal.ai/v1/instruction?cmd=chatgpt' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <your-api-key>' \
--data '{
    "Text": "who is Einstein",
    "UserName": "Leila",
    "SourceName": "slack",
    "SessionId": "d5e9f208-937c-4a9c-92bf-5fb90ce68ff6",
    "is_message": true
}'

Error Codes

CodeDescription
503Authorization Failure - API key is invalid
503Processing Failure - Instruction could not be processed
Example Error Response
{
    "detail": "AI instruction api unauthorized."
}