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.

app/layout.tsx
// Next.js — add to app/layout.tsx
import 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

The widget only works on the website URL registered on your application. Add every domain (including staging) under the application before testing.

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 typeWhere it appearsWho it is forKey field
cookieOn page load for every visitorAnonymous browser visitorsbannerType=cookie
data_collectionOn forms and data-entry flowsKnown or later-identified peoplebannerType=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.

HTML
<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. 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. 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. 3

    Render the form

    Show the banner or form fields, including required purposes and the specific data element descriptions for each purpose.

  4. 4

    Submit consent decisions

    Send one decision per purpose shown, with granted/rejected/withdrawn statuses and the purposeId returned by the notice response.

  5. 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

RuleMeaning
Send one decision for every displayed purposeA purpose not included is treated as declined.
granted vs rejectedTicked = granted; left unticked = rejected.
Required purposesA purpose with isRequired=true must be granted before the form is valid.
withdrawnUse 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.

CODE
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.

MethodPathAuthPurpose
POST/api/v1/sdk/web-widget/session/initNoneCreates the browser session and identity cookies.
GET/api/v1/sdk/web-widget/banner/noticeNoneFetches the published notice and purpose metadata.
POST/api/v1/sdk/web-widget/consent-capture/submitNoneRecords the visitor's consent choices.
GET/api/v1/sdk/web-widget/consent-capture/statusNoneReads 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.

ParameterRequiredDescription
bannerTypeYescookie or data_collection
triggerKeyFor data_collectionWhich form is being shown
languageNoLanguage code such as en or hi
applicationIdNoResolved from page origin when omitted

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.

FieldRequiredDescription
bannerTypeYescookie or data_collection
decisionsYesOne item per purpose shown on the notice
triggerKeyFor data_collectionSame trigger key used in Get notice
referenceIdNoYour id for the person if already known
identifiersNoOptional 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

EndpointPurpose
POST /api/v1/sdk/web-widget/consent-capture/withdrawWithdraws previously granted cookie purposes for the visitor.
POST /api/v1/sdk/web-widget/consent-capture/toggleFlips existing cookie purposes between granted and withdrawn.
POST /api/v1/sdk/web-widget/parental-consent-requestsCreates 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.

MethodPathAuthPurpose
POST/api/v1/server/transaction/verifyx-api-keyLinks a submitted consent to the person using referenceId and returns a verified consent summary.
CODE
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

Call Transaction verify from your backend only. The x-api-key must never be shipped in frontend code.

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.

MethodPathPurpose
GET/api/v1/sdk/server/consent/management/consentsList all consent records for a person.
GET/api/v1/sdk/server/consent/management/consents/{consentId}/recordsFetch a full consent and all its purpose records.
POST/api/v1/sdk/server/consent/management/consents/manageGrant, withdraw, reject, renew or erase a purpose record.
GET/api/v1/sdk/server/consent/management/consents/{recordId}/historyReturn the status-change history for a single purpose record.
GET/api/v1/sdk/server/consent/recordsReturn a lite list of current record-level consent state across applications.

Status values

StatusMeaning
grantedTicked or accepted
rejectedNot ticked when first asked
withdrawnAccepted earlier and later taken back
pendingWaiting 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.

MethodPathPurpose
POST/api/v1/sdk/server/dpr/requestsCreate a rights request for access, correction, erasure, nomination, grievance, or withdrawal.
GET/api/v1/sdk/server/dpr/requestsList 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

StatusMessageCause
400referenceIdFlag must be one of: email, phone, customUnknown referenceIdFlag value
400referenceId is not a valid email / phonereferenceId doesn't match the format its referenceIdFlag says
400referenceId already mapped to this transactionThis transactionId was already verified
400referenceInfo.email or referenceInfo.phone is requiredDigital Anumati sends messages for this application and no contact was given
401Invalid or expired API keyMissing or wrong x-api-key
404Consent not foundtransactionId / consentId not found for this application

Integration checklist

Checklist itemWhy 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 applicationRequests from other origins are rejected.
Session init once per page loadBrowser cookies and visitor identity must exist before other widget calls.
Use the purposeId from Get noticeSubmit consent requires the purposeId from the published notice snapshot.
Send one decision per shown purposeAny missing decision is treated as declined.
Verify consent on the server before useConsent is only linked to a person once your backend verifies it with a referenceId.
Keep the server API key out of browser codeThe x-api-key header belongs only on backend infrastructure.
Track DPR SLAs and consent historySupports compliance operations, privacy center workflows, and user support.