Mithun interview question

How an API works and how would you construct it