Trigger CAPTCHA from worker

Hi, we are using a cloudflare worker assigend to a route. Now we'd like to trigger a CAPTCHA when certain conditions are met. This cannot be done using the WAF (I think) because those conditions include an API call.
Has anyone got any experience with this? And suggested mechanisms?
Was this page helpful?