Dynamically generating param values for an API and setting it using session

This means you have another issue besides this first one.

There’s no way to help you if you don’t provide a full reproducer as requested here.