This is the documentation to use iubenda’s API JSON, which allows you to generate a privacy policy through a single call and to recall the data at any time through the transaction ID.
The unique key that each subject authorized to use the API holds.
POST
api/transactions, type create_privacy_policy
https://www.iubenda.com/api/transactions
<!-- wp:preformatted {"className":"prettyprint linenums js-code"} --> <pre class="wp-block-preformatted prettyprint linenums js-code">"api_key" => // una API Key valida (required) "type" => "create_privacy_policy" // (required) "test" => // "true" | "false" (optional, default: false) "args" => { "user" => { "email" => // user's email (required) "lang" => // "it" or "en", (optional, default: "it") } // "user" "privacy_policy" => { "url" => // URL of the website for which you need to generate the privacy policy (required) "langs" => // Languages of the policy "it" or "en" (optional, default: "it") "owner" => { "info" => // Information about the Data Controller (required) "email" => // contact email address to add to your privacy policy (optional, default: user's email) } // "owner" } // "privacy_policy" } // "args" </pre> <!-- /wp:preformatted -->
If the user whose email is provided isn’t in the system yet, an account will be created.
If the user whose email is provided is already in the system, the privacy policies will be added anyway.
Moreover, if the user is already in the system, their current password must be provided together with their email. In relation to the previous example, the input will be:
... "args" => { "user" => { "email" => // user's email (required) "pwd" => // user's current password } // "user" ...
"transaction_id" => // id of the transaction that was created (null if the transaction is a test (test => true) ) "output" => { // the field will be present if the transaction is executed correctly (success => true) "user" => { "id" => // ID of the user we created (or to whom we added the privacy policy, if the user is already registered) "email" => // email of the user we created or edited } // "user" "privacy_policies" => [ // hashing array, one for each privacy policy that was added, each hash has the following structure: { "id" => // ID of the privacy policy we added "lang" => // language of the privacy policy we added ("it" or "en") "setup_url" => // url to access the setup of the privacy policy we added "edit_url" => // url to access the edit panel of the privacy policy "policy_url" => // direct link to the privacy policy "embed_code" => // embedding code of the privacy policy } ] // "privacy_policies" } // "output" "errors" => // array of error messages (empty if the transaction was successful) "success" => // true or false "api_version" => "1.0" "test" => // true or false (based on the parameter of the input test)
The “setup_url” e “edit_url” values are programmed to provide links that carry out the user’s automatic login, thus they don’t need authentication.
When the user uses one of these links for the first time (and hasn’t previously registered), the user is asked to set their password before proceeding.
POST
https://www.iubenda.com/api/transactions
POST Data
"api_key" => "c4f88fe3247f7df3f232025438596d54b59b76f8", "type" => "create_privacy_policy", "args" => { "user" => { "email" => "test.mail@iubenda.com", }, "privacy_policy" => { "url" => "http://www.example.com", "owner" => { "info" => "Iubenda Srl, Via Monti, 52 - Milano (MI) - Italia", "email" => "owner.mail@iubenda.com" } } }
RESPONSE (JSON)
=> { "success" => true, "transaction_id" => 1, "output" => { "user" => { "id"=> 6269, "email" => "test.mail@iubenda.com" }, "privacy_policies" => [ { "id" => 19276, "lang" => "it", "setup_url" => "https://www.iubenda.com/it/privacy-policy-generator/19276/services?l_email=test.mail@iubenda.com&l_tok=enL39d1xhk1RPPRuW8U5", "edit_url" => "https://www.iubenda.com/it/privacy-policy-generator/19276/edit?l_email=test.mail@iubenda.com&l_tok=enL39d1xhk1RPPRuW8U5", "policy_url" => "https://www.iubenda.com/privacy-policy/193847" "embed_code" => "<a href=\"https://www.iubenda.com/privacy-policy/193847\" class=\"iubenda-white no-brand iubenda-embed\" title=\"Privacy Policy\">Privacy Policy</a><script type=\"text/javascript\">(function (w,d) {var loader = function () {var s = d.createElement(\"script\"), tag = d.getElementsByTagName(\"script\")[0]; s.src = \"https://cdn.iubenda.com/iubenda.js\"; tag.parentNode.insertBefore(s,tag);}; w.addEventListener ? w.addEventListener(\"load\", loader, false) : w.attachEvent(\"onload\", loader);})(window, document);</script>" } ] }, "errors" => [], "api_version" => "1.0", "test" => false }