Add API endpoint for services, fix misplaced error defs