Skip to content

5-minute DPDP quickstart

Mint a scoped API key, create a profile, publish a cited privacy notice, install the 4.94 KB gzipped banner loader, and export a verifiable receipt pack.

View .mdOpen llms.txt

1. Mint a scoped API key

Call POST /v1/keys with the website owner's email and the narrowest scopes needed. Store the returned pgk_ secret in POLICYGRAIN_API_KEY and never commit it to git.

curl -X POST https://api.policygrain.com/v1/keys \
  -H "Content-Type: application/json" \
  -d '{"email": "owner@example.in", "scopes": ["documents", "sites:write"]}'

2. Create a profile and generate cited notices

Read GET /v1/questions to see the pinned Tier 1 question set, create a profile with POST /v1/profiles, trigger POST /v1/generations, and publish the approved version to pages.policygrain.com.

bash
curl -X POST https://api.policygrain.com/v1/generations \
  -H "Authorization: Bearer $POLICYGRAIN_API_KEY" \
  -H "Idempotency-Key: gen-001" \
  -H "Content-Type: application/json" \
  -d '{"profile_id": "prof_01..."}'

3. Verify your domain and embed Consent Banner v2

Register your site with POST /v1/sites, verify domain ownership via DNS TXT or HTTPS well-known file at POST /v1/sites/{id}/domains/{domain}/verify, publish your banner config, and drop the single script tag into your root layout.

<script
  src="https://cdn.policygrain.com/b/v1/loader.js"
  data-pg-site="site_01..."
  async
></script>

4. Verify in Chromium and export signed receipts

Run POST /v1/sites/{id}/verifications to confirm the banner loads before optional scripts fire, then inspect daily Ed25519 Merkle roots at GET /v1/sites/{id}/seal and export a date-bounded JSON/CSV evidence pack.