Execute external script from endpoint.ps1?

I have some PowerShell scripts that I’d like to call from a REST API. I was able to easily setup an endpoint. Now all I want to do is to call my scripts from it by using, for example, invoke-command or invoke-expression. This does not seem to work and I cannot find documentation on this. Would appreciate if somebody could point me in the right direction.

You should be able to call whatever commands you like from the API. Are you seeing an error when attempting to do so in an endpoint?