Skip to main content

Python SDK

pip install supermemory

JavaScript SDK

npm install supermemory
Both SDKs also work against self-hosted Supermemory running supermemory-server v0.0.9 or later. Pass baseUrl: "http://localhost:6767" (TypeScript) or base_url="http://localhost:6767" (Python) when creating the client.

Install the TypeScript SDK

Start a TypeScript client

One rule for every call: URL values first as positional arguments (namespace, then id where there is one), then a single object with everything else. A namespace scopes memories to one user, workspace, or tenant, and you pass it on every call.

Add

dreaming defaults to "dynamic", which batches memory extraction. A fresh namespace can show zero memories and an empty profile for minutes. Pass dreaming: "instant" in quick-start flows and anywhere the next step is a memory search or a profile read.
searchMode is "hybrid" (default), "memories", or "chunks". Filter on metadata with a typed expression:
Two defaults changed from the legacy SDK: threshold is now 0.3 (was 0.6) and searchMode is now hybrid (was memories). Set both explicitly if you compare results against old code.

Profile

Buckets group profile facts under names you define:

List

type is required: "documents", "chunks", or "memories". The response always has documents, chunks, memories, and pagination, and only the requested array is filled. Pass { filter } to narrow the list.

Documents

uploadFile is multipart, so metadata is a JSON string there. delete can return partial failures, so check errors as well as count.

Memories

dryRun is required on forgetMatching. Preview with dryRun: true, review matches, then forget by id. There is no direct memory create or update: ingest or update the source document instead.

Namespaces

Organization

Connectors

OAuth providers (notion, google-drive, onedrive, gmail, github) return an authorization link. Config providers start syncing right away and return authorization: null:
sync returns { id, status: "queued" } and responds with 409 if a sync is already running.

Error handling

Every HTTP error throws a SupermemoryError with statusCode, body, and rawResponse. Common statuses have their own subclasses, all exported from the package root: BadRequestError (400), UnauthorizedError (401), PaymentRequiredError (402), ForbiddenError (403), NotFoundError (404), ConflictError (409), InternalServerError (500), and ServiceUnavailableError (503). A timeout throws SupermemoryTimeoutError; a network failure is a SupermemoryError without a statusCode.

Timeouts and retries

The client retries connection errors, 408, 429, and 5xx responses twice with backoff. Tune it on the client or per call; the per-call options object is always the optional last argument.