Skip to main content

Endpoint

GET /v1/dpdp/data-principals/:principalId/records

Authentication

Requires a developer API key in the Authorization header.

Request Headers

HeaderValue
AuthorizationBearer <api_key>

Path Parameters

ParameterTypeRequiredDescription
principalIdstringYesThe data principal ID

Example Request

curl https://grantex-auth-dd4mtrt2gq-uc.a.run.app/v1/dpdp/data-principals/user_abc123/records \
  -H "Authorization: Bearer gx_..."

Response — 200 OK

{
  "dataPrincipalId": "user_abc123",
  "records": [
    {
      "recordId": "cr_01HXYZ...",
      "grantId": "grnt_01HXYZ...",
      "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": 3,
      "lastAccessedAt": "2026-04-05T14:00:00.000Z",
      "withdrawnAt": null,
      "withdrawnReason": null,
      "createdAt": "2026-04-05T12:00:00.000Z"
    }
  ],
  "totalRecords": 1
}

Response Fields

FieldTypeDescription
dataPrincipalIdstringThe data principal ID
recordsobject[]Array of consent record objects
totalRecordsnumberTotal number of records

Record Object

FieldTypeDescription
recordIdstringUnique consent record ID
grantIdstringThe associated grant ID
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 (incremented on each call)
lastAccessedAtstringISO-8601 timestamp of last access
withdrawnAtstring | nullISO-8601 timestamp of withdrawal (if withdrawn)
withdrawnReasonstring | nullReason for withdrawal (if withdrawn)
createdAtstringISO-8601 creation timestamp
Each call to this endpoint increments the accessCount on all returned records, providing a built-in audit trail of data access for DPDP compliance.

Error Responses

StatusCodeDescription
401UNAUTHORIZEDInvalid or missing API key

SDK Examples

import Grantex from '@grantex/sdk';

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

const { records, totalRecords } = await grantex.dpdp.listPrincipalRecords('user_abc123');