OdooWiki OCA HUB

Fastapi Captcha

fastapi_captcha folder_open OCA/rest-framework open_in_new
Tools License: AGPL-3

This module provides a simple way to protect several fastapi endpoints routes with a captcha.

It currently supports the following captcha providers:

  • Google reCAPTCHA
  • hCaptcha
  • Altcha

auto_awesome What this module does

AI-generated from the code · Odoo 18.0

Protect selected FastAPI routes in Odoo with a captcha (Google reCAPTCHA, hCaptcha or Altcha). Users configure the captcha on each FastAPI endpoint and requests must include a valid captcha token.

This module adds captcha protection to FastAPI endpoints configured in Odoo. On the FastAPI endpoint form, a new "Use Captcha" checkbox appears after the "Save HTTP Session" option. When checked, a Captcha group becomes visible where you choose the provider (Recaptcha, Hcaptcha or Altcha), enter the secret key, optionally list route patterns to protect, set a minimum score, and for Altcha optionally provide a custom verification URL.

Business rules and automatic behaviour: - If no route patterns are given, all routes of the endpoint are protected. - Route patterns are comma-separated regular expressions; Odoo validates them and shows an error if one is invalid. - Incoming requests must carry a captcha token in the X-Captcha-Token header; otherwise access is denied. - The token is verified against the chosen provider's service. If verification fails, or if the returned score is below the minimum score (default 0.5), access is denied. - The secret key field is restricted to system administrators and can be provided through server environment configuration.

The module extends the fastapi.endpoint model and adds a captcha middleware and dependency to the FastAPI application. It does not add new menus; configuration is done directly on the FastAPI endpoint form.

Depends on

Required by other modules

Models and fields (1)
  • fastapi.endpoint · extends an existing modeluse_captcha, captcha_type, captcha_secret_key, captcha_routes_regex, captcha_minimum_score, captcha_custom_verify_url

Text generated by AI (DeepSeek) from reading the Odoo 18.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub

Availability by version

Reviewed: 2026-11-03
Confirmed (verified in repository and branch) Estimated (unverified) No information

Confirmation status: 1 confirmed, 8 with no information of 9 versions.

Sources · Odoo 18.0

Confirmed on 2026-11-03 in branch 18.0 of OCA/rest-framework.

terminal Installation and usage

OCA documentation · Odoo 18.0

Check the Use Captcha checkbox in your FastAPI endpoint to enable captcha validation, then enter your captcha provider, secret key and an array of route url regex.

Every matching route will now require a valid captcha token in the X-Captcha-Token header.

No verified information in OCA: Installation, Configuration.

info

Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.