Skip to main content
Version: v1.0

Authentication

Integrator APIs use a Bearer API key from the Company Portal. Full request shapes: API Reference.


API keys​

Authorization: Bearer smm_test_<secret>
PrefixLedgerWhere to create
smm_test_Test / sandboxCompany Portal → API keys → Test
smm_live_ProductionCompany Portal → API keys → Live (gated by go-live readiness)

Keys are hashed at rest. The raw key is shown once at creation — store it in a secrets manager.

In the Company Portal, go to API keys.

API key reveal (shown once)

The SDK checks that your key prefix matches environment: "test" | "live" — SDK Guide.


Test vs Live​

AspectTestLive
API key prefixsmm_test_smm_live_
Data isolationSeparate test ledger per companyProduction ledger
Proof / receipt / timestampLimited — SandboxFull evidence pipeline
Automatic consent webhooksNot enqueued — use Send Test Eventconsent.recorded after grant/update/revoke
Webhook endpoint testingSend Test Event / testEndpoint()Same test path + automatic production delivery

Never use a test key in production, or a live key in CI against test data.


Headers​

HeaderWhenPurpose
AuthorizationSecured routesBearer <api_key>
Idempotency-KeyPOST/PATCH writesSafe retries; duplicate detection
X-Request-IdOptionalClient correlation; echoed in errors
X-Trace-IdOptionalDistributed tracing
X-Sammati-Embed-OriginWidget session createParent page origin for embed security
Content-TypeBodiesapplication/json

The SDK attaches auth, idempotency (on writes), and request IDs automatically.


Idempotency​

Write operations (consent grant, policy publish, webhook create, and similar) accept Idempotency-Key. Replaying the same key with the same body returns the original result instead of creating duplicates.

The SDK generates idempotency keys on write methods unless you pass options.idempotencyKey.


Trace IDs​

Pass X-Trace-Id (or SDK options.traceId) to correlate logs with Sammati support. Error responses may include x-request-id — log it.


Security best practices​

  1. Never commit keys — use environment variables or a secret manager.
  2. Rotate keys on schedule and after personnel changes (portal rotate flow).
  3. Verify webhooks with HMAC before processing — Webhooks.
  4. Restrict widget origins — register only your production domains under Allowed origins.
  5. Use test keys in development only; promote to live through the go-live flow.
  6. Always call production APIs over HTTPS.

Error responses​

Authentication failures return 401 with a typed error body. The SDK maps these to AuthenticationError.


Next steps​