API’s, or Application Programming Interfaces, define how two programs or components hook together.
It is a shame that programmers are so addicted to Three Letter Acronyms (TLAs), because as I use it, the term API could easily be replaced with just “interface” and no information would be lost.
Good software design says that you should write your code as a set of small, reusable components. For instance, it makes no sense to rewrite the same algorithm every time you want to calculate a square root, because you’d never get anything done. Instead, you just import a math library that someone has already written and use their square root function. Every programming language provides a standard math library like this.
The math library has a set of functions you can call to perform common math operations. The specific list of methods that the math library provides is its interface, or API. For example, here is the API documentation for python’s math library.
This list of functions and properties, like math.floor, math.factorial, math.pi etc, is the library's API.
The term “API" is not limited to the interfaces that define components or libraries within a program, but also between programs themselves. For instance, a web app may need to get some data from the backend server. The interface that the backend provides to the frontend is also called an API. If the backend needs to talk to the operating system, such as to write a file, it uses the operating system’s API.
Programs and systems are built out of pieces, and those pieces communicate through APIs. It is a fundamental concept in software design.
Knowing the details of a library or program’s API is the first step towards being able to use it in your own projects, so it pays to get good at locating and understanding API docs. Can you use google to find the API documentation of a python library that you could use to invert a matrix? What is the API for this functionality?