Developer Guide
Add the SDK to your site, capture consent, verify it on your server, and manage consent records and data-subject rights requests with the Digital Anumati APIs.
Overview
The Digital Anumati web SDK renders the cookie banner and data-collection notices on your site and records each visitor's decisions. Because the browser doesn't know who the visitor is, your backend then verifies each submission, which links the consent to your own id for that person.
Browser widget
Session init, notice fetch, and consent submit run in the browser with the registered application origin and browser cookies.
Server verification
Your backend calls transaction verification to attach the consent to a real person by referenceId before you treat it as valid.
Consent lifecycle
List consents, inspect purpose records and history, grant or withdraw a purpose, and renew or erase records when needed.
DPR workflows
Submit and track access, correction, erasure, grievance, and withdrawal requests under the DPDP rights workflow.
Platform capabilities
One-line integration
Complete consent management via a single lightweight script. No complex setup, dependency conflicts, or repeated deployments.
Dynamic trigger engine (40+ events)
Page load, route change, clicks, form submit, scroll depth, timers, fetch/XHR, DOM mutations, visibility changes, and more.
Zero-code trigger updates
Create, edit, enable, or disable triggers from the dashboard — no frontend code changes or redeployments needed.
Smart SPA detection
Native support for React, Next.js, Vue, Angular, and Nuxt with automatic route-change and dynamic DOM detection.
Secure & privacy focused
Secure consent storage, isolated event handling, controlled API communication, and a privacy-first architecture.
Actions & GTM tracking
The GTM blocker gates every tag and pixel on the visitor's real-time consent state — no extra configuration needed.
Installation
Install the SDK
Load the SDK once, as early as possible, so it's ready before any trigger fires. On the web, add it inside <head>; in mobile apps (Android, iOS, Flutter, React Native), initialize it at app launch. Pick your platform below and replace YOUR_SITE_KEY and YOUR_APPLICATION_ID with the values from your application in the dashboard.
Mount the consent SDK inside <head> using next/script with strategy="beforeInteractive" so the widget is ready before the first paint.
// Next.js — add to app/layout.tsximport Script from "next/script"; export default function RootLayout({ children }: { children: React.ReactNode }) { return ( <html lang="en"> <head> {/* Digital Anumati Consent SDK */} <Script src="https://cdn.digitalanumati.com/widget/uat/v1/anumati-dpdp-consent-v1.js" data-site-key="YOUR_SITE_KEY" application-id="YOUR_APPLICATION_ID" strategy="beforeInteractive" /> </head> <body>{children}</body> </html> );}Serve from the registered URL
Notice types
Digital Anumati supports two notice types. A cookie banner is shown to anonymous visitors on page load, while a data collection notice appears on a form or action such as login, booking, contact, upload, or account access and is linked by a trigger key.
| Notice type | Where it appears | Who it is for | Key field |
|---|---|---|---|
| cookie | On page load for every visitor | Anonymous browser visitors | bannerType=cookie |
| data_collection | On forms and data-entry flows | Known or later-identified people | bannerType=data_collection + triggerKey |
Each data collection form is linked to a configured trigger key such as login_account_data_processing_consent, home_collection, contact_us, or upload_prescription. Ask your Digital Anumati admin for the trigger keys used in your application.
Usage
Show a data collection notice on triggers
Configure a trigger in the dashboard (for example signup_click or checkout_submit), then mark any element on your page with da-trigger. When the visitor activates it, the SDK opens the data-collection notice so they can review and consent before the action proceeds.
<form action="/checkout" method="POST"> <button type="submit" da-trigger="checkout_submit"> Complete purchase </button></form>When the visitor submits, the SDK returns a transactionId. Send it to your backend together with the form data.
End-to-end flow
- 1
Initialize the session
Call Session init once per page load before any other widget request so the visitor identity and browser cookies are created.
- 2
Fetch the notice
Call Get notice with bannerType=cookie or data_collection and the relevant triggerKey to load the published purposes and data elements.
- 3
Render the form
Show the banner or form fields, including required purposes and the specific data element descriptions for each purpose.
- 4
Submit consent decisions
Send one decision per purpose shown, with granted/rejected/withdrawn statuses and the purposeId returned by the notice response.
- 5
Verify on the server
Pass the returned transactionId and consentId to your backend and call Transaction verify using your referenceId for the person.
The browser never decides the person's identity. It only records the decision for a visitor or form flow. Your backend is the system of record that says “this consent belongs to person X and is now linked with referenceId Y.”
Decision rules
| Rule | Meaning |
|---|---|
| Send one decision for every displayed purpose | A purpose not included is treated as declined. |
| granted vs rejected | Ticked = granted; left unticked = rejected. |
| Required purposes | A purpose with isRequired=true must be granted before the form is valid. |
| withdrawn | Use withdrawn to take back an earlier granted decision. |
Browser APIs
All API paths on this page are relative to the base URL https://apis.digitalanumati.com.
Browser calls run from your website JavaScript and must be sent with the browser's session cookies. The request must come from the URL registered on the application and include credentials: 'include' so the cookies are stored and sent with later requests.
fetch(url, { method: 'POST', credentials: 'include', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload)});Session init
Creates or reuses a visitor identity and stores a short-lived session along with cookies such as _da_pid, _da_fp, _da_did, and _da_sid.
| Method | Path | Auth | Purpose |
|---|---|---|---|
| POST | /api/v1/sdk/web-widget/session/init | None | Creates the browser session and identity cookies. |
| GET | /api/v1/sdk/web-widget/banner/notice | None | Fetches the published notice and purpose metadata. |
| POST | /api/v1/sdk/web-widget/consent-capture/submit | None | Records the visitor's consent choices. |
| GET | /api/v1/sdk/web-widget/consent-capture/status | None | Reads the current browser consent state for the application. |
Get notice
Returns the published notice for rendering: the purpose list, data elements, descriptions, and UI settings. For cookie banners, the response says whether the banner should be shown to the visitor. For data collection notices, it contains the triggerKey-specific purpose list for the form.
| Parameter | Required | Description |
|---|---|---|
| bannerType | Yes | cookie or data_collection |
| triggerKey | For data_collection | Which form is being shown |
| language | No | Language code such as en or hi |
| applicationId | No | Resolved from page origin when omitted |
Submit consent
The request body includes bannerType, one decision per purpose, and optional triggerKey / referenceId. For each purpose, send the purposeId from the notice snapshot and a status.
| Field | Required | Description |
|---|---|---|
| bannerType | Yes | cookie or data_collection |
| decisions | Yes | One item per purpose shown on the notice |
| triggerKey | For data_collection | Same trigger key used in Get notice |
| referenceId | No | Your id for the person if already known |
| identifiers | No | Optional email or phone values tied to the form |
The response returns transactionId, consentId, referenceId, and a purpose list with the final outcome. Keep the transactionId — your backend needs it for server verification.
Other browser operations
| Endpoint | Purpose |
|---|---|
| POST /api/v1/sdk/web-widget/consent-capture/withdraw | Withdraws previously granted cookie purposes for the visitor. |
| POST /api/v1/sdk/web-widget/consent-capture/toggle | Flips existing cookie purposes between granted and withdrawn. |
| POST /api/v1/sdk/web-widget/parental-consent-requests | Creates a parent approval request for a minor and sends a verification link. |
Server verification
Right after your backend saves the form, call Transaction verify with the transactionId and your stable referenceId for the person (for example a customer id, email, or mobile number). This links the consent to that person.
| Method | Path | Auth | Purpose |
|---|---|---|---|
| POST | /api/v1/server/transaction/verify | x-api-key | Links a submitted consent to the person using referenceId and returns a verified consent summary. |
curl -X POST "https://apis.digitalanumati.com/api/v1/server/transaction/verify" \ -H "Content-Type: application/json" \ -H "x-api-key: <SERVER_API_KEY>" \ -d '{ "transactionId": "81e74f0e-6f90-4ed2-9873-da87bd0597aa", "referenceId": "user@example.com", "referenceIdFlag": "email", "referenceInfo": { "email": "user@example.com", "name": "User Name" } }'Use the returned valid flag and overallStatus to decide whether the required consent was given before you continue (for example, before creating a booking). Prefer transactionId so each form submission is verified on its own; if the same person already has a consent for the same notice, the API merges it into that record.
Keep the server API key out of the browser
x-api-key must never be shipped in frontend code.Consent lifecycle
After consent is captured and verified, call the server APIs with the x-api-key header to list records, inspect purpose histories, and change lifecycle state for a person. Use these for privacy center screens and operational consent management.
| Method | Path | Purpose |
|---|---|---|
| GET | /api/v1/sdk/server/consent/management/consents | List all consent records for a person. |
| GET | /api/v1/sdk/server/consent/management/consents/{consentId}/records | Fetch a full consent and all its purpose records. |
| POST | /api/v1/sdk/server/consent/management/consents/manage | Grant, withdraw, reject, renew or erase a purpose record. |
| GET | /api/v1/sdk/server/consent/management/consents/{recordId}/history | Return the status-change history for a single purpose record. |
| GET | /api/v1/sdk/server/consent/records | Return a lite list of current record-level consent state across applications. |
Status values
| Status | Meaning |
|---|---|
| granted | Ticked or accepted |
| rejected | Not ticked when first asked |
| withdrawn | Accepted earlier and later taken back |
| pending | Waiting for a parent to approve (minors) |
Each record includes a purposeSnapshot, the data-element snapshot, retention snapshot, expiry date, and history — use it for a consent detail screen or to audit when a user changed a purpose decision.
DPR requests
A Data Principal Rights request lets the person exercise a right under the DPDP Act. Each request becomes a ticket in the application with a unique identifier such as DPR-2-184DDEDB and a service-level deadline.
| Method | Path | Purpose |
|---|---|---|
| POST | /api/v1/sdk/server/dpr/requests | Create a rights request for access, correction, erasure, nomination, grievance, or withdrawal. |
| GET | /api/v1/sdk/server/dpr/requests | List all DPR requests for the person. |
| GET | /api/v1/sdk/server/dpr/requests/{ticketId} | Fetch one DPR request with details and status history. |
Request details vary by rightType. For example, correction requests include field-level corrections with currentValue and requestedValue, while erasure requests include a consequence acknowledgment and the consentRecordIds to erase.
Reference
Browser cookies used by the widget include _da_pid (visitor id, 1 year), _da_fp (device fingerprint), _da_did (device id), _da_sid (session token), and _da_cs (cookie-banner answer state). If a browser blocks cookies, the API response includes a cookies block — store those values and send them back as request headers on later browser calls.
Troubleshoot
Common errors
| Status | Message | Cause |
|---|---|---|
| 400 | referenceIdFlag must be one of: email, phone, custom | Unknown referenceIdFlag value |
| 400 | referenceId is not a valid email / phone | referenceId doesn't match the format its referenceIdFlag says |
| 400 | referenceId already mapped to this transaction | This transactionId was already verified |
| 400 | referenceInfo.email or referenceInfo.phone is required | Digital Anumati sends messages for this application and no contact was given |
| 401 | Invalid or expired API key | Missing or wrong x-api-key |
| 404 | Consent not found | transactionId / consentId not found for this application |
Integration checklist
| Checklist item | Why it matters |
|---|---|
| Load the SDK once per page, inside <head> | The widget must be ready before any trigger fires. |
| Serve from the URL registered on the application | Requests from other origins are rejected. |
| Session init once per page load | Browser cookies and visitor identity must exist before other widget calls. |
| Use the purposeId from Get notice | Submit consent requires the purposeId from the published notice snapshot. |
| Send one decision per shown purpose | Any missing decision is treated as declined. |
| Verify consent on the server before use | Consent is only linked to a person once your backend verifies it with a referenceId. |
| Keep the server API key out of browser code | The x-api-key header belongs only on backend infrastructure. |
| Track DPR SLAs and consent history | Supports compliance operations, privacy center workflows, and user support. |