What does stateless mean in REST?
Stateless means the server does not remember anything about previous requests. Every request from the client must include all the information the server needs to handle it, such as who the user is. Because nothing is stored between calls, any server can handle any request, which makes REST APIs easy to scale.
Why it matters
If the server kept session state in memory, a follow up request would have to hit the exact same server that stored it. With statelessness, requests can go to any server behind a load balancer, so you can add more servers freely.
- Each request carries its own auth, usually a token in a header.
- Any server can serve any request, which helps horizontal scaling.
- Failures are simpler because there is no lost session to recover.
A great point to add is that statelessness is what makes REST scale well behind load balancers. Tying the concept to scaling shows you understand why the rule exists, not just the definition.
Common follow up questions
Related interview questions
Want the full API Design guide?
Read every API Design concept with notes, diagrams, and code in one place. Track your progress as you go.
Open the API Design guide All API Design questions