Not legal advice
dpdpkit is software that helps you implement obligations under India's Digital Personal Data Protection Act, 2023 and the DPDP Rules, 2025. It does not provide legal advice and does not guarantee compliance.
Consent and notices¶
ConsentService
¶
ConsentService(kit: Kit)
record
¶
record(principal: str, decisions: Mapping[str, bool], *, notice_version: int | None = None, locale: str | None = None, source: str = 'api', metadata: dict[str, Any] | None = None) -> list[ConsentState]
Record one decision per purpose, all against the same notice (no bundled consent).
grant
¶
grant(principal: str, purpose: str, notice_version: int | str | None = None, *, locale: str | None = None, source: str = 'api', metadata: dict[str, Any] | None = None) -> ConsentState
deny
¶
deny(principal: str, purpose: str, notice_version: int | str | None = None, *, locale: str | None = None, source: str = 'api') -> ConsentState
withdraw
¶
withdraw(principal: str, purpose: str, *, source: str = 'api', metadata: dict[str, Any] | None = None) -> ConsentState
Withdraw one purpose. Takes the same single call as granting (withdrawal parity).
check
¶
check(principal: str, purpose: str) -> bool
True when processing for purpose is allowed for principal.
Purposes with a Section 7 legitimate use do not need consent and always return True.
Unknown purposes raise NotFound (a programming error, not a denial).
NoticeService
¶
NoticeService(kit: Kit)
build_content
¶
build_content(*, title: str, links: Mapping[str, str], body: str = '', purposes: Mapping[str, Mapping[str, str]] | None = None, data_items: Mapping[str, str] | None = None) -> NoticeContent
Itemise every registered purpose. For translations, purposes overrides title/description per
purpose and data_items overrides data item names by id; anything not overridden comes from the
registry.
problems
¶
problems(content: NoticeContent) -> list[str]
Everything that stops this content from being published under the active policy.
publish
¶
publish(translations: Mapping[str, NoticeContent], *, actor: str = 'system') -> list[Notice]
Publish a new notice version with one content per locale.
The policy's default language must be present. Every locale must pass problems.