Create or Continue Conversation
curl --request POST \
--url https://api.pal.ai/v1/conversations \
--header 'Content-Type: application/json' \
--data '
{
"applicationId": "<string>",
"parentMessageId": "<string>",
"conversationId": "<string>",
"isStreaming": true,
"messageContent": "<string>",
"contact": {
"name": "<string>",
"externalId": "<string>",
"email": "<string>"
},
"metadata": {}
}
'import requests
url = "https://api.pal.ai/v1/conversations"
payload = {
"applicationId": "<string>",
"parentMessageId": "<string>",
"conversationId": "<string>",
"isStreaming": True,
"messageContent": "<string>",
"contact": {
"name": "<string>",
"externalId": "<string>",
"email": "<string>"
},
"metadata": {}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
applicationId: '<string>',
parentMessageId: '<string>',
conversationId: '<string>',
isStreaming: true,
messageContent: '<string>',
contact: {name: '<string>', externalId: '<string>', email: '<string>'},
metadata: {}
})
};
fetch('https://api.pal.ai/v1/conversations', 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.pal.ai/v1/conversations",
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([
'applicationId' => '<string>',
'parentMessageId' => '<string>',
'conversationId' => '<string>',
'isStreaming' => true,
'messageContent' => '<string>',
'contact' => [
'name' => '<string>',
'externalId' => '<string>',
'email' => '<string>'
],
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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.pal.ai/v1/conversations"
payload := strings.NewReader("{\n \"applicationId\": \"<string>\",\n \"parentMessageId\": \"<string>\",\n \"conversationId\": \"<string>\",\n \"isStreaming\": true,\n \"messageContent\": \"<string>\",\n \"contact\": {\n \"name\": \"<string>\",\n \"externalId\": \"<string>\",\n \"email\": \"<string>\"\n },\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
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://api.pal.ai/v1/conversations")
.header("Content-Type", "application/json")
.body("{\n \"applicationId\": \"<string>\",\n \"parentMessageId\": \"<string>\",\n \"conversationId\": \"<string>\",\n \"isStreaming\": true,\n \"messageContent\": \"<string>\",\n \"contact\": {\n \"name\": \"<string>\",\n \"externalId\": \"<string>\",\n \"email\": \"<string>\"\n },\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pal.ai/v1/conversations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"applicationId\": \"<string>\",\n \"parentMessageId\": \"<string>\",\n \"conversationId\": \"<string>\",\n \"isStreaming\": true,\n \"messageContent\": \"<string>\",\n \"contact\": {\n \"name\": \"<string>\",\n \"externalId\": \"<string>\",\n \"email\": \"<string>\"\n },\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"conversationId": "<string>",
"messages": [
{
"id": "<string>",
"content": "<string>",
"type": "<string>",
"parentMessageId": "<string>",
"searchResultSet": {
"documents": [
{
"id": "<string>",
"title": "<string>",
"contentPreview": "<string>",
"url": "<string>"
}
],
"sections": [
{
"id": "<string>",
"applicationId": "<string>",
"heading": "<string>",
"text": "<string>",
"documentId": "<string>",
"indexOrder": "<string>",
"indexId": "<string>",
"indexName": "<string>",
"indexInfo": "<string>",
"deletedAt": "<string>",
"updatedAt": "<string>",
"createdAt": "<string>"
}
]
},
"createdAt": "<string>",
"updatedAt": "<string>",
"deletedAt": "<string>",
"conversationId": "<string>",
"": "<string>"
}
],
"contact": {
"id": "<string>",
"externalId": "<string>",
"email": "<string>",
"name": "<string>",
"organization": {
"id": "<string>",
"name": "<string>"
}
}
}Conversations
Create or Continue Conversation
POST
/
conversations
Create or Continue Conversation
curl --request POST \
--url https://api.pal.ai/v1/conversations \
--header 'Content-Type: application/json' \
--data '
{
"applicationId": "<string>",
"parentMessageId": "<string>",
"conversationId": "<string>",
"isStreaming": true,
"messageContent": "<string>",
"contact": {
"name": "<string>",
"externalId": "<string>",
"email": "<string>"
},
"metadata": {}
}
'import requests
url = "https://api.pal.ai/v1/conversations"
payload = {
"applicationId": "<string>",
"parentMessageId": "<string>",
"conversationId": "<string>",
"isStreaming": True,
"messageContent": "<string>",
"contact": {
"name": "<string>",
"externalId": "<string>",
"email": "<string>"
},
"metadata": {}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
applicationId: '<string>',
parentMessageId: '<string>',
conversationId: '<string>',
isStreaming: true,
messageContent: '<string>',
contact: {name: '<string>', externalId: '<string>', email: '<string>'},
metadata: {}
})
};
fetch('https://api.pal.ai/v1/conversations', 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.pal.ai/v1/conversations",
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([
'applicationId' => '<string>',
'parentMessageId' => '<string>',
'conversationId' => '<string>',
'isStreaming' => true,
'messageContent' => '<string>',
'contact' => [
'name' => '<string>',
'externalId' => '<string>',
'email' => '<string>'
],
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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.pal.ai/v1/conversations"
payload := strings.NewReader("{\n \"applicationId\": \"<string>\",\n \"parentMessageId\": \"<string>\",\n \"conversationId\": \"<string>\",\n \"isStreaming\": true,\n \"messageContent\": \"<string>\",\n \"contact\": {\n \"name\": \"<string>\",\n \"externalId\": \"<string>\",\n \"email\": \"<string>\"\n },\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
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://api.pal.ai/v1/conversations")
.header("Content-Type", "application/json")
.body("{\n \"applicationId\": \"<string>\",\n \"parentMessageId\": \"<string>\",\n \"conversationId\": \"<string>\",\n \"isStreaming\": true,\n \"messageContent\": \"<string>\",\n \"contact\": {\n \"name\": \"<string>\",\n \"externalId\": \"<string>\",\n \"email\": \"<string>\"\n },\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pal.ai/v1/conversations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"applicationId\": \"<string>\",\n \"parentMessageId\": \"<string>\",\n \"conversationId\": \"<string>\",\n \"isStreaming\": true,\n \"messageContent\": \"<string>\",\n \"contact\": {\n \"name\": \"<string>\",\n \"externalId\": \"<string>\",\n \"email\": \"<string>\"\n },\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"conversationId": "<string>",
"messages": [
{
"id": "<string>",
"content": "<string>",
"type": "<string>",
"parentMessageId": "<string>",
"searchResultSet": {
"documents": [
{
"id": "<string>",
"title": "<string>",
"contentPreview": "<string>",
"url": "<string>"
}
],
"sections": [
{
"id": "<string>",
"applicationId": "<string>",
"heading": "<string>",
"text": "<string>",
"documentId": "<string>",
"indexOrder": "<string>",
"indexId": "<string>",
"indexName": "<string>",
"indexInfo": "<string>",
"deletedAt": "<string>",
"updatedAt": "<string>",
"createdAt": "<string>"
}
]
},
"createdAt": "<string>",
"updatedAt": "<string>",
"deletedAt": "<string>",
"conversationId": "<string>",
"": "<string>"
}
],
"contact": {
"id": "<string>",
"externalId": "<string>",
"email": "<string>",
"name": "<string>",
"organization": {
"id": "<string>",
"name": "<string>"
}
}
}Body
application/jsonapplication/xmlmultipart/form-data
If you're sending in the first message of a conversation, you should send in a null conversationId and a null parentMessageId. This first call will generate a new conversation, and you will receive an id for the conversation in the response body.
At least one of externalId or email must be provided.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Any key-value pair is allowed.
Some keys are recognized by Pal and displayed separately in the UI.
For now, the only recognized key is sourceUrl, which Pal expects to be a URL string.
⌘I