An API provides a means for one piece of code to talk to another in a way that both will understand by providing instructions and tools.
This is especially relevant if one piece of code is written in another language to the other.
Some examples being: