Skip to content

Consent APIs

This document will outline the capabilities of our developer-friendly consent APIs which enable developers to cache privacy experiences on CDNs, encode TC strings on the server, and easily check for changes in consent experiences and notifications.

Prerequisites

  • An account with sufficient permissions to read and configure settings for consent
  • The environment variable: FIDES__CONSENT__TCF_ENABLED must be set to True

Endpoints

Below, you'll find the list of endpoints that have been activated to facilitate developer access to the consent APIs.

GET privacy experiences

  • Request: GET http://localhost:8080/api/v1/privacy-experience
  • Description: Fetches all the privacy experiences across all the regions using query params to filter the response to the desired response.
  • Query params:
    • component=overlay: Instructs the backend to return an overlay type (either regular or TCF).
    • region=eea: a query param to further filter the experiences by region.
    • fides_user_device_id=<fides user device id>: used to supplement the experience with any previously saved preferences for the specified user.
    • include_meta=true: adds a meta section for developer convenience which includes the following subsections:
      • version_hash: generates a hash used to determine when to resurface consent, encoding the TCF policy version, maximum number of purposes, special features, and vendors associated with different legal bases.
      • accept_all_fides_string: generates a TC string for the case where a user has opted in for all vendors, special features and purposes, for all indicated legal bases.
      • accept_all_fides_mobile_data:: a version of the accept_all_fides_string in mobile data format
      • reject_all_fides_string: generates a TC string for the case where a user has opted out for all vendors, special features and purposes, for all indicated legal bases.
      • reject_all_fides_mobile_data: a version of the reject_all_fides_string in mobile data format

Sample request

curl -X 'GET' \
  'http://localhost:8080/api/v1/privacy-experience?show_disabled=true&region=eea&component=overlay&systems_applicable=false&include_gvl=false&include_meta=true&page=1&size=50' \
  -H 'accept: application/json'

PATCH privacy preferences

  • Request: PATCH http://localhost:8080/api/v1/privacy-preferences
  • Description: Used for updating privacy preferences, supported with a minimum request body of just a TC string and a Fides user device id.

Sample request

curl -X 'PATCH' \
  'http://localhost:8080/api/v1/privacy-preferences' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "browser_identity": {
    "fides_user_device_id": "f54b192b-6b97-4312-b5f5-4608eb8f0558"
  },
  "fides_string": "CPzHq4APzHq4AAMABBENAUEAALAAAEOAAAAAAEAEACACAAAA.IAEAEAAA"
}'

GET decoded TC strings

  • Request: GET http://localhost:8080/api/v1/plus/tcf/decode_for_mobile?fides_string=?<tc_string>
  • Description: allows you to pass in a TC string and retrieve the string decoded into a TC mobile data format.
curl -X 'GET' \
  'http://localhost:8080/api/v1/plus/tcf/decode_mobile?fides_string=CPzKwooPzKwooN6AAAENCZCgAPwAAHwAAAAAADtYAEAEAAA.YAAAAAAAAAA.II7Nd_X__bX9n-_7_6ft0eY1f9_r37uQzDhfNs-8F3L_W_LwX32E7NF36tq4KmR4ku1bBIQNtHMnUDUmxaolVrzHsak2cpyNKJ_JkknsZe2dYGF9Pn9lD-YKZ7_5_9_f52T_9_9_-39z3_9f___dv_-__-vjf_599n_v9fV_78_Kf9______-____________8A' \
  -H 'accept: application/json'