Creating an API Endpoint (optional)

Creating an API Endpoint to store user consent information in your backend

By default, Consent stores your user’s consent information in the Transcend backend entirely in the user’s browser. This is sufficient to maintain the user’s consent choices as they navigate your site.

However, if you would like to store and restore the user’s consent information in your own backend, e.g. to ensure that logged-in users’ consent information is persisted across sessions and browsers, you will need to create a custom endpoint to store and return that information.

To store the consent information, the API endpoint needs to accept the data structure returned by airgap.getConsent(), which is documented in the airgap.js API documentation.

To return the consent information, the API endpoint needs to return the data structure expected by airgap.setConsent(), which is documented in the airgap.js API documentation.