Skip to main content

Endpoint

GET /v1/dpdp/consent-records

Authentication

Requires a developer API key in the Authorization header.

Request Headers

HeaderValue
AuthorizationBearer <api_key>

Query Parameters

ParameterTypeRequiredDescription
dataPrincipalIdstringNoFilter records by data principal ID

Example Request

curl "https://grantex-auth-dd4mtrt2gq-uc.a.run.app/v1/dpdp/consent-records?dataPrincipalId=user_abc123" \
  -H "Authorization: Bearer gx_..."

Response — 200 OK

{
  "records": [
    {
      "recordId": "cr_01HXYZ...",
      "grantId": "grnt_01HXYZ...",
      "dataPrincipalId": "user_abc123",
      "dataFiduciaryName": "Acme Corp",
      "purposes": [
        { "code": "analytics", "description": "Usage analytics" }
      ],
      "scopes": ["calendar:read"],
      "consentNoticeId": "notice_v2",
      "status": "active",
      "consentGivenAt": "2026-04-05T12:00:00.000Z",
      "processingExpiresAt": "2027-01-01T00:00:00.000Z",
      "retentionUntil": "2027-01-31T00:00:00.000Z",
      "accessCount": 2,
      "withdrawnAt": null,
      "createdAt": "2026-04-05T12:00:00.000Z"
    }
  ],
  "totalRecords": 1
}

Response Fields

FieldTypeDescription
recordsobject[]Array of consent record objects
totalRecordsnumberTotal number of records returned

Record Object

FieldTypeDescription
recordIdstringUnique consent record ID
grantIdstringThe associated grant ID
dataPrincipalIdstringThe data principal who gave consent
dataFiduciaryNamestringName of the data fiduciary (developer)
purposesobject[]Array of purpose objects ({ code, description })
scopesstring[]Scopes from the associated grant
consentNoticeIdstringID of the consent notice
statusstringRecord status: active, withdrawn, expired, or erased
consentGivenAtstringISO-8601 timestamp of original consent
processingExpiresAtstringISO-8601 processing expiry timestamp
retentionUntilstringISO-8601 data retention limit
accessCountnumberNumber of times this record has been accessed
withdrawnAtstring | nullISO-8601 timestamp of withdrawal (if withdrawn)
createdAtstringISO-8601 creation timestamp

Error Responses

StatusCodeDescription
401UNAUTHORIZEDInvalid or missing API key

SDK Examples

import Grantex from '@grantex/sdk';

const grantex = new Grantex({ apiKey: 'gx_...' });

// List all consent records
const all = await grantex.dpdp.listConsentRecords();

// Filter by data principal
const filtered = await grantex.dpdp.listConsentRecords({
  dataPrincipalId: 'user_abc123',
});