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')
uid = client.add_user({"ANY": "DATA"})
// To use the JavaScript SDK, install the package:
// npm install @memobase/memobase
import { MemoBaseClient } from '@memobase/memobase';
const client = new MemoBaseClient(process.env.MEMOBASE_PROJECT_URL, process.env.MEMOBASE_API_KEY);
const userId = await client.addUser({ANY: "DATA"});
// 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/google/uuid"
"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)
}
// Add a user
userID := uuid.New().String()
data := map[string]interface{}{"ANY": "DATA"}
_, err = client.AddUser(data, userID)
if err != nil {
log.Fatalf("Failed to add user: %v", err)
}
fmt.Printf("User added with ID: %s
", userID)
}
curl --request POST \
--url https://api.memobase.dev/api/v1/users \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {},
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.memobase.dev/api/v1/users",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
],
'id' => '<string>',
'created_at' => '2023-11-07T05:31:56Z',
'updated_at' => '2023-11-07T05:31:56Z'
]),
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.post("https://api.memobase.dev/api/v1/users")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {},\n \"id\": \"<string>\",\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"updated_at\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.memobase.dev/api/v1/users")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": {},\n \"id\": \"<string>\",\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"updated_at\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>"
},
"errno": 0,
"errmsg": ""
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Manage Users
Create User
Create a new user with additional data
POST
/
api
/
v1
/
users
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')
uid = client.add_user({"ANY": "DATA"})
// To use the JavaScript SDK, install the package:
// npm install @memobase/memobase
import { MemoBaseClient } from '@memobase/memobase';
const client = new MemoBaseClient(process.env.MEMOBASE_PROJECT_URL, process.env.MEMOBASE_API_KEY);
const userId = await client.addUser({ANY: "DATA"});
// 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/google/uuid"
"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)
}
// Add a user
userID := uuid.New().String()
data := map[string]interface{}{"ANY": "DATA"}
_, err = client.AddUser(data, userID)
if err != nil {
log.Fatalf("Failed to add user: %v", err)
}
fmt.Printf("User added with ID: %s
", userID)
}
curl --request POST \
--url https://api.memobase.dev/api/v1/users \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {},
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.memobase.dev/api/v1/users",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
],
'id' => '<string>',
'created_at' => '2023-11-07T05:31:56Z',
'updated_at' => '2023-11-07T05:31:56Z'
]),
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.post("https://api.memobase.dev/api/v1/users")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {},\n \"id\": \"<string>\",\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"updated_at\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.memobase.dev/api/v1/users")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": {},\n \"id\": \"<string>\",\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"updated_at\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>"
},
"errno": 0,
"errmsg": ""
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Create a new user in the memory system with additional user-specific data. This endpoint initializes a new user entity that can store and manage memories.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Response
Successful Response
⌘I