Get Conversation Messages
curl --request POST \
--url https://composer.personal.ai/lab/api/v1/op/conversation.messages \
--header 'Content-Type: <content-type>' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"conversation_id": "<string>",
"limit": 123
}
'import requests
url = "https://composer.personal.ai/lab/api/v1/op/conversation.messages"
payload = {
"conversation_id": "<string>",
"limit": 123
}
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({conversation_id: '<string>', limit: 123})
};
fetch('https://composer.personal.ai/lab/api/v1/op/conversation.messages', 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://composer.personal.ai/lab/api/v1/op/conversation.messages",
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([
'conversation_id' => '<string>',
'limit' => 123
]),
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://composer.personal.ai/lab/api/v1/op/conversation.messages"
payload := strings.NewReader("{\n \"conversation_id\": \"<string>\",\n \"limit\": 123\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://composer.personal.ai/lab/api/v1/op/conversation.messages")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "<content-type>")
.body("{\n \"conversation_id\": \"<string>\",\n \"limit\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://composer.personal.ai/lab/api/v1/op/conversation.messages")
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 \"conversation_id\": \"<string>\",\n \"limit\": 123\n}"
response = http.request(request)
puts response.read_body{
"messages": [
{}
],
"messages[].files": [
{}
],
"messages[].run_id": "<string>",
"messages[].graphics": [
{}
],
"messages[].places": [
{}
],
"messages[].stopped": true
}Conversations
Get Conversation Messages
Load a conversation’s history
POST
/
lab
/
api
/
v1
/
op
/
conversation.messages
Get Conversation Messages
curl --request POST \
--url https://composer.personal.ai/lab/api/v1/op/conversation.messages \
--header 'Content-Type: <content-type>' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"conversation_id": "<string>",
"limit": 123
}
'import requests
url = "https://composer.personal.ai/lab/api/v1/op/conversation.messages"
payload = {
"conversation_id": "<string>",
"limit": 123
}
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({conversation_id: '<string>', limit: 123})
};
fetch('https://composer.personal.ai/lab/api/v1/op/conversation.messages', 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://composer.personal.ai/lab/api/v1/op/conversation.messages",
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([
'conversation_id' => '<string>',
'limit' => 123
]),
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://composer.personal.ai/lab/api/v1/op/conversation.messages"
payload := strings.NewReader("{\n \"conversation_id\": \"<string>\",\n \"limit\": 123\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://composer.personal.ai/lab/api/v1/op/conversation.messages")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "<content-type>")
.body("{\n \"conversation_id\": \"<string>\",\n \"limit\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://composer.personal.ai/lab/api/v1/op/conversation.messages")
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 \"conversation_id\": \"<string>\",\n \"limit\": 123\n}"
response = http.request(request)
puts response.read_body{
"messages": [
{}
],
"messages[].files": [
{}
],
"messages[].run_id": "<string>",
"messages[].graphics": [
{}
],
"messages[].places": [
{}
],
"messages[].stopped": true
}Overview
Returns a conversation’s messages, oldest first: each of your messages followed by the assistant’s reply. Operation name:conversation.messages. Member keys can call it.
Authorization
Headers
Body
The conversation to load.
Example
"conversation_id": "9a2b7c1e-4d3f-4e8a-b6c5-1f0e2d3c4b5a"
Example Request
{
"conversation_id": "9a2b7c1e-4d3f-4e8a-b6c5-1f0e2d3c4b5a",
"limit": 50
}
Response
Places the assistant found on the map:
id, name, address, phone, website, maps_url, open_now, rating. A place’s small map is served at GET /lab/api/v1/place/{id}/map.Example Success Response
{
"messages": [
{
"role": "you",
"text": "What's on tomorrow?"
},
{
"role": "ea",
"text": "Tomorrow you have the dentist at 9:30 and Emma's swimming at 4pm.",
"run_id": "3f8e2a1b-7c6d-4e5f-9a8b-0c1d2e3f4a5b"
}
]
}
Example cURL
cURL
curl --request POST 'https://composer.personal.ai/lab/api/v1/op/conversation.messages' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <your-api-key>' \
--data '{"conversation_id": "9a2b7c1e-4d3f-4e8a-b6c5-1f0e2d3c4b5a", "limit": 50}'
Error Codes
| Code | Description |
|---|---|
| 400 | The body doesn’t match the fields above, or the operation failed. The response body says why. |
| 401 | Missing or invalid API key |
| 403 | This key isn’t allowed to call this operation |