Created in 2016, api.gouv.fr is the website that lists public service APIs, made available to local authorities, ministries, and businesses to build digital services for everyone. As part of a project nearing completion, integrated with the French Government Design System (DSFR), we created a module that did not exist in the community: the integration of the CaptchEtat API - https://www.drupal.org/project/captchetat.
The CaptchEtat API
The CaptchEtat API allows you to generate a CAPTCHA consisting of a deformed string of characters to be reproduced. It is intended for interministerial partners or public entities. The API includes:
- An HTML structure;
- Images;
- Sounds;
- Character strings;
- Icons.
The API requires authorization and integrates with the French State Design System (DSFR).
https://api.gouv.fr/les-api/api-captchetat
The Drupal CaptchEtat module
This module seamlessly integrates the CaptchEtat API into Drupal, providing government websites adhering to DSFR standards with enhanced security measures. CaptchEtat, a robust solution available at https://api.gouv.fr/les-api/api-captchetat, is an essential tool for protecting online interactions from automated threats.
Designed to integrate smoothly with the Webform module, this module ensures reliable protection against spam and unauthorized access.
Requirements
This module relies on both the Webform module and the Drupal core.
Configuration
The configuration page is located at admin/config/captchetat/settings, where you can set up the CAPTCHETAT module.
- Go to Administration > Extend and enable the module.
- Go to Administration > Configuration > CAPTCHETAT to access the configuration page.
- On the configuration page, enter the required API keys and URLs: CaptchEtat API
- API URL
- Authentication URL
- Client ID
- Client secret
- Save the configuration.

Development
You can simply add the CAPTCHETAT element to your web forms like other fields.
Adding CAPTCHETAT to the Webform
You can disable captchetat validation in your local or test environment by adding the following line to settings.php:
$settings['disable_captchetat'] = TRUE;
Drupal module: https://www.drupal.org/project/captchetat
GitHub: https://github.com/Agencebluedrop/CaptchEtat