Python
# To use the Python SDK, install the package:
# pip install memobase
from memobase import MemoBaseClient
client = MemoBaseClient(project_url='PROJECT_URL', api_key='PROJECT_TOKEN')
user = client.get_user('user_id')
user.update_profile(profile_id="profile_id", content="I am a software engineer", topic="career", sub_topic="job")// To use the Go SDK, install the package:
// go get github.com/memodb-io/memobase/src/client/memobase-go@latest
import (
"fmt"
"log"
"github.com/memodb-io/memobase/src/client/memobase-go/core"
)
func main() {
projectURL := "YOUR_PROJECT_URL"
apiKey := "YOUR_API_KEY"
// Initialize the client
client, err := core.NewMemoBaseClient(
projectURL,
apiKey,
)
if err != nil {
log.Fatalf("Failed to create client: %v", err)
}
// Get a user
userID := "EXISTING_USER_ID" // Replace with an actual user ID
user, err := client.GetUser(userID, false)
if err != nil {
log.Fatalf("Failed to get user: %v", err)
}
// Update a profile
profileID := "EXISTING_PROFILE_ID" // Replace with an actual profile ID
err = user.UpdateProfile(profileID, "value2", "topic2", "sub_topic2")
if err != nil {
log.Fatalf("Failed to update profile: %v", err)
}
fmt.Printf("Successfully updated profile with ID: %s
", profileID)
}
curl --request PUT \
--url https://api.memobase.dev/api/v1/users/profile/{user_id}/{profile_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"content": "<string>",
"attributes": {}
}
'const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({content: '<string>', attributes: {}})
};
fetch('https://api.memobase.dev/api/v1/users/profile/{user_id}/{profile_id}', 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.memobase.dev/api/v1/users/profile/{user_id}/{profile_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'content' => '<string>',
'attributes' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.put("https://api.memobase.dev/api/v1/users/profile/{user_id}/{profile_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"content\": \"<string>\",\n \"attributes\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.memobase.dev/api/v1/users/profile/{user_id}/{profile_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"content\": \"<string>\",\n \"attributes\": {}\n}"
response = http.request(request)
puts response.read_body{
"data": {},
"errno": 0,
"errmsg": ""
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}User Profiles
Update User Profile
Update the real-time user profiles for long term memory
PUT
/
api
/
v1
/
users
/
profile
/
{user_id}
/
{profile_id}
Python
# To use the Python SDK, install the package:
# pip install memobase
from memobase import MemoBaseClient
client = MemoBaseClient(project_url='PROJECT_URL', api_key='PROJECT_TOKEN')
user = client.get_user('user_id')
user.update_profile(profile_id="profile_id", content="I am a software engineer", topic="career", sub_topic="job")// To use the Go SDK, install the package:
// go get github.com/memodb-io/memobase/src/client/memobase-go@latest
import (
"fmt"
"log"
"github.com/memodb-io/memobase/src/client/memobase-go/core"
)
func main() {
projectURL := "YOUR_PROJECT_URL"
apiKey := "YOUR_API_KEY"
// Initialize the client
client, err := core.NewMemoBaseClient(
projectURL,
apiKey,
)
if err != nil {
log.Fatalf("Failed to create client: %v", err)
}
// Get a user
userID := "EXISTING_USER_ID" // Replace with an actual user ID
user, err := client.GetUser(userID, false)
if err != nil {
log.Fatalf("Failed to get user: %v", err)
}
// Update a profile
profileID := "EXISTING_PROFILE_ID" // Replace with an actual profile ID
err = user.UpdateProfile(profileID, "value2", "topic2", "sub_topic2")
if err != nil {
log.Fatalf("Failed to update profile: %v", err)
}
fmt.Printf("Successfully updated profile with ID: %s
", profileID)
}
curl --request PUT \
--url https://api.memobase.dev/api/v1/users/profile/{user_id}/{profile_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"content": "<string>",
"attributes": {}
}
'const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({content: '<string>', attributes: {}})
};
fetch('https://api.memobase.dev/api/v1/users/profile/{user_id}/{profile_id}', 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.memobase.dev/api/v1/users/profile/{user_id}/{profile_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'content' => '<string>',
'attributes' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.put("https://api.memobase.dev/api/v1/users/profile/{user_id}/{profile_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"content\": \"<string>\",\n \"attributes\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.memobase.dev/api/v1/users/profile/{user_id}/{profile_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"content\": \"<string>\",\n \"attributes\": {}\n}"
response = http.request(request)
puts response.read_body{
"data": {},
"errno": 0,
"errmsg": ""
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Update a specific profile in a user’s long-term memory.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The ID of the user
The ID of the profile to update
Body
application/json
⌘I