My Development Notes


Stateless API vs Stateful API : Meaning and Usages


Stateless APIs

In case of stateless APIs, each request from a client to the server must contain all the information needed to understand and process the request. The server does not store any session information about the client. Here, each request is independent and the server does not retain any info about previous requests. For example, RESTful APIs are generally stateless APIs. These are easier to maintain and implement as the servers don’t manage sessions.

Stateful APIs

In stateful APIs the server remembers previous interactions and uses that are used to process current requests. The server maintains state information across multiple requests from the same client. The server has to keep a track of the client’s state like cookies and identifiers. These are harder to scale and code because the servers have to manage and store the session data.

These are suitable for web applications which require interactions with previous web pages or requests like shopping apps, user authentication systems etc. These are quite complex to create and scale.


Leave a Reply

Your email address will not be published. Required fields are marked *