api: move implementation to own file