{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/honkio-ca/json-schema/honkio-ca-consent-schema.json",
  "title": "Consent",
  "description": "A consent record as stored: field names are camelCase, unlike the rest of the API.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/honkio-ca-compliance-casl-api-openapi.yml#/components/schemas/Consent",
  "type": "object",
  "additionalProperties": true,
  "required": [
    "id",
    "accountId",
    "channel",
    "phoneNumber",
    "emailAddress",
    "consentType",
    "status",
    "sourceDescription",
    "sourceIp",
    "sourceUrl",
    "relationshipType",
    "expiresAt",
    "grantedAt",
    "revokedAt",
    "revokedReason",
    "doubleOptInConfirmedAt",
    "doubleOptInConfirmationId",
    "consentBatchId"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "accountId": {
      "type": "string"
    },
    "channel": {
      "type": "string",
      "enum": [
        "SMS",
        "EMAIL"
      ]
    },
    "phoneNumber": {
      "type": [
        "string",
        "null"
      ]
    },
    "emailAddress": {
      "type": [
        "string",
        "null"
      ]
    },
    "consentType": {
      "type": "string",
      "enum": [
        "EXPRESS",
        "IMPLIED"
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "ACTIVE",
        "EXPIRED",
        "REVOKED"
      ]
    },
    "sourceDescription": {
      "type": [
        "string",
        "null"
      ]
    },
    "sourceIp": {
      "type": [
        "string",
        "null"
      ]
    },
    "sourceUrl": {
      "type": [
        "string",
        "null"
      ]
    },
    "relationshipType": {
      "type": [
        "string",
        "null"
      ]
    },
    "expiresAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "grantedAt": {
      "type": "string",
      "format": "date-time"
    },
    "revokedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "revokedReason": {
      "type": [
        "string",
        "null"
      ]
    },
    "doubleOptInConfirmedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When the subscriber last confirmed double opt-in by replying YES to an opt-in confirmation from one of your toll-free numbers. A toll-free send needs a confirmation from its own sending number: see GET /v1/compliance/opt-in-confirmations."
    },
    "doubleOptInConfirmationId": {
      "type": [
        "string",
        "null"
      ],
      "description": "The opt-in confirmation (oic_…) they answered."
    },
    "consentBatchId": {
      "type": [
        "string",
        "null"
      ],
      "description": "The bulk upload (cb_…) that recorded this consent; null for one recorded on its own."
    }
  }
}