get__conversation_{conversationId}_messages
⚠️ TEST ENVIRONMENT ONLY
GET /conversation/{conversationId}/messages
Get Conversation Messages
Retrieve all messages from a conversation, including both user prompts and assistant responses. This endpoint returns the complete conversation history in chronological order.
Key Features:
Returns all messages from a conversation (user and assistant)
Messages are ordered chronologically (oldest first)
Includes message metadata such as token counts and model information
Supports conversation context retrieval for AI operations
Respects workspace and organization access controls
Message Types:
User messages - Prompts sent by users
Assistant messages - Responses generated by the AI
Important Notes:
Users must have access to the conversation's workspace
The conversation must exist and not be deleted
Organization administrators can view all conversations
Workspace administrators can view conversations in their workspaces
Regular users can only view their own conversations
Messages are retrieved from the external conversation API engine
Security:
Access is validated against workspace permissions
Only users with appropriate workspace access can retrieve messages
Message content is subject to policy enforcement and audit logging
Integration:
This endpoint integrates with external conversation API engines to retrieve conversation history. The system handles:
Fetching messages from the conversation store
Formatting and structuring message data
Including metadata and context information
Maintaining message order and timestamps
TypeScript Client Library
public getConversationMessages = async (conversationId: string): Promise<GetConversationMessagesResponse> => {
return this.makeRequest<GetConversationMessagesResponse>(`conversation/${conversationId}/messages`, 'GET', null);
};Code Samples
# You can also use wget
curl -X GET https://backend.flashback.tech/conversation/{conversationId}/messages \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'GET https://backend.flashback.tech/conversation/{conversationId}/messages HTTP/1.1
Host: backend.flashback.tech
Accept: application/jsonconst headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://backend.flashback.tech/conversation/{conversationId}/messages',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://backend.flashback.tech/conversation/{conversationId}/messages',
params: {
}, headers: headers
p JSON.parse(result)import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://backend.flashback.tech/conversation/{conversationId}/messages', headers = headers)
print(r.json())<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
try {
$response = $client->request('GET','https://backend.flashback.tech/conversation/{conversationId}/messages', array(
'headers' => $headers,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...URL obj = new URL("https://backend.flashback.tech/conversation/{conversationId}/messages");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://backend.flashback.tech/conversation/{conversationId}/messages", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}Parameters
conversationId
path
string
true
Unique identifier of the conversation
Example responses
200 Response
{
"success": true,
"messages": [
{
"id": "msg-123",
"conversationId": "conv-456",
"role": "user",
"content": "What is the best practice for securing API keys?",
"tokenCount": 12,
"model": null,
"metadata": {},
"createdAt": "2024-01-15T10:30:00.000Z"
},
{
"id": "msg-124",
"conversationId": "conv-456",
"role": "assistant",
"content": "The best practices for securing API keys include:\n\n1. Never commit API keys to version control\n2. Store keys in environment variables or secure vaults\n3. Rotate keys regularly\n4. Use least privilege access principles\n5. Monitor key usage for anomalies",
"tokenCount": 87,
"model": "gpt-4",
"metadata": {
"temperature": 0.7,
"maxTokens": 1000
},
"createdAt": "2024-01-15T10:30:05.000Z"
}
]
}Responses
Response Schema
Status Code 200
» success
boolean
false
none
Operation success status
» messages
[object]
false
none
Array of message objects
»» id
string
false
none
Unique identifier for the message
»» conversationId
string
false
none
Conversation ID this message belongs to
»» role
string
false
none
Message role ("user" or "assistant")
»» content
string
false
none
Message content text
»» tokenCount
integer
false
none
Number of tokens in the message
»» model
string
false
none
AI model used (for assistant messages)
»» metadata
object
false
none
Additional metadata (model parameters, etc.)
»» createdAt
string
false
none
ISO 8601 timestamp when message was created
Enumerated Values
»» role
user
»» role
assistant
Status Code 400
» success
boolean
false
none
none
» messages
array
false
none
none
» message
string
false
none
Error message
Status Code 403
» success
boolean
false
none
none
» messages
array
false
none
none
» message
string
false
none
Error message
Status Code 404
» success
boolean
false
none
none
» messages
array
false
none
none
» message
string
false
none
Error message
Status Code 500
» success
boolean
false
none
none
» messages
array
false
none
none
» message
string
false
none
Error message
To perform this operation, you must be authenticated by means of one of the following methods: BearerAuth
Last updated
Was this helpful?