MemorySync
Core Concepts

Scopes & End Users

Scope tells MemorySync which application workload and end user a trusted server is acting for. Use it consistently on every write and query.

The three values in a server request

ValuePurposeWhere it comes from
API keyAuthenticates your trusted server.A server-side environment variable or secret manager.
Project IDSelects the application or workload.Your MemorySync project.
End-user IDSelects the person your server is acting for.A stable opaque ID from your application.

Configure the scope once

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",
)

Choose a safe end-user ID

  • Use the same ID whenever your server represents the same person.
  • Use an opaque application identifier, not an email address or access token.
  • Do not accept an arbitrary end-user ID from the browser without checking that the signed-in user is allowed to use it.
  • Changing the ID creates a different memory scope.

Use projects as workload boundaries

Use separate projects when applications, environments, or teams should not share memory. A project-locked API key is authoritative; do not send a conflicting project header. Archive projects through the documented project lifecycle rather than assuming deletion behavior.

Sessions are context, not scope

An optional session_id can connect related queries. It does not change ownership and must never be used as an access-control boundary.