Partial revert API query code