Developer Lab Practical application development
without unnecessary complexity.
← Course Dashboard
Course Getting Started Lesson 1
📖 Lesson 🕒 10 minutes
01

What Is an API?

Learn how an application communicates with an external AI service.

What Is an API?

An API is a controlled way for one application to communicate with another application.

API stands for Application Programming Interface. The name sounds technical, but the basic idea is simple.

Think of an API as a messenger

Your application sends a request. The API delivers that request to another service. The service processes it and sends a response back to your application.

The Basic Request Cycle

  1. A user enters information into your application.
  2. Your application prepares an API request.
  3. The request is sent to Gemini.
  4. Gemini processes the information.
  5. Gemini returns a response.
  6. Your application displays the result.

A Practical Example

Imagine that you build an email rewriting tool. The user enters an unfinished email and selects a professional tone.

Your application might send Gemini a request containing:

{
    "instruction": "Rewrite this email professionally.",
    "email": "hey just checking if you got my last message"
}

Gemini processes that request and returns something similar to:

Hello,

I wanted to follow up and confirm whether you received my
previous message.

Thank you.

Your application then places that response inside the results container for the user.

The Three Main Parts

1. Input

Input is the information provided by the user. It might be text, an image, a PDF, an audio recording, or application settings.

2. Processing

Your server prepares the input, sends it to the API, and waits for the response.

3. Output

Output is the result returned by Gemini and displayed inside your application.

The Foundation of an AI Application

Nearly every AI application can be reduced to this same basic structure: input → processing → output.

The API Is Not the Application

Gemini supplies intelligence, but it does not automatically create the finished application.

You still control:

  • The interface
  • The input fields
  • The instructions
  • The buttons
  • The output format
  • The user experience
  • The security
  • The usage limits

That distinction matters. The API is one component inside the application. It is not the entire product.

Important

An API key should normally remain on your server. Placing a private API key directly inside browser JavaScript can expose it to anyone who views the page source.

Lesson Summary

An API allows your application to communicate with an external service. In this course, our PHP application will send requests to Gemini and display the responses inside interfaces that we control.