Consent Docs

Choose how to withdraw consent

Pick the call that withdraws the right records, from one purpose on one record to everything a person agreed to under any of their identifiers.

How-to2 min readFor web, backend and mobile developers

A withdrawal can reach one purpose, one record or everything a person agreed to. Pick the call by what you hold: a consent id, an identifier, or nothing at all because the person acts on your site.

Pick the call#

You want to Call Reaches
Let a visitor withdraw on your web page PiedapConsent.withdraw() The record this browser wrote
Withdraw a record whose consentId you saved withdrawConsent(consentId) That record
Turn off one purpose and keep the rest updateConsent with granted: false That purpose on that record
Withdraw everything by an email address, phone number, session id or account id withdrawSubject Every record recorded under the identifier or linked to it
Let the person choose on a page you do not build consentPortalLink The records on their Your consents page

withdrawSubject needs the scope subjects:withdraw, and findSubject needs subjects:read. The other server calls need no extra scope.

Turn off one purpose by email address#

  1. Find the person's records by the identifier.

    Node.jsJavaScript
    const found = await client.findSubject('kavya.menon@example.in', 'EMAIL');
    Python
    found = client.find_subject("kavya.menon@example.in", "EMAIL")
  2. Refuse the purpose on each record that allows it.

    Node.jsJavaScript
    const purposeKey = 'class-reminders-by-sms';
    
    for (const record of found.records) {
      const allows = record.decisions.some(
        (d) => d.purposeKey === purposeKey && d.granted,
      );
      if (!allows || record.erasedOn) continue;
      await client.updateConsent(
        record.consentId,
        [{ purposeKey, granted: false }],
        { interaction: 'PREFERENCE_CENTRE' },
      );
    }
    Python
    from piedap_consent import Decision
    
    purpose_key = "class-reminders-by-sms"
    
    for record in found["records"]:
        allows = any(
            d["purposeKey"] == purpose_key and d["granted"]
            for d in record["decisions"]
        )
        if not allows or record["erasedOn"]:
            continue
        client.update_consent(
            record["consentId"],
            [Decision(purpose_key, False)],
            interaction="PREFERENCE_CENTRE",
        )

Each record keeps its other answers. Its status becomes PARTIAL or DENIED, not WITHDRAWN.

Withdraw everything by an identifier#

Call withdrawSubject with the identifier and its type. It reaches records linked to the identifier too, on every form. See Withdraw or erase a person for the code in each language.

Let the person withdraw#

  • On a page of your site, call PiedapConsent.withdraw('Withdrawn from the account page'). See Browser runtime methods.
  • From your server, call consentPortalLink(subjectId, subjectType) and send the person the address it returns. See Hosted pages.

After a withdrawal#

  • One consent.withdrawn webhook arrives for each record withdrawn.
  • A consent check answers allowed: false with reason: "withdrawn".
  • Purposes that are always on stay on.
  • The identifiers stay on the record. To remove them, erase the person.

↑↓ to move, Enter to open