Algo trading is making a machine learning model that you train on (historical) data and then run the trained part of the model on new data to see if it accurately predicted.
So in the stock market as it's a continuous thing you have a regression model most of the time, but classification is also possible. classification in a stock market can be green or red as opposites, or up and down. So you can do this without an api as you can load in historical data from 4 years back and test it on historical data from 3 years back.
If you wanna go realtime you gotta have a pipeline that feeds your model data at realtime. An Application Programming Interface (API) is helpful as it is a way of communication between two systems. So you can ask through the API in the case of algo trading for the short interest, Implied volatility, options price, stock price etc all in real time and it sends you that information in a format, normally JSON or XML. Then if you are a bit handy you can make use of that data gathered from the API to feed it into your model, or make a pipeline yourself where you decide based on the data what you feed into your model. And at that point it becomes proper machine learning by fine tuning the model. If you are satisfied with the results of the model and you want to place it against the market then you are officially algo trading. Just having a trained model run the stockmarket for you based on data given and parameters you set yourself.