#📚reference
Application Program Interface, or API, is a contract between a program and its clients regarding using this program by other programs.
> [!example] As an example
> Think of a website that accepts credit card payments. The window to specify payment details is part of the _user_ interface. It is built for people. However, the way this website communicates with a bank is defined by a sequence of APIs. One may be for the web page to communicate with the back-end server to update subscription status, another - for contacting the payment gateway, and so on.
---
In modern [[software development]], the lion's share of time is spent on either consuming or building APIs. Saying that a programming language has a developed ecosystem usually means that one can easily find an API for most problems.
**Key principles for building a good API**:
1. **Consistency** ("no magic") - means understanding what will happen when making an API call. If other API calls change how the request will be processed, this should be clear for the caller.
2. **Predictability** ("no surprise") - implies that API won't suddenly change the next day, rendering one's code useless.
Great APIs are usually boring, because they are created for others to build interesting stuff; not to be interesting themselves.
---
<font style="color: #F86759">Contributors:</font> *[[Mykhailo]]*
<font style="color: #F86759">Last edited:</font> *2024-03-27*