Skip to main content
Version: v1.0

SDK Guide

Use the official SDKs to call Sammati from your backend or browser. HTTP shapes follow the API Reference.


Packages​

PackageRoleAvailability
@sammati/server-sdkBackend HTTP client (recommended)npm
@sammati/widget-sdkBrowser iframe + postMessage — Widget Guidenpm
@sammati/webhook-utilsWebhook HMAC verification — Webhooksnpm
@sammati/cliTerminal client — CLIAvailable on request
sammati (Python)Minimal Python clientAvailable on request

@sammati/shared-core is a shared dependency. You normally get it transitively with the Node packages.

For production integrations, use the three npm packages below. CLI and Python are provided on request until they are published to public registries.


Installation​

Install the server SDK:

npm install @sammati/server-sdk

For the hosted widget and webhook verification:

npm install @sammati/widget-sdk @sammati/webhook-utils

You can also copy the install command from Developer → SDK in the Company Portal.


Create a client​

import { SammatiClient } from "@sammati/server-sdk";

const client = new SammatiClient({
apiKey: process.env.SAMMATI_API_KEY!,
environment: "test", // must match smm_test_ vs smm_live_ prefix
baseUrl: process.env.SAMMATI_BASE_URL, // optional; defaults to production API
});

createSammatiClient(options) returns the same client.


Additional tools (on request)​

CLI and Python clients call the same integrator API. Contact Sammati support or your account team to receive them. Command overview: CLI.

When these packages are published publicly, this guide will list the standard npm / pip install commands.


Services​

APIs are grouped by domain on the Node client:

ServiceCovers
client.consentsGrant, update, revoke, status, feed
client.policiesDraft, publish, versions
client.proofsProofs and verification
client.anchorsTimestamp / anchor metadata
client.auditAuditor comparison helpers
client.webhooksEndpoints, test delivery, rotation
client.widgetSessions and hosted widget

Full operation list: API Reference


Configuration​

OptionPurpose
apiKeyBearer token (smm_test_* or smm_live_*)
environment"test" or "live" — must match the key prefix
baseUrlAPI origin (for example your staging API host)
timeoutMsPer-request timeout
retryRetry policy for safe requests
transportCustom fetch / mock for tests
apiKeyProviderAsync key rotation without recreating the client

Retries​

The SDK retries safe requests on transient failures (NetworkError, RateLimitError, ServerError, TimeoutError). Writes with an explicit Idempotency-Key may retry; other POSTs are limited.

Configure with retry: { maxAttempts, baseDelayMs, maxDelayMs, jitterRatio }.


Errors​

Typed errors extend SammatiError: AuthenticationError, ValidationError, RateLimitError, ConflictError, NotFoundError, ServerError, NetworkError, TimeoutError.

Each includes HTTP status, message, requestId, and parsed details from the API body.


Pagination​

List endpoints return cursor pages. Pass limit and cursor on list methods. Examples: listConsentRecords, listPolicyVersions, listWebhookEndpoints.


Webhook helpers​

From @sammati/webhook-utils (also re-exported by the server SDK):

  • verifyWebhookSignature() / verifyWebhookDelivery()
  • parseWebhookEvent()
  • computeWebhookSignature() (for tests)
  • client.webhooks.testEndpoint() — queue a sample delivery

Details: Webhooks


Examples​

Runnable TypeScript samples ship with @sammati/server-sdk (grant, revoke, policy, webhooks, proofs). On the docs site, see SDK examples.


Next steps​