Behind almost every successful web application, there is an easy-to-use & feature-rich API as they simply help the main application to spread into others & reached by more users.
Also, an API-enabled application can be easily developed further using the API itself.
In order to create an API for your web application, here are 10 tutorials to get you started. But before that, you may want to checkout the video: How To Design A Good API and Why it Matters by Google.
http://www.webresourcesdepot.com/how-to-create-an-api-10-tutorials/