Developers

Consent API

Record a person's choices and read their standing from your own systems. Call it from a server only.
Developer pages and contents

Base address

Text
https://api.dpdpgrid.in/api/public/consent/{slug}/v1

{slug} is the workspace's 12-character id. A key opens only its own workspace.

Keys

  • Make a key on the workspace's API tab. It starts with lsc_ and is shown once: DPDPGrid keeps only its hash.
  • Send it in the Authorization header: Bearer lsc_….
  • A workspace can have ten keys in use. Revoke a key on the same tab; it stops working at once.
Server to server only. A call that carries a Cookie header is refused, and the API sends no CORS headers, so a browser cannot read its answers. Keep the key on your server.

Naming the person

contact
An e-mail address, or an Indian mobile number of 10 digits starting with 6 to 9. A +91, 0091, 91 or 0 in front is dropped. E-mail is matched in lower case.
customerId
Your own id for the person: 1 to 80 letters, digits, ., _, : or -.

An e-mail address, a mobile number and a customerId are three separate records, even for one person. Use the same one each time.

Read a person's standing

Text
GET /api/public/consent/{slug}/v1?contact=…
GET /api/public/consent/{slug}/v1?customerId=…
Shell
curl "https://api.dpdpgrid.in/api/public/consent/AbCdEf123456/v1?customerId=CUST-1001" \
  -H "Authorization: Bearer lsc_your_key_here_000000000000"
Response
{
  "standing": {
    "billing": { "action": "GIVEN", "at": "2026-11-16T05:30:00.000Z", "noticeId": "cmexamplenotice000000001" },
    "marketing": { "action": "WITHDRAWN", "at": "2026-11-16T05:31:10.000Z", "noticeId": "cmexamplenotice000000001" }
  }
}
  • standing has the latest event for each purpose the person has answered. A person with no record gets {}.
  • action is GIVEN, WITHDRAWN or EXPIRED (the purpose's keep-for period ended).
  • noticeId is the notice the choice was made against; null for an event not made against a notice, such as an expiry.
  • With both customerId and contact, customerId is used.

Record choices

Text
POST /api/public/consent/{slug}/v1
Content-Type: application/json
person
{ "contact": "…" } or { "customerId": "…" }: exactly one of the two.
noticeId
The id of a notice published now in the workspace (up to 40 characters).
choices
{ [purposeCode]: true | false }. true gives consent, false withdraws it.
note
Optional, up to 200 characters: how the consent was given. Kept with each event.
Request
{
  "person": { "customerId": "CUST-1001" },
  "noticeId": "cmexamplenotice000000001",
  "choices": { "billing": true, "marketing": false },
  "note": "Signed up at the main branch counter"
}
Response
{
  "at": "2026-11-16T05:30:00.000Z",
  "changes": [{ "purposeCode": "billing", "action": "GIVEN" }],
  "standing": {
    "billing": { "action": "GIVEN", "at": "2026-11-16T05:30:00.000Z", "noticeId": "cmexamplenotice000000001" }
  }
}
  • Only purposes in that notice count. Other codes are ignored, and a purpose left out is not changed.
  • Only changes are written. A choice the person already stands on writes nothing, and withdrawing a purpose never given writes nothing.
  • Each change is added to the ledger with the channel API, the key that made it and your note.
  • A notice that is no longer published is refused with notice_changed (409). Read the current notice and ask the person again.

Examples

curl
curl -X POST https://api.dpdpgrid.in/api/public/consent/AbCdEf123456/v1 \
  -H "Authorization: Bearer lsc_your_key_here_000000000000" \
  -H "Content-Type: application/json" \
  -d '{"person":{"contact":"[email protected]"},"noticeId":"cmexamplenotice000000001","choices":{"billing":true}}'
Node.js 18 or later
const res = await fetch("https://api.dpdpgrid.in/api/public/consent/AbCdEf123456/v1", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.DPDPGRID_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    person: { customerId: "CUST-1001" },
    noticeId: "cmexamplenotice000000001",
    choices: { billing: true, marketing: false },
  }),
});
const body = await res.json();
if (!res.ok) throw new Error(`${res.status} ${body.code}`);
console.log(body.changes);
Python 3
import json, os, urllib.parse, urllib.request

url = "https://api.dpdpgrid.in/api/public/consent/AbCdEf123456/v1?" + urllib.parse.urlencode({"customerId": "CUST-1001"})
req = urllib.request.Request(url, headers={"Authorization": "Bearer " + os.environ["DPDPGRID_KEY"]})
with urllib.request.urlopen(req) as res:
    print(json.load(res)["standing"])

Limits

600 calls in any one minute per key. Past that, calls are refused with api_rate (429): wait a little and try again. See Errors and rate limits.

Successful answers are sent with Cache-Control: no-store.

A separate webhook takes notices from a registered Consent Manager's platform. It is only for Consent Managers.

Consent API · DPDPGrid developers