MemorySyncMemorySync
SDKs

Overview

MemorySync ships two official client libraries — one for Python and one for Node.js / TypeScript — plus a fully documented HTTP API you can call from any language. Each client wraps the same JSON endpoints with typed methods, per-request timeouts, and structured error classes.

The two official clients

There are exactly two official packages. The package names below are what you install — anything else you may see is unofficial.

ClientPackageConstructorInstall command
PythonmemorysyncMemorySyncClientpip install memorysync
Node.js / TypeScriptmemorysync-sdkMemorySyncClientnpm install memorysync-sdk
Why two names?
The PyPI registry has the short name; the npm registry already had a squatter on the short name when we published, so the Node package ismemorysync-sdk. Both export a class called MemorySyncClient.

What the clients cover

Every method on a client maps one-to-one to a public memory route. There are no helper endpoints invented by the SDKs — if a method exists, the route exists.

MethodWhat it does
addSubmit a single piece of text for storage.
bulkAdd / bulk_addSubmit up to 50 items in one call with optional deduplication.
queryRun a semantic recall against the caller’s memories.
getFetch a single memory by its numeric id.
updatePatch tags, importance, metadata, source, or event type on an existing memory.
forgetDelete one or more memories by id.
summarizeCollapse a list of memories into one summary memory.
composeProduce a prompt by recalling memories into a token budget.
exportAll / export_allDownload every memory the caller can read.
createRelation / create_relationLink two memories with a typed relationship.

The shape of every call

Whatever language you use, the lifecycle is the same: build a client once with your API key, call a typed method, get a typed result back or a typed error. The clients never throw bare strings.

PYTHON
from memorysync import MemorySyncClient
client = MemorySyncClient(
api_key="ms_live_...",
base_url="https://api.memorysync.io",
end_user_id="user_123", # required for API-key auth
)
created = client.add(text="Picked the audit log schema we discussed.", tags=["decision"])
hits = client.query("audit log schema", k=5)
TYPESCRIPT
import { MemorySyncClient } from "memorysync-sdk";
const client = new MemorySyncClient({
apiKey: process.env.MEMORYSYNC_API_KEY!,
baseUrl: "https://api.memorysync.io",
endUserId: "user_123", // required for API-key auth
});
const created = await client.add({ text: "Decided to ship behind a flag.", tags: ["decision"] });
const hits = await client.query({ query: "decision behind a flag", k: 5 });

One REST surface, two clients

Both clients hit the exact same REST endpoints with the exact same JSON bodies. If you read the cURL guide and a TypeScript example side by side, you will see the same field names. That is intentional — switching from one client to the other is a syntactic change, not a behavioural one.

Errors are typed and uniform

Both clients ship the same six error classes, named identically. You can write retry logic once and apply it to either runtime.

  • AuthError — HTTP 401 / 403
  • NotFoundError — HTTP 404
  • ValidationError — HTTP 400 / 409 / 422 and client-side guards
  • RateLimitError — HTTP 429, exposes the retry interval
  • ServerError — HTTP 5xx
  • MemorySyncError — the base class; network failures and timeouts also surface as this

Picking a client

  1. If your service is in Python, install memorysync. The sync client is the default; the async client is one extra import when you need it.
  2. If your service is in Node.js, Deno, or any TypeScript runtime that has global fetch, install memorysync-sdk.
  3. If your service is in any other language, hit the REST endpoints directly. The cURL and Postman guides show the full request and response shapes for every route the SDKs expose.

Where to go next