I had problems to find documentation about the MIDI API. Today I found something helpful:
GitHub - steinbergmedia/midiremote-userscripts: A place for user created MIDI Remote API scripts
And a helpful example:
PreSonus FaderPort 2 (2018) midi remote script - Cubase - Steinberg Forums
All this is only available since Cubase Version 12.