Skip to main content
U.S. flag

An official website of the United States government

Back to Blog

What is an API?

If you spend much time around software people, you’ll inevitably hear the term “API.” But what is an API, and why does it seem like they’re used for everything?

API stands for “application program interface”, and it’s essentially a way for one computer program to make its data and functionality available for other programs to use. That way, interesting functionality and data don’t have to live in the same program forever — they can be reused by other programs to do whole new things.

A metaphor might be a grocery store. A grocery store is an API for food. You can go to the store to get food without having to know how that food got there, and the design of the store helps you find the specific food you want. For example, you go to the produce section for bananas, not the dairy aisle. You don’t have to know how to grow bananas, how to harvest them, or how to ship them; you only need to know that you want them. The store “hides” the how so you can focus on what matters to you — getting some food.

Once you’ve got the food, you can do things with it that the grocery store wasn’t designed to do. For example, you could make some really good banana bread, grill some burgers for a cookout, or make sandwiches for a picnic in the park. You wouldn’t be able to do those things without the food, and getting the food was easy because the grocery store was there to do a bunch of things to make the food available.

APIs serve much the same purpose. The Federal Election Commission has an API, for example. That API lets you get things like the history of elections a candidate has participated in. Sure, you could go hunt that information down from various sources yourself, just like you could plant your own banana tree, but thanks to the API, you don’t have to. The FEC harvested that data, and now you — and anyone else — can do something interesting with it!

Interested in seeing what “groceries” you can get from APIs? Check out data.gov, a collection of APIs maintained by the federal government. It’s full of cool stuff, like data from NASA or the National Institutes of Health! Learn more about APIs in government from DigitalGov.