Refactor api server to use a real spirit object