Direct3D. OpenAL. Winsock. You've probably heard of these, you might have even used them before, but one thing is certain: everyone who's ever used a computer will have run a piece of software that's made good use of them.

We're talking about APIs -- the golden fleece to programmers around the world. Join us as we explain just what an API is, and take a quick look at where and how they get used.

What's in a name?

The term API stands for 'Application Programming Interface' but, as we'll soon see, it isn't just for making applications (or to give them their full name, application programs -- apps, for short). In the world of computing, an interface is something that acts as a bridge between two or more aspects of a computing system.

This bridge can be in the form of hardware (e.g. USB) or software, as it is in this case.

Essentially, the interface allows the computing elements to send information to each other; sometimes it's a one-way bridge (e.g. a mouse sending input signals to a laptop, using a USB socket), but they're more likely to be two-way.

In the case of an API, a lot more is going behind the scenes than just passing data about. They set the rules on what requests for data can be made, define how to make those requests, declare the format that the data must be in, and so on. This might seem like it's quite a restrictive thing, but APIs help in making programming much easier.

That's because they effectively hide all the background minutiae and inner workings of the computer system from the programmer and just lets them have access to the tools they need. This does mean that there's going to be lots of different APIs out there, some very broad in scope and nature, and others with a very specific role.

The ones you've probably heard of

If you're a keen PC gamer, then you'll definitely know of some APIs used to create 3D graphics -- the most notable are OpenGL, Direct3D, and Vulkan. These act as the fundamental scaffold to any rendering code, allowing programmers to create complex visuals with relative ease.

Graphics APIs lay down specific rules about how everything should be formatted and structured, and offer simple instructions to handle routine math algorithms. All of them have been significantly updated over the years and can be used to do more than just make pretty images, all thanks to compute shaders.

Gaming platforms other than PCs also use APIs -- Microsoft uses a modified version of Direct3D for the Xbox, but Nintendo and Sony use their own for the Switch and PlayStation, although they both have roots in OpenGL.

If playing on phones is your thing, then there are graphics APIs for them too, such as Metal, which is exclusive to Apple's products.

Readers may recall that in the 1990s, certain graphics cards vendors had their own APIs -- 3dfx had Glide and S3 Graphics had S3D. This was down to the fact that the likes of OpenGL was relatively new, and lacked the feature set and performance required by the manufacturers.

For a while, Glide was the king of graphics APIs, as it was easy to program with and showed off 3dfx's Voodoo in the best possible light. Glide and S3D had very brief lifespans, as they were highly proprietary -- Direct3D isn't open source, but other than being limited to Windows, any GPU vendor can make drivers to support it on their products.

That said, proprietary graphics APIs are still in use today. Nvidia's CUDA API is exclusive to their GPUs, although it is aimed at general purpose compute work, rather than 3D rendering.

Back in 2013, AMD started work in collaboration with the developers of the Battlefield games, to make a 'low level' API.

The term 'low level' refers to the hardware abstraction in the API -- software routines that effectively hide the specific details of the core architecture of the chip from the developer, making it easier to write a program that will work across a range of platforms. The more work the API has to done in this area, the greater the amount of CPU workload is required to process it all.

AMD's goal for Mantle was for it to be less CPU dependent than Direct3D and OpenGL, as well as offer more programmability. Development of the project halted in 2015 and completely shelved by 2019, as AMD had handed over their work, free of charge, to the Khronos Group -- the organization responsible for Vulkan.

APIs aren't just for pretty pictures

Games are more than just visual things: there's audio, networking, and input management to all be coded for. Direct3D is actually part of a large collection called DirectX, which contains APIs and software libraries for all of the aforementioned game elements.

For example, DirectInput handles commands from gamepads, joysticks, and steering wheels. Naturally, there are OpenGL equivalents for these too (e.g. OpenAL for audio), although some can be covered by the operating system, which we'll explore in a moment.

And speaking of communicating with hardware, there's a veritable host of APIs to allow programmers to access and utilize the multitude of capabilities that phones typically have. For example, almost every modern phone will have an accelerometer -- a tiny chip that detects movement in three dimensions.

So if an app wants to know in which direction the phone is pointing, the programmers can use an API to easily garner that information.

Augmented reality apps, such as a stargazing one, are a good example of software that will use such APIs. And if it's one that displays what constellations you're looking, as you point the phone at the night sky, it will to use an API for the camera, accelerometer, GPS system, the touchscreen, and so on.

If an app is going to integrate with any social media platform, like Twitter or Facebook, then yet again -- there are APIs for those, too! Even if you don't know what they're called, you will almost certainly have used a program that's been created via these APIs.

Where there's computing, there are APIs

Two important, but quite specific, classes of APIs are Remote and Web, with the latter being a subset of the former. These are designed for applications that run on one system, but access and manipulate data on another system -- the browser you're using to read this website is an example of an app using both APIs.

Some of these APIs are never released to the public (aka Private APIs), and can only be used by the organization that made them, for their own internal applications.

Others are semi-private, known as Partner APIs, which are leased to approved users; the idea being that the API owner controls exactly what data is being requested by the application. Ever used an app to book a ride share? That'll be using a Private Remote API.

But most of the apps we use on computers will have been made using Public ones. Windows-based PCs will have been written to use Windows API (usually just called WinAPI) and macOS, iOS, Linux, Android, et al. all offer a veritable athenaeum of publicly available programming interfaces.

Just like DirectX, these are a collection of libraries that provide an enormous array of shortcuts for handling everything from data storage, to system services and security, as well as creating common GUI elements, networking, and program management.

Now, while quite a few readers will know about the likes of WinAPI and Cocoa, perhaps fewer will know of POSIX. Although this isn't an API in itself, it is a set of standards, created by the IEEE Computer Society, for the creation of cross-platform applications, and by proxy, this also includes APIs.

It was originally intended for Unix systems and is now implemented by a whole host of different operating systems. Windows, though, sits somewhat on the fence, with only a small number of APIs following the standards. That said, the majority of APIs today are user friendly, robust, and pretty efficient at what they do -- they may not be officially POSIX-compliant, but they've been shaped by the rules.

All hail the API

So that's application programming interfaces in a nutshell. If you're into coding, be it as a seasoned professional or taking your first steps into the unholy abyss that is Stack Overflow, then you'll certainly already know about APIs and be very grateful for their existence.

But even if you're just a computer user -- a keen PC gamer, an office worker, or rampant app store aficionado -- then knowing a little bit about APIs is no bad thing. Take the very first example we gave: Red Dead Redemption 2. If you play this game, it's definitely worth your time experimenting with how well it performs using Direct3D and Vulkan.

Depending on your setup, one API may give you better frame rates or more consistent stability compared to the other. It's a shame more game developers don't offer this, but it's obviously a lot more work to manage, and this is almost certainly true across any software platform.

The next time you're browsing TechSpot on your phone, managing purchase ledgers in a spreadsheet, or even setting up a new tablet for kids to use, give a silent thanks to the creators of APIs. Without them, there would be far less software around, and those in use would definitely have a lot more bugs and inconsistencies abound!

Masthead by Andrey Suslov