MemorySync
Getting Started

Authentication Setup

Use a MemorySync API key from trusted server code. Each memory request also carries project and end-user scope so the service can return the correct data set.

Required request context

HeaderPurposeExample
X-API-KeyAuthenticates your server.$MEMORYSYNC_API_KEY
X-Project-IDSelects the application or workload.$MEMORYSYNC_PROJECT_ID
X-End-User-IDScopes memory to the represented user.user-123
Content-TypeDeclares JSON request bodies.application/json

Authenticated request example

import os
from memorysync import MemorySyncClient
client = MemorySyncClient(
api_key=os.environ["MEMORYSYNC_API_KEY"],
base_url="https://api.memorysync.io",
project_id=os.environ["MEMORYSYNC_PROJECT_ID"],
end_user_id="user-123",
)
memory = client.add(
"The user prefers concise answers and dark mode.",
source="chat",
metadata={'conversation_id':'conv-42'},
)

Handle keys safely

  • Load keys from environment variables or a managed secret store.
  • Call MemorySync from your backend, never directly from untrusted browser code.
  • Use separate credentials for separate environments and workloads.
  • Rotate a key if it may have appeared in source control, logs, or client output.
  • Return only the data your own application authorizes to its clients.

Choose a stable end-user identifier

Use the same opaque identifier whenever your server acts for the same person. Generate it in your own system and avoid direct personal information such as email addresses. Changing the identifier creates a different memory scope.

Troubleshoot authentication

SymptomCheck
Authentication errorConfirm the environment variable is loaded and the key is active.
Project scope errorConfirm X-Project-ID identifies a project available to the key.
Missing or unexpected memoryConfirm the same X-End-User-ID and project are used for add and query.
Was this page helpful?