HI Catarina,
Add a Input Parameter to the Consume API method and set the Send In as Header. Now the value will be there in header of the Rest Request.

In OnbeforeRequest event you will get the Request object. In that get the value from the header and change the URL
Check the below thread that is useful for your scenario.
https://www.outsystems.com/forums/discussion/41909/how-to-use-localentity-data-value-in-onbeforerequest-in-rest-api/
Best Regards
Devendra