Add plan API and tests