How does an API work?