API

POST /api/v1/consents

Register a consent record for a subject, data collection purpose, and validity window.

Register consent

Creates a consent record for a subject and purpose, and stores the associated metadata for audit and monitoring workflows.

POST

Request body

FieldTypeDescription
subjectIdstringUnique external identifier for the data subject or user.
purposestringPurpose name or purpose code associated with the consent.
dataElementsarrayData elements covered by the consent record.
consentSourcestringSource of the consent decision such as web, mobile, or backend.
validFromstringStart timestamp for the consent validity window.
validTostringOptional end timestamp for consent expiration.
curl -X POST https://apis.digitalanumati.com/api/v1/consents \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "subjectId": "user_12345",
    "purpose": "appointment-communication",
    "dataElements": ["mobile_number", "email"],
    "consentSource": "web",
    "legalBasis": "consent",
    "validFrom": "2026-09-28T10:00:00Z",
    "validTo": "2027-09-28T10:00:00Z"
  }'

Example response

{
  "consentId": "c_01J7NM6QX9",
  "status": "active",
  "purpose": "appointment-communication",
  "subjectId": "user_12345",
  "version": 1,
  "grantedAt": "2026-09-28T10:00:00Z"
}

Errors

Validation

If the request is missing required fields or the purpose is invalid, the API returns a 400 response with a structured error payload.