I know Windows has WinAPI and I know its basics, but I know nothing about a Linux counterpart. Does Linux have an API too? And is there online documentation of it?
The linux kernel API is found in section 2 of the man pages.
However, whereas the Windows API has functions to create windows etc, the linux API does not; the linux graphical desktop is implemented using X, which is a separate API.