Get Context
curl --request GET \
--url https://api.recallrai.com/api/v1/users/{custom_user_id}/sessions/{session_id}/context \
--header 'X-Recallr-Api-Key: <x-recallr-api-key>' \
--header 'X-Recallr-Project-Id: <x-recallr-project-id>'import requests
url = "https://api.recallrai.com/api/v1/users/{custom_user_id}/sessions/{session_id}/context"
headers = {
"X-Recallr-Project-Id": "<x-recallr-project-id>",
"X-Recallr-Api-Key": "<x-recallr-api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {
'X-Recallr-Project-Id': '<x-recallr-project-id>',
'X-Recallr-Api-Key': '<x-recallr-api-key>'
}
};
fetch('https://api.recallrai.com/api/v1/users/{custom_user_id}/sessions/{session_id}/context', 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.recallrai.com/api/v1/users/{custom_user_id}/sessions/{session_id}/context",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-Recallr-Api-Key: <x-recallr-api-key>",
"X-Recallr-Project-Id: <x-recallr-project-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.recallrai.com/api/v1/users/{custom_user_id}/sessions/{session_id}/context"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Recallr-Project-Id", "<x-recallr-project-id>")
req.Header.Add("X-Recallr-Api-Key", "<x-recallr-api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.recallrai.com/api/v1/users/{custom_user_id}/sessions/{session_id}/context")
.header("X-Recallr-Project-Id", "<x-recallr-project-id>")
.header("X-Recallr-Api-Key", "<x-recallr-api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.recallrai.com/api/v1/users/{custom_user_id}/sessions/{session_id}/context")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Recallr-Project-Id"] = '<x-recallr-project-id>'
request["X-Recallr-Api-Key"] = '<x-recallr-api-key>'
response = http.request(request)
puts response.read_body{
"is_final": true,
"context": "# Relevant memories and context."
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Sessions
Get Context
Retrieve AI context including relevant memories and recent conversations.
Generate context for LLM prompts by retrieving the most relevant memories and recent messages for a user. Use this to manually inject memory context into your AI applications.
Path Parameters:
custom_user_id(str): Unique identifier for the usersession_id(UUID): Session UUID to get context from
Query Parameters:
recall_strategy(RecallStrategy): Memory retrieval strategy. Options: low_latency, balanced, agentic and auto. Default: balancedmin_top_k(int): Minimum number of memories to return. Range: 5-50. Default: 15max_top_k(int): Maximum number of memories to return. Range: 10-100. Default: 50memories_threshold(float): Similarity threshold for memories. Range: 0.2-0.8. Default: 0.6summaries_threshold(float): Similarity threshold for session summaries. Range: 0.2-0.8. Default: 0.5last_n_messages(int): Number of last messages to include in context. Range: 1-100. Optionallast_n_summaries(int): Number of last summaries to include in context. Range: 1-20. Optionaltimezone(str): Timezone for formatting timestamps (e.g., ‘America/New_York’). Default: UTCinclude_system_prompt(bool): Whether to include the default system prompt. Default: truestream(bool): Whether to stream status updates via Server-Sent Events. Default: false
Returns:
- When
stream=false: JSONGetContextResponsewithis_final=trueandcontextfield - When
stream=true: SSE stream ofGetContextResponseevents with progress updates, ending with a final event containing the context
GET
/
api
/
v1
/
users
/
{custom_user_id}
/
sessions
/
{session_id}
/
context
Get Context
curl --request GET \
--url https://api.recallrai.com/api/v1/users/{custom_user_id}/sessions/{session_id}/context \
--header 'X-Recallr-Api-Key: <x-recallr-api-key>' \
--header 'X-Recallr-Project-Id: <x-recallr-project-id>'import requests
url = "https://api.recallrai.com/api/v1/users/{custom_user_id}/sessions/{session_id}/context"
headers = {
"X-Recallr-Project-Id": "<x-recallr-project-id>",
"X-Recallr-Api-Key": "<x-recallr-api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {
'X-Recallr-Project-Id': '<x-recallr-project-id>',
'X-Recallr-Api-Key': '<x-recallr-api-key>'
}
};
fetch('https://api.recallrai.com/api/v1/users/{custom_user_id}/sessions/{session_id}/context', 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.recallrai.com/api/v1/users/{custom_user_id}/sessions/{session_id}/context",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-Recallr-Api-Key: <x-recallr-api-key>",
"X-Recallr-Project-Id: <x-recallr-project-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.recallrai.com/api/v1/users/{custom_user_id}/sessions/{session_id}/context"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Recallr-Project-Id", "<x-recallr-project-id>")
req.Header.Add("X-Recallr-Api-Key", "<x-recallr-api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.recallrai.com/api/v1/users/{custom_user_id}/sessions/{session_id}/context")
.header("X-Recallr-Project-Id", "<x-recallr-project-id>")
.header("X-Recallr-Api-Key", "<x-recallr-api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.recallrai.com/api/v1/users/{custom_user_id}/sessions/{session_id}/context")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Recallr-Project-Id"] = '<x-recallr-project-id>'
request["X-Recallr-Api-Key"] = '<x-recallr-api-key>'
response = http.request(request)
puts response.read_body{
"is_final": true,
"context": "# Relevant memories and context."
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Query Parameters
Type of recall strategy.
Available options:
low_latency, balanced, agentic, auto Required range:
5 <= x <= 50Required range:
10 <= x <= 100Required range:
0.2 <= x <= 0.8Required range:
0.2 <= x <= 0.8Required range:
1 <= x <= 100Required range:
1 <= x <= 20Was this page helpful?
⌘I

