Each Os has an API for gui?
Not really.
Speaking of linux, it does provide a framebuffer, primitive interface for drawing right into the screen and you'd be likely writing to each pixel or subpixel depending on the driver - in fact you'd interact with the driver directly.
Though, there are some libraries which do it for you.
For example, it is common for Linux based systems to feature X, which is a "server" to which you can send commands, like drawing an image, and it does have an official API (Xlib), but that would be yet quite low level.
There are other libraries which abstract these operation even more and provide you a simple interface for drawing GUIs, for example Tk, GTK+, FLTK, FOX, Qt, etc, which are simpler to deal with.
Windows instead has this api built in to the kernel, and provides you a "mid" level API for drawing GUIs.