What is an API?

APIs are everywhere

What do an ESP32, ChatGPT, your weather app, and a smart home have in common?
It's simple: they all use APIs.

Whether it's web development, software, embedded systems, or IoT – nothing works without an API.
Nevertheless, many developers don't really know what an API actually is – or how many different types there are.

In this article, you will get a practical, understandable explanation, what an API is, how it works—and why it's so important.
With examples from your world: Arduino, ESP32, REST, JSON, GPIO, MQTT, OpenAI, Home Assistant and more.

What is an API? Explained simply

API stands for Application Programming Interface – auf Deutsch: Programmierschnittstelle.

It is a defined way in which software communicates with other software (or hardware).

Example:
Do you want to read the status of a sensor?
→ You call an API function like readTemperature()
→ The API takes care of everything else (e.g., I²C, timing, conversion).
→ You will get the following result, for example: 22.4°C

In short: An API is an agreement on how to talk to something—whether it's a web service or a microcontroller.

Types of APIs – with examples


1) REST API – Interfaces on the web

REST APIs are the most widely used form of web APIs.
They are based on HTTP (such as websites) and usually deliver data as JSON.

Example: OpenWeatherMap API

  • You send a request: GET https://api.openweathermap.org/data/2.5/weather?q=Berlin

  • You will receive JSON data with temperature, humidity, etc.

REST APIs are:

  • Readable, testable (e.g., with Postman)

  • Platform-independent

  • Ideal for mobile apps, web services, cloud connectivity

2) API for microcontrollers – e.g., ESP32, STM32, Arduino

APIs also exist in the embedded sector—just in a slightly different form:

Example: GPIO-API (Arduino)

  • You want to set a pin HIGH

  • You write digitalWrite(13, HIGH);

  • The underlying API handles registers, timing, etc.

Example: ESP32 WiFi API

  • WiFi.begin(“SSID”, “Password”);

  • This is also an API—it encapsulates the complicated Wi-Fi protocol for you.

Arduino itself is also an API: Arduino functions are merely “friendly” interfaces to underlying C/C++ libraries and HALs.

3) MQTT & Co. – APIs for IoT communication

APIs exist not only locally, but also between devices:

Example: ESP32 with MQTT

  • Your device “subscribed” to a topic such as house/living room/light

  • The broker (e.g., Mosquitto, Home Assistant) distributes messages.

  • You respond to commands or send data

Here, too, there is a defined way in which the device “speaks” – in other words, an API.

How do you use an API?

The process is often similar, regardless of whether it is web or embedded:

  1. Read documentation

    • What features are available?

    • What parameters are expected?

    • What do I get in return?

  2. Send request/command

    • e.g., HTTP request (for REST)

    • or function call (for libraries)

  3. Process response

    • e.g., JSON data, return value, sensor value, error code

Practical examples

areaAPI example
WebOpenAI API → Generate text
weather appOpenWeatherMap API → JSON data via GET
Smart HomeHome Assistant REST API or MQTT
ArduinoGPIO, PWM, and I²C functions are API calls.
ESP32WiFi.begin() → internal network API
STM32HAL-API → HAL_GPIO_WritePin(...)

Why APIs are important—and also critical to security

  • No access without API – No updates, no data exchange, no control

  • Well-documented APIs save time and reduce errors

  • Secure APIs prevent misuse, e.g. by:

    • Authentication (API key, token)

    • Rate limiting

    • Access control (roles, ACLs)

Therefore: APIs are not just interfaces, they are contracts.

Conclusion: API = language between devices, programs, and people

Whether you are communicating with a web server, setting a microcontroller register, or controlling a smart light bulb – you always use an API.

They are the adhesives of modern technology:
Without them, there would be no apps, no devices, no cloud services—and no networking.

FAQ – Frequently asked questions

What is an API, explained simply?

An API is a programming interface—a defined way for software or devices to communicate with each other. You call up functions or send data—the API does the rest.

What is the difference between API and REST API?

“API” is the umbrella term. REST is a specific type of web API that runs over HTTP and often uses JSON.

How do I test an API?

For example, with Postman (for REST APIs), MQTT clients, or through unit tests on functions. Many online tools can also help with this.

What types of APIs are there?

REST, SOAP, GraphQL, hardware APIs (e.g., GPIO), MQTT, C/C++ library APIs, CLI APIs—and many more.

Does Arduino also use APIs?

Yes! The familiar Arduino functions are part of an API based on C++ libraries.