How can I call the iFrame API from within inside the APP?

Like I need to execue this from within a custom js function on a self-hosted server.

api.executeCommand('toggleTileView');

APP.store.getState()[“features/video-layout”].tileViewEnabled = true || false

Thanks