API

An API is the part of a program that is exposed to other programs.

This is useful when my code needs to interact with some other code for specific reasons.

Many different contexts

"API" is a more basic concept in programming that gets used in all sorts of contexts. A program that I write is most likely going to be interacting with the outside world so we need ways for our programs to communicate with each other. Those exposure points are the API.

Some concrete examples

The Vercel API

The Vercel API allows programmers to create programs (from outside of Vercel) that interact with the Vercel platform. I can, for instance, write a program that takes some code and deploys it on Vercel. That's code sending code to other code and then deploying it.

The Vercel API has a specific set of endpoints that make it so that I can do something specific with a certain endpoints. That set of Vercel's program that I can reach from the outside is the API.

Nextjs

Nextjs has an API that allows me to interact specfically with Nextjs. As long as I follow the rules of the Nextjs framework, the API allows me to tap into the powers of Nextjs. The bits of Nextjs that I can use in my code is the API of Nextjs.

React

React is a rendering library for JavaScript. It provides a really convenient way for me to write JavaScript and have it show up as a web page for my users. To do this, I use React's API. The React API is a set of functions that unlock this ability for me so that I can reach into React and use its greatness.

A Common Gotcha

For whatever reason, it's common to make the mistake that an API only refers to HTTP RESTful APIs. (If you don't know what that means, that's okay. You're probably not making this mistake.)

However, this isn't the case. Remember: Any time a program has stuff purposefully exposed for other programs to use, that's an API.