Hi Uus,
I'm not sure what you mean by "login via API".
The API allows you do do different actions via the command line. Whether you are"logged in" or not, depends in if you pass an API token with the call. That is, if you include your API token when making the API call, you will effectively be "logged in" fro that API call. Note, that once that call is done, if you want to make a second API call, you would need to again pass your API token.
I hope that helps, and feel free to explain more specifically what you're trying to accomplish, if it doesn't.
Gustavo