HAProxy deny request by IP using API

Hi community

we want to implement a request deny blacklist by country specific but not downloading ip from RIRs.
I mean we can use an API_KEY from some service to keep database update.
is possible deny by country using “http-request { exec some script [%src-ip] … }” if I have a service with API_Key and set haproxy configuration to deny ?

is probable to grow the cache limit to avoid load repeting this request
where can i found the documentation to some example usefull or correct configuration to do this?

that line was an example pseudo-code configuration
we are using 2.3.7 version

Perhaps take a look at this project: