Skip to main content

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.
Never expose your API key in client-side code, public repositories, or browser requests. API keys should only be used in server-side environments.
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. Pass page 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.
Returned objects include both the data and the pagination envelope:

Rate Limiting

Requests are rate-limited per API key. When the limit is exceeded, the SDK raises RateLimitError. Tier limits: The SDK automatically retries with exponential backoff on rate-limit errors. You can read the limits from the exception:

Correlation IDs

Every SDK call records a correlation ID: a unique identifier propagated through the full request lifecycle, including background jobs like ingestion. Access it from any SDK response:
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 a code (machine-readable), a message (human-readable), and a details object with context:
All SDK exceptions inherit from 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.
A JavaScript/TypeScript SDK is also available for Node.js environments:
From @maximem/synap-js-sdk 0.3.0 the JavaScript client mirrors this namespaced API one-to-one (sdk.conversation.record_message(), sdk.conversation.context.get_context_for_prompt(), sdk.memories.create(), sdk.fetch(), and sdk.{user,customer,client}.context.fetch()) while keeping the flat methods (sdk.addMemory(), sdk.fetchUserContext()) alongside them. See JavaScript / TypeScript SDK.
The JavaScript SDK is a thin Node.js wrapper around the Python SDK and requires a Python 3.11+ runtime on the host. Edge Runtime, Cloudflare Workers, Deno Deploy, and AWS Lambda Node-only runtimes are not supported on the JS SDK. Those platforms need a separate backend with Python 3.11+. See Installation → JavaScript / TypeScript SDK.
See the Installation guide for full setup instructions for both SDKs.