We have an internal platform. I'm writing the SDK before the API. My success measure is the following: I should be able to build a clone of the platform using the SDK. Anything I can do with point and click, I could do with the SDK or sending a request. I should be able to build a CLI that manipulates the platform and does all one can do with the web application. I should be able to fork myself, then hire that fork to write a separate front-end that uses our API, feature match the current product, and have a better user experience. I should be able to use the platform as a building block to something else, and it should be trivial.
Once this is possible, it means that almost all the logic is in separate functions, and not intertwined to the "web" application. Which means these functions are more easily tested, and can easily support whatever CLI/"RestfulAPI" one wants.