Consent Integration
Record grant, update, and revoke on the consent ledger. Full schemas: API Reference (Consents).
Overview
Consent is stored as versioned ledger entries per (external_user_id, purpose_code). Actions: GRANT, UPDATE, REVOKE. Each write is idempotent.
Your app owns user identity (external_user_id). Sammati owns consent evidence bound to a policy version.
On the live ledger, successful writes also trigger async proofs and automatic consent.recorded webhooks.
Grant
Record initial consent for a purpose.
await client.consents.grant({
external_user_id: "user-123",
purpose_code: "kyc_verification",
policy_ref: "kyc-verification",
occurred_at: new Date().toISOString(),
});
Required fields: external_user_id, purpose_code, policy_ref, occurred_at. See ConsentWriteBody in the API Reference.
Update
Record a change to an existing consent (for example expanded purposes).
await client.consents.update({ /* ConsentWriteBody */ });
Revoke
Record withdrawal of consent.
await client.consents.revoke({ /* ConsentWriteBody */ });
Lifecycle
(none) → GRANT → UPDATE* → REVOKE
- Each action appends an event and bumps the consent version.
- On the live ledger, proof status moves
PENDING→READY, then Evidence Link JWT and TSA timestamp — Proofs & Anchors. - Automatic
consent.recordedwebhooks run on the live ledger only. On test keys, use Send Test Event.
Callbacks
Sammati does not call your backend synchronously on consent. Use webhooks:
| Event | When |
|---|---|
consent.recorded | After grant, update, or revoke is persisted (live ledger for automatic delivery) |
→ Webhooks
Widget submissions use the same ledger as the session API key. Automatic widget.session.* and consent.recorded follow the same test/live rules.
Status and reads
| SDK method | Purpose |
|---|---|
client.consents.getStatus(params) | Current state for user + purpose |
client.consents.getTimeline(params) | Event history |
client.consents.listRecords(query) | Paginated ledger browse |
client.consents.feed(query) | Compliance / partner feed (metadata only) |
client.consents.getMetrics(query) | Aggregated counts |
In the Company Portal, open Consents to search by customer reference, purpose, and status.

Query parameters and response shapes: API Reference.
Compliance feed
Use client.consents.feed(query?) (GET /v1/consents/feed) for partner / compliance portals.
| Auth | Bearer smm_live_… or smm_test_… (ledger follows the key) |
| Query | limit (1–500, default 200), optional cursor, optional ledger_mode |
| Envelope | { results, nextCursor } |
Feed rows are consent metadata only (user_id = customer reference). No CRM email, phone, or PAN.
Idempotency
All consent writes need Idempotency-Key (the SDK generates one unless you override). See Authentication.
Widget vs direct API
| Path | When |
|---|---|
| Widget submit | User acts in the hosted iframe; session token authorizes submit |
| Direct API grant | Server-side or batch imports; full API key |
Both produce ledger entries (and webhooks on live). See Widget Guide.
Next steps
- Widget Guide — user-facing collection
- Proofs & Anchors — after consent is recorded
- Troubleshooting