Get Events - Mem0
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
API Documentation
Python Example
import requests
url = "https://api.mem0.ai/v1/events/"
headers = {"Authorization": "Token <api-key>"}
response = requests.request("GET", url, headers=headers)
print(response.text)
JavaScript Example
const options = {method: 'GET', headers: {Authorization: 'Token <api-key>'}};
fetch('https://api.mem0.ai/v1/events/', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
cURL Example
curl --request GET \
--url https://api.mem0.ai/v1/events/ \
--header 'Authorization: Token <api-key>'
Go Example
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.mem0.ai/v1/events/"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Token <api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PHP Example
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mem0.ai/v1/events/",
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: Token <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Java Example (Unirest)
HttpResponse<String> response = Unirest.get("https://api.mem0.ai/v1/events/")
.header("Authorization", "Token <api-key>")
.asString();
Ruby Example
require 'uri'
require 'net/http'
url = URI("https://api.mem0.ai/v1/events/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body
API Response
Status Code: 200
{
"count": 123,
"results": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"event_type": "<string>",
"payload": {},
"metadata": {},
"results": "<array>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"started_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z",
"latency": 123
}
],
"next": "<string>",
"previous": "<string>"
}
Use Cases
- Dashboards: Summarize adds/searches over time by paging through events.
- Alerting: Poll for
FAILEDevents and trigger follow-up workflows. - Audit: Store the returned payload/metadata for compliance logs.
Authorizations
Authorization: string (header, required)
API key authentication. Prefix your Mem0 API key with 'Token '. Example: 'Token your_api_key'
Response Schema
- count: integer (required) - Total number of events matching the filters.
- results: object[] (required) - Array of event objects.
- next: string | null - URL for the next page of results.
- previous: string | null - URL for the previous page of results.