- An application programming interface (
API ) issoftware that acts as an intermediary between two programs. APIs make it easy for apps to exchange information, data, pictures, and more.- APIs also let apps have more features, since one program can just ask another program to perform a task.
An API, or application programming interface, is software that acts as an intermediary between two other programs - or two components within a program - to exchange information. APIs are common types of computer code and form the foundation of our modern information architecture.
What to know about APIs
APIs consist of two components, and both are routinely referred to as "the API," which can be confusing:
- The technical specification that defines the details of what information is being exchanged between two programs, and the formal protocol for how that will be done.
- The software itself that serves as the intermediary between two programs.
APIs exist primarily to simplify the process of creating and maintaining software, in addition to extending and enhancing a program's capabilities.
Consider a program like a word processor, for example. In the earliest days of PCs, if a word processor like Microsoft Word needed to print a document, the developers had to include code that allowed the software to communicate with every printer a user might possibly own.
Windows solved that problem by offering a library of printer
This is also an example of how APIs offer a layer of abstraction. The word processor doesn't need to know how to print to a particular printer; it simply sends a print request to the printer API, and the API handles the how of printing.
Types of APIs
APIs are not all alike, and the easiest way to differentiate APIs is by how they're deployed. There are four main categories:
- Private API: Private APIs are typically created within a company or organization for internal use. APIs might be created to "connect" parts of a program or multiple programs and web services within the organization.
- Partner API: This is an API that may be used outside the company or organization but is restricted to partners or clients. Often, these APIs enable products or access to databases that the company offers to clients.
- Public API: Also sometimes called an external or open API, these APIs are generally made available publicly to any developer. Not all public APIs are open source or free - there might be a paid subscription required to use it.
- Composite API: Composite APIs combine different service or data APIs. They sequence multiple API requests into a single request that receives a single response.
API specifications
Because APIs are the glue that binds different programs together, they need to follow standard protocols so that any developers who use the API understand how to integrate it into their code. There are a handful of common specifications in use today.
Each one of these is a different way to standardize the way data is exchanged between programs, which is important since an API should be able to work regardless of how the program is written or even what language is used to code it.
These are the most common protocols used to develop API specifications today:
- Remote Procedure Call (RPC)
- Service Object Access Protocol (SOAP)
- Representational State Transfer (REST)
- GraphQL
APIs in the real world
APIs are a core component of most modern software, so we are surrounded by them. Here are a few examples of APIs in common use:
- Facebook makes its social graph and marketing data available to third-party developers via its pair of Graph and Marketing APIs. The Graph API lets programs read and write to the Facebook social graph with access to pages, users, posts, and more. Likewise, the Marketing API gives access to Facebook ad campaigns, custom audiences, and reports.
- Google maintains dozens of public APIs that allow developers of third-party applications and web services to access Google services. You can see a list of them at Google's API Explorer.
- Twitter offers a web-based Twitter API that lets developers create tweets, search for published tweets, and even favorite tweets programmatically.