Skip to main content

Overview

The credential event is triggered when a credential is completed or rejected. The event includes credential-specific information and metadata that varies based on the credential type.

Example Payload

{
  "eventType": "credential",
  "issuerId": "680a65a4da4a16c0ea64face",
  "requestId": "68c42ec3e47c9a7f9241e0ba",
  "subjectId": "68c42ec3e47c9a7f9241e0bb",
  "subjectInternalId": "user_98765",
  "rejected": false,
  "decisionDate": "2024-01-15T18:30:00.000Z",
  "credentialId": "cred_abc123def456",
  "credentialType": "consent",
  "internalId": "privacy_consent_001",
  "metadata": {
    "name": "Privacy Policy Agreement",
    "text": "I agree to the collection and processing of my personal data.",
    "required": true,
    "link": "https://example.com/privacy-policy"
  }
}

Base Fields

All credential events include these common fields:
FieldTypeRequiredDescription
eventTypestringYesAlways "credential"
issuerIdstringYesOrganization/issuer identifier
requestIdstringYesRequest identifier
subjectIdstringYesSubject (user) identifier
subjectInternalIdstringNoInternal subject identifier
rejectedbooleanYesWhether the credential was rejected
decisionDateDateYesTimestamp when the credential decision was made

Credential-Specific Fields

FieldTypeRequiredDescription
credentialIdstringYesUnique identifier for the credential
credentialTypestringYesType of credential (see types below)
internalIdstringNoInternal identifier for the credential
metadataobjectNoMetadata specific to the credential type

Credential Types & Metadata

The metadata structure depends on the credentialType: When credentialType is "consent", metadata follows the ConsentEvent structure:
{
  "name": "Privacy Policy Agreement",
  "text": "I agree to the collection and processing of my personal data.",
  "required": true,
  "link": "https://example.com/privacy-policy"
}
FieldTypeRequiredDescription
namestringYesName of the consent
textstringYesConsent text displayed to the user
requiredbooleanYesWhether consent is required
linkstringNoURL to the full consent document

Signature Event

When credentialType is "signature", metadata follows the SignatureEvent structure:
{
  "name": "Contract Signature",
  "url": "https://example.com/document.pdf",
  "required": true
}
FieldTypeRequiredDescription
namestringYesName of the signature
urlstringYesURL to download the signed document via API
requiredbooleanYesWhether signature is required

Form Event

When credentialType is "form", metadata follows the FormEvent structure:
{
  "name": "User Registration Form",
  "data": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john.doe@example.com"
  }
}
FieldTypeRequiredDescription
namestringYesName of the form
dataRecord<string, any>YesForm field data as key-value pairs

JSON Event

When credentialType is "json", metadata follows the JsonEvent structure:
{
  "name": "Custom Data",
  "data": {
    "customField1": "value1",
    "customField2": 123,
    "customField3": true
  }
}
FieldTypeRequiredDescription
namestringYesName of the JSON data
dataRecord<string, any>YesJSON data as key-value pairs