Partial revert, restore API in the stable branch.
This partially reverts commit 93a7777ae7dc618c26094f73a2c9e034a2a6f678.