Similar to a contract, an Application Programming Interface (API) aids the communication between software applications. For example, Party A can send a request that is structured in a specific way, and Party B will respond accordingly.
If this API is public, the options available are likely to be well documented, which helps collaboration. For instance, the Crypto.com Exchange features an API so users can build automation on it. The Crypto.com App also uses an API, but it is not publicly documented.
APIs are a secure way to open up access to resources. In a controlled process, the service can choose to see who queries it for data. On the user side, the data can be gathered directly from the service and utilised as variables in the programme that is built.
As an example, a trader who wants to create a bot that automatically trades for them needs access to data from the exchange where the bot is deployed. The trader can make use of APIs to query only the required data by automating any needed requests and parsing the data from the response.