An API allows applications to communicate with each other. It’s not the server or backend itself but the code that controls the access points for the server and enables communication, providing an elegant way to clearly define what kind of data or functionality a system or application can provide and receive from another.
Due to this, APIs are treated more like products than simple code as external consumers are building their systems and products on top of such APIs.
Usually, APIs are transmitting their data in a »headless« format such as JSON or XML and following standards such as REST or GraphQL that are developer-friendly, easily accessible, widely known, and not taking care of the presentation of their data at all as this is the responsibility of the API consumer.
APIs are designed for use by specific consumers (e.g. mobile apps) and are documented in so-called »API contracts« based on tools like OpenAPI (»Swagger«), strictly defining how API requests and responses look like. In addition, different API versions are managed to meet specific user expectations in regard to maintenance and lifecycle management.