logo
Published on

What Is an API?

Read in: 한국어
Authors

What Is an API?

A Way to Send Requests to Another Computer

What happens when you tap "Order" on a delivery app?

  1. The delivery app on your phone sends "1 chicken please" to the restaurant's server (another computer)
  2. The restaurant's server sends back "Order confirmed!"

A way for your program to send requests to another computer (server) and receive responses — that's an API.

A way to send requests to another computer

It's Used Everywhere

When a weather app asks a weather server for the forecast — that's an API. When a map app asks a map server for directions — that's an API. When Instagram asks a server for new posts — that's an API.

Behind every app screen, the app on your phone is sending requests to other computers (servers) through APIs.

APIs are used everywhere

Key Point

API = A way for your program to send requests to another computer (server) and receive responses The apps you use every day are already sending requests to servers through APIs.


What Does "Using an API Directly" Mean?

Usually, the App Handles It

When you use a delivery app, you don't think "let me send an API request to the restaurant's server." You just tap a button and the app handles it.

Same with the Gemini website — you type in the chat box, and the website handles sending the API request to Google's AI server.

"Using It Directly" = Sending Requests with Your Own Program

Using an API directly means your program sends requests to the server without going through an app or website.

[Normal]   YouApp/WebsiteAPIServer
[Direct]   YouYour program → APIServer

Why bother? Because apps and websites have limitations.

For example, when you create images through Gemini chat:

  • Watermarks are added
  • You can only make one at a time
  • You can't adjust detailed settings

When you use the API directly, these limitations disappear.

Normal vs Direct

Key Point

Using an API directly = Sending requests to the server with your own program, without an app No app limitations — full freedom.


API Key — Your Personal Access Pass

What Is an API Key?

To use an API directly, you need an API key.

An API key is an access pass that proves "I am an authorized user." Just like you can't enter an office building without a badge, you can't access an API server without an access pass.

It's a long string like AIzaSyB...xYz123, and you need to include it when sending requests for the server to accept them.

API key = access pass

Your API Key Is a Password

Once you get an API key, you need to keep it safe.

If someone else gets your API key, you'll be billed for their usage. Think of it like sharing your credit card number.

Do thisDon't do this
Store in a .env fileHardcode it in your code
Keep it to yourselfShare on messaging apps/Slack
Add .env to .gitignoreUpload to GitHub
API key security

Getting an API Key

You can get a Gemini API key for free from Google AI Studio.

  1. Visit aistudio.google.com/apikey
  2. Sign in with your Google account
  3. Click the "Create API Key" button
  4. Copy the generated key

Create a .env file in your project folder and save it:

GEMINI=paste_your_API_key_here
Getting an API key

Key Point

  • API key = An access pass to use API servers
  • Never share it — if someone else uses it, you get billed
  • Store it in a .env file and add .env to .gitignore

Summary

ConceptOne-line Description
APIA way for your program to send requests to another computer (server) and receive responses
Using API directlySending requests to the server with your own program, without an app
API keyAn access pass to use API servers (keep it like a password)