api: create api to be used directly from python code