Code for the API application