Get consent history
ListConsentHistoryAsync
Retrieves the consent history of the consent subject, newest first. Consent, re-consent, decline, withdrawal, and deletion are each recorded as one entry per item. Use it to build a screen where users check their own consent records, or to check the terms at the time of consent as evidence.
Call parameters
| Field name | Type | Required | Description |
|---|---|---|---|
request | ListConsentHistoryRequest | Required | Request object. ArgumentNullException is thrown if it is null |
request.CompanyCode | string | Required | Company code. The part before the first . of the App ID |
request.ServiceCode | string | Required | Service code |
request.SubjectKey | string | Required | Identifier of the consent subject |
request.Page | int | Optional | Page number to retrieve. Starts at 1, and the default is 1 |
request.Size | int | Optional | Number of history entries per page. From 1 to 100, and the default is 20 |
context | ApiCallContext? | Optional | Per-call settings object |
Call example
TermsListConsentHistoryResult result = await terms.ListConsentHistoryAsync(new ListConsentHistoryRequest
{
CompanyCode = companyCode, // Company code: the part before the first '.' of the App ID
ServiceCode = "SAMPLE",
SubjectKey = subjectKey, // same consent subject as in the status query
Page = 1,
Size = 20,
});
switch (result)
{
case TermsListConsentHistoryResult.Success success:
foreach (ConsentHistoryEntry entry in success.Data.Items)
{
// Show the history with entry.Action, entry.ItemId, and entry.CreatedAt.
// You can open the terms page at the time of consent with entry.VersionPageUrl.
}
AxylOffsetPage? meta = success.Data.Meta;
bool hasNext = meta != null && meta.Page.Number < meta.Page.TotalPages;
break;
case TermsListConsentHistoryResult.ServiceNotFound:
// Check the company code and the service code.
break;
case TermsListConsentHistoryResult.Failure failure:
Debug.LogError($"[Terms] {failure.Problem.ExternalCode} (trace: {failure.Problem.TraceId})");
break;
case TermsListConsentHistoryResult.UnknownOutcome unknown:
Debug.LogWarning($"[Terms] Unknown outcome: {unknown.Code}");
break;
// Safety net: unhandled results
default:
Debug.LogWarning($"Unhandled result: {result.GetType().Name}");
break;
}
Response data
Data.Items holds the list of history entries (ConsentHistoryEntry), newest first. It is an empty list if there is no history or the page is out of range.
| Field name | Type | Description |
|---|---|---|
Id | string | History ID |
Action | ConsentActionValue | History type. One of the ConsentAction values below |
TermId | string | Terms ID |
Version | int | Terms version number |
ItemId | string | Terms item ID |
ItemRevisionId | string | Terms item version ID |
Agreed | bool | Whether the user consented |
Country | string? | Country code at the time of consent. null if no country was specified |
Language | string | Language at the time of consent |
Channel | string? | The Channel passed when consent was saved |
VersionPageUrl | string? | URL of the terms page at the time of consent. null if there is none |
CreatedAt | DateTimeOffset | Time the history entry was recorded |
Action | Meaning |
|---|---|
Agree | Consent |
Reconsent | Re-consent |
Decline | Optional consent declined |
Withdraw | Optional consent withdrawn |
Erase | Current consent deleted |
Page information is held in Data.Meta.Page (AxylOffsetPagination).
| Field name | Type | Description |
|---|---|---|
Data.Meta.Page.Number | int | Current page number. Starts at 1 |
Data.Meta.Page.Size | int | Page size |
Data.Meta.Page.TotalElements | long | Total number of history entries |
Data.Meta.Page.TotalPages | int | Total number of pages. 0 if there is no history |
Notes
- Consent history remains even after Delete consent.
- Do not cache the consent status or consent history; retrieve them whenever you need them.
- To check an item's content as it was at the time of consent, call Get the previous terms content with the
TermId,ItemId, andItemRevisionIdof the history entry.