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 project when the API key is organization-wide. Omit it when the key is already locked to a project.$MEMORYSYNC_PROJECT_ID
X-End-User-IDScopes memory to the represented user.user-123
Content-TypeDeclares JSON request bodies.application/json

Where the project ID comes from

  • Open the project menu in the dashboard header. Every project shows its ID. The ID is proj_ followed by 16 hexadecimal characters.
  • Creating an API key while a project is selected locks the key to that project. MemorySync then resolves the project from the key, so Python and Node.js can omit MEMORYSYNC_PROJECT_ID, and cURL can omit X-Project-ID.
  • An organization-wide key still requires the header. Copy the ID from the project menu and set MEMORYSYNC_PROJECT_ID. A header that names a different project than a locked key is rejected.

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.get("MEMORYSYNC_PROJECT_ID") or None,
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 errorIf the key is organization-wide, set X-Project-ID to the ID from the project menu. If the key is project-locked, omit the header or send that same ID.
Missing or unexpected memoryConfirm the same X-End-User-ID and project are used for add and query.
Was this page helpful?