DEV Community

Surhid Amatya
Surhid Amatya

Posted on

How APIs Actually Travel Between Systems

So far, we’ve talked about APIs as a way for systems to communicate.

But here’s an important clarification.

An API defines what systems say to each other. Network protocols define how those messages travel.

Let's discuss about some of the most common ways messages move across the network.

Think of APIs as the language. Think of protocols as the roads, vehicles, and traffic rules.

Let’s walk through the important ones in simple terms.

HTTP – the basic conversation

HTTP is the most common way applications talk over the internet. When you open a website or an app loads data, it usually uses HTTP underneath.

How it behaves:

  1. One side sends a message
  2. The other side replies
  3. Conversation ends

It’s like sending a letter and waiting for a reply. This works well for:

  1. Loading pages
  2. Fetching data
  3. Simple request–response communication

HTTPS – HTTP with a lock

HTTPS is the same as HTTP, but secured. Think of it like sending the same letter, but inside a locked envelope. Only the sender and receiver can read it.

That’s why HTTPS is used for:

  1. Login systems
  2. Payments
  3. Any sensitive data

From an API point of view, nothing changes in behavior. Only privacy and safety improve.

WebSocket – keeping the call open

WebSocket is different. Instead of sending a message and closing the connection, it keeps the line open.

It’s like a phone call:

  1. Both sides stay connected
  2. Both can speak anytime

This is used when:

Messages need to flow both ways where Updates must be instant

Examples:

  1. Live chat
  2. Real-time notifications
  3. Live dashboards

APIs using WebSockets don’t “ask again and again”.They listen continuously.

TCP – slow but reliable delivery

TCP is about reliability. Imagine sending fragile items through a courier service that:

  1. Confirms delivery
  2. Resends if something is lost
  3. Keeps things in order

That’s TCP. Most APIs rely on TCP underneath because:

  1. Messages arrive correctly
  2. Nothing is lost silently

It’s slower than some options, but trustworthy.

UDP – fast but no guarantees

UDP is the opposite approach. It sends messages quickly, without checking if they arrived.

Imagine shouting information across a room: Some people may miss it
But it’s fast

UDP is used where speed matters more than perfection:

  1. Video calls
  2. Live streaming
  3. Online games

APIs rarely use UDP directly, but systems built on real-time data often do.

HTTP/3 (QUIC) – modern and faster roads

HTTP/3 is a newer version of HTTP that runs on top of UDP.

The idea is simple:

  1. Reduce delays
  2. Recover faster from network issues

It’s useful for:

  1. Mobile apps
  2. IoT devices
  3. Real-time experiences

From the API point of view, this mostly happens behind the scenes.

SMTP and FTP – special-purpose messengers

Some protocols exist for very specific jobs.

  1. SMTP is designed for emails.
  2. FTP is designed for file transfers.

They are not general API communication tools, but they still represent structured system-to-system communication.

They follow strict rules, just like APIs do.

Conclusion

APIs don’t float magically between systems. They travel using protocols like:

  1. HTTP / HTTPS
  2. WebSocket
  3. TCP / UDP

Documentation tells you:

  1. Which protocol is used
  2. What behavior to expect
  3. Whether communication is instant or delayed
  4. Whether it’s one-time or continuous

Without this clarity, teams guess. And guessing leads to fragile systems.

Why this matters for documentation?

When API documentation is good, it answers questions like:

  1. Do I request or do I listen?
  2. Is this real-time or delayed?
  3. Is this secure?
  4. Will I get a response immediately?

Without documentation, developers press buttons randomly, like using a TV remote without knowing what each button does.

And that brings us back to the same point again.

Good documentation doesn’t just explain APIs. It explains how to communicate safely and correctly.

Top comments (0)