Get Memory Context
curl --request GET \
--url https://api.bland.ai/v1/memory/context \
--header 'authorization: <authorization>'import requests
url = "https://api.bland.ai/v1/memory/context"
headers = {"authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {authorization: '<authorization>'}};
fetch('https://api.bland.ai/v1/memory/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.bland.ai/v1/memory/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 => [
"authorization: <authorization>"
],
]);
$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.bland.ai/v1/memory/context"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("authorization", "<authorization>")
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.bland.ai/v1/memory/context")
.header("authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bland.ai/v1/memory/context")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"data": {
"contact_id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
"recentMessages": [
{
"role": "user",
"content": "Has my order shipped yet?",
"channel": "sms",
"timestamp": "2025-07-23T09:10:00.000Z"
},
{
"role": "assistant",
"content": "Yes, order #8821 shipped this morning. Expected delivery is Friday July 25.",
"channel": "sms",
"timestamp": "2025-07-23T09:10:05.000Z"
}
],
"summary": "Customer called about order #8821 which was delayed. Follow-up confirmed the order shipped and is now in transit. Expected delivery July 25.",
"contactFacts": {
"name": "Sarah Chen",
"phone": "+14155550192",
"preferred_contact": "sms",
"timezone": "America/Los_Angeles"
},
"entities": [
{
"entity_type": "order",
"entity_id": "order-8821",
"facts": {
"order_number": "#8821",
"status": "in_transit",
"carrier": "UPS",
"expected_delivery": "2025-07-25"
},
"status": "in_transit",
"last_discussed_at": "2025-07-23T09:10:00.000Z",
"notes": null
}
],
"openItems": [
{
"type": "follow_up",
"description": "Confirm delivery of order #8821 on July 25",
"created_at": "2025-07-23T09:10:00.000Z",
"priority": "medium",
"related_to": {
"entity_type": "order",
"entity_id": "order-8821"
}
}
]
},
"errors": null
}
{
"data": {
"contact_id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
"recentMessages": [],
"summary": null,
"contactFacts": {},
"entities": [],
"openItems": []
},
"errors": null
}
{
"data": null,
"errors": [
{
"error": "BAD_REQUEST",
"message": "persona_id or agent_number is required"
}
]
}
Memory
Get Memory Context
Retrieve the full memory context for a contact scoped to a persona or agent number. Returns everything the agent sees at the start of a conversation: summary, facts, recent messages, entities, and open items.
GET
/
v1
/
memory
/
context
Get Memory Context
curl --request GET \
--url https://api.bland.ai/v1/memory/context \
--header 'authorization: <authorization>'import requests
url = "https://api.bland.ai/v1/memory/context"
headers = {"authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {authorization: '<authorization>'}};
fetch('https://api.bland.ai/v1/memory/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.bland.ai/v1/memory/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 => [
"authorization: <authorization>"
],
]);
$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.bland.ai/v1/memory/context"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("authorization", "<authorization>")
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.bland.ai/v1/memory/context")
.header("authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bland.ai/v1/memory/context")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"data": {
"contact_id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
"recentMessages": [
{
"role": "user",
"content": "Has my order shipped yet?",
"channel": "sms",
"timestamp": "2025-07-23T09:10:00.000Z"
},
{
"role": "assistant",
"content": "Yes, order #8821 shipped this morning. Expected delivery is Friday July 25.",
"channel": "sms",
"timestamp": "2025-07-23T09:10:05.000Z"
}
],
"summary": "Customer called about order #8821 which was delayed. Follow-up confirmed the order shipped and is now in transit. Expected delivery July 25.",
"contactFacts": {
"name": "Sarah Chen",
"phone": "+14155550192",
"preferred_contact": "sms",
"timezone": "America/Los_Angeles"
},
"entities": [
{
"entity_type": "order",
"entity_id": "order-8821",
"facts": {
"order_number": "#8821",
"status": "in_transit",
"carrier": "UPS",
"expected_delivery": "2025-07-25"
},
"status": "in_transit",
"last_discussed_at": "2025-07-23T09:10:00.000Z",
"notes": null
}
],
"openItems": [
{
"type": "follow_up",
"description": "Confirm delivery of order #8821 on July 25",
"created_at": "2025-07-23T09:10:00.000Z",
"priority": "medium",
"related_to": {
"entity_type": "order",
"entity_id": "order-8821"
}
}
]
},
"errors": null
}
{
"data": {
"contact_id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
"recentMessages": [],
"summary": null,
"contactFacts": {},
"entities": [],
"openItems": []
},
"errors": null
}
{
"data": null,
"errors": [
{
"error": "BAD_REQUEST",
"message": "persona_id or agent_number is required"
}
]
}
Headers
Your API key for authentication.
Query Parameters
The unique identifier of the contact.
The persona ID for memory scoping. Either
persona_id or agent_number is required.The agent phone number for memory scoping. Either
persona_id or agent_number is required.Response
The memory context object.
The contact ID this memory belongs to.
Array of recent messages from the sliding window (cross-channel).
Message role: “user” or “assistant”.
Message content.
Channel the message came from: “call” or “sms”.
ISO timestamp when the message was recorded.
Rolling summary of interactions with this contact.
Structured facts about the contact (key-value pairs).
Array of extracted entities associated with this contact.
Array of open items or pending tasks for this contact.
Error array (null on success).
{
"data": {
"contact_id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
"recentMessages": [
{
"role": "user",
"content": "Has my order shipped yet?",
"channel": "sms",
"timestamp": "2025-07-23T09:10:00.000Z"
},
{
"role": "assistant",
"content": "Yes, order #8821 shipped this morning. Expected delivery is Friday July 25.",
"channel": "sms",
"timestamp": "2025-07-23T09:10:05.000Z"
}
],
"summary": "Customer called about order #8821 which was delayed. Follow-up confirmed the order shipped and is now in transit. Expected delivery July 25.",
"contactFacts": {
"name": "Sarah Chen",
"phone": "+14155550192",
"preferred_contact": "sms",
"timezone": "America/Los_Angeles"
},
"entities": [
{
"entity_type": "order",
"entity_id": "order-8821",
"facts": {
"order_number": "#8821",
"status": "in_transit",
"carrier": "UPS",
"expected_delivery": "2025-07-25"
},
"status": "in_transit",
"last_discussed_at": "2025-07-23T09:10:00.000Z",
"notes": null
}
],
"openItems": [
{
"type": "follow_up",
"description": "Confirm delivery of order #8821 on July 25",
"created_at": "2025-07-23T09:10:00.000Z",
"priority": "medium",
"related_to": {
"entity_type": "order",
"entity_id": "order-8821"
}
}
]
},
"errors": null
}
{
"data": {
"contact_id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
"recentMessages": [],
"summary": null,
"contactFacts": {},
"entities": [],
"openItems": []
},
"errors": null
}
{
"data": null,
"errors": [
{
"error": "BAD_REQUEST",
"message": "persona_id or agent_number is required"
}
]
}
Docs for agents: llms.txt
Was this page helpful?
⌘I