Skip to content
Last updated

Consents

Create consent

To create a consent use the following endpoint: POST /api/Consent

Input

//POST /api/Consent
{
  "agreementGroupGuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "consentGroupGuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "userIp": "string",
  "externalID": "string",
  "environment": 0,
  "screenshot": "string",
  "clauses": [
    {
      "tag": "my_tag",
      "accepted": true
    }
  ],
  "fieldCollection": {
    "name": "name",
    "surname": "surname",
    "email": "name.surname@gmail.com"
  }
}
FieldDescription
AgreementGroupGuidAgreement group connected to the consent
ConsentGroupGuidThis parameter is used if you want to update a previously expressed consent. If you create a new consent or you don't need to modify a previous consent, it can be set to null or to an empty guid. If the agreement feature "Can this agreement be modified?" isn't enabled, this value will be ignored
UserIpThe IP address of the user
ExternalIdThe key used in your software that represents the user
Environment0: staging, 1: production
ScreenshotByte array of an image corresponding to the consent. If the agreement feature "Capture Screenshot" isn't enabled, this value will be ignored
ClausesThe list of conditions set in the agreement
FieldCollectionA JSON where the recipient information is saved or other information you might want to save and associate with the consent

Output

{
  "guid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "agreement": {
    "version": "string",
    "enviroment": 0,
    "groupGuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "nameOfAgreement": "string"
  },
  "fieldCollection": "string",
  "consentDate": "2023-05-03T10:35:07.421Z",
  "platform": "string",
  "userIdentifier": "string",
  "clauses": [
    {
      "tag": "my_tag",
      "accepted": true
    }
  ],
  "agreementHash": "string",
  "externalID": "string",
  "consentGroupGuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "screenshot": "string",
  "userIp": "string"
}
FieldDescription
GuidThe auto generated consent guid
AgreementThe agreement linked to the consent
Agreement.VersionThe version of the agreement
Agreement.Enviroment0 = staging, 1 = production
Agreement.GroupGuidUnique identifier that binds all the versions of a specific agreement
Agreement.NameOfAgreementName of the agreement
FieldCollectionThe same collection as input
ConsentDateCreation date of the consent
PlatformPlatform on which the consent is created (Windows, Android, Macintosh, iPhone, iPad, BlackBerry, CrOS, Linux, Symbian, Others)
UserIdentifierIdentifier of the user who has given the consent; it is automatically extracted from the field collection if there's a field named "email" or "mail" or "e-mail", otherwise it will be saved as an empty string
ClausesThe same collection as input
AgreementHashThe hash that will be sent on the blockchain
ExternalIDThe same as input
ConsentGroupGuidAuto generated guid, useful to modify a consent with this API
ScreenshotThe same as input
UserIpThe same as input

Get consents

To get the consents you use the following endpoint: POST /api/Consent/List

Input

//POST /api/Consent/List
{
  "agreementGroupGuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "externalID": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "userIdentifier": "string",
  "dateFrom": "2020-04-01T00:00:00.0000000",
  "dateTo": "2030-04-01T00:00:00.0000000",
  "platform": "string",
  "enviroment": 0,
  "version": "string",
  "getScreenshot": true,
  "page": 1,
  "itemsPerPage": 20
}
FieldDescription
AgreementGroupGuidIf set, retrieves the consents related to this specific agreement group guid
ExternalIdIf set, retrieves the consents related to this specific ExternalId
UserIdentifierIf set, retrieves the consents related to this specific UserIdentifier
DateFromIf set, retrieves the consents created starting from this date
DateToIf set, retrieves the consents created up to this date
PlatformIf set, retrieves the consents of this specific platform
EnviromentIf set, retrieves consents of a specific environment (0: staging, 1: production)
VersionIf set, retrieves consents related to a specific version of the agreement
GetScreenshotIf set, retrieves the screenshot linked to the consent
PagePage number
ItemsPerPageItems per page

The only required parameters are page and itemsPerPage.
The result collection doesn't include consents related to deleted agreements.
The output is a list of consents corresponding to the search crtiteria.

Output

[
  {
    "guid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "agreement": {
      "version": "string",
      "enviroment": 0,
      "groupGuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "nameOfAgreement": "string"
    },
    "fieldCollection": "string",
    "consentDate": "2023-05-03T10:55:32.675Z",
    "platform": "string",
    "userIdentifier": "string",
    "clauses": [
      {
        "tag": "my_tag",
        "accepted": true
      }
    ],
    "blockchainProcessId": "string",
    "blockchainTxHash": "string",
    "agreementHash": "string",
    "blockchainStatus": 0,
    "blockchainStatusDate": "2023-05-03T10:55:32.675Z",
    "externalID": "string",
    "blockchainUuid": "string",
    "screenshot": "string",
    "consentGroupGuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "userIp": "string"
  }
]
FieldDescription
GuidThe auto generated consent guid
AgreementThe agreement linked to the consent
Agreement.VersionThe version of the agreement
Agreement.Enviroment0 = staging, 1 = production
Agreement.GroupGuidUnique identifier that binds all the versions of a specific agreement
Agreement.NameOfAgreementName of the agreement
FieldCollectionThe JSON given as input in the integrator's APIs or compiled by the user with the required field in the website snippet
ConsentDateConsent creation date
PlatformPlatform on which the agreement is created (Windows, Android, Macintosh, iPhone, iPad, BlackBerry, CrOS, Linux, Symbian, Others)
UserIdentifierIdentifier of the user who has given the consent; it is automatically extracted from the field collection if there's a field named "email" or "mail" or "e-mail", otherwise an empty string
ClausesThe clauses list
Clauses.ClausesTagThe tag you have created in the agreement
Clauses.ClausesAcceptedIf the user accepted or denied
BlockchainProcessIdThe id of the process on the blockchain
BlockchainTxHashThe final hash that represents the success on the consent save on the blockchain (the blockchain may take a bit of time and it may not be valorized immediately after the creation of a consent)
AgreementHashThe agreement hash that will be sent on the blockchain
BlockchainStatusSave status on the blockchain (Registered = 0, Queued = 1, ProcessCreated = 2, Notarized = 3, Error = 4)
BlockchainStatusDateWhen the status of the save on the blockchain changes
ExternalIDThe key used in your software that represents the user
BlockchainUuidUUID generated by the blockchain
ScreenshotThe screenshot generated by creating a consent, if in the agreement the option Capture screenshot is flagged. If there's no screenshot the output is an empty byte array.
ConsentGroupGuidGroup guid of the consent
UserIpThe IP address of the user

Get audit trail PDF

To get the audit trail PDF document you can use the following endpoint:

GET /api/Consent/GetAuditTrail/{consentGuid}

Output

The Audit Trail PDF file.