Add input and event handling for api port