Authentication
The SDK authenticates with an API key generated when you create an Instance in the Synap Dashboard. One key per Instance; rotate or revoke at any time.See Authentication for a detailed walkthrough of API key generation and the credential lifecycle.
SDK versioning
The SDK and the underlying wire protocol are versioned. Non-breaking additions (new fields, new optional parameters) may be added within a major version without notice. Breaking changes ship in new major versions of the SDK; the upgrade path is documented in the Changelog.Pagination
List methods on the SDK return paginated results. Passpage and page_size to control the window:
integer
Page number to retrieve. Defaults to
1.integer
Number of items per page. Defaults to
20. Maximum 100.Rate Limiting
Requests are rate-limited per API key. When the limit is exceeded, the SDK raisesRateLimitError. Tier limits:
The SDK automatically retries with exponential backoff on rate-limit errors. The exception carries the server’s
Retry-After:
Correlation IDs
Every SDK call records a correlation ID: a unique identifier propagated through the full request lifecycle, including background jobs like ingestion. Read it from a context response’s metadata, or from any Synap error:Always include the
correlation_id when contacting support. It allows the team to trace the exact request path and identify issues quickly.Error handling
The SDK raises typed exceptions for different failure classes. Each exception exposes acode (machine-readable), a message (human-readable), and a details object with context:
SynapError and split into two branches: SynapTransientError (the SDK auto-retries) and SynapPermanentError (your code must handle). Common exceptions:
For the full hierarchy and per-exception handling guidance, see Error Handling. For wire-level error codes (when interpreting the server’s
code field), see Error Codes.
SDK installation
The official Python SDK is the primary customer interface.Reading these examples in JavaScript or TypeScript
The examples throughout this reference are written in Python. They translate mechanically, because the two SDKs share namespaces, method names and field names exactly. Two differences, and that is all:- Python passes keyword arguments; JavaScript passes one options object.
- Python’s
MaximemSynapSDK()is JavaScript’snew SynapClient(), and itsinitialize()/shutdown()are spelled the same.
Field names stay snake_case in JavaScript on the namespaced surface, so a
Python example’s argument names can be copied across unchanged. The flat
surface (
fetchUserContext, searchMemory) is the exception: it returns the
normalised camelCase shape. Pick one style per codebase.The JavaScript SDK is a native Node.js client requiring Node.js 20+. Context and memory operations run on Node, Vercel Edge, Cloudflare Workers and the browser. The optional anticipation stream needs raw TCP and so is Node only. See Installation → JavaScript and TypeScript SDK.
See the Installation guide for full setup instructions for both SDKs.