Design the API for a ride-hailing app
PremiumAPI designHard
- Trip state machine
- Idempotency keys
- Location updates
Quick answer
This API design interview question asks you to design the API for a ride-hailing app. Aim for a design that exposes a clear, consistent and safe interface, then explain the resources, requests, responses and error handling. Interviewers want to see how you name resources, version the interface and handle failure cases.
The problem
Design the API for a ride-hailing app like Uber or Ola: the contract the rider app and the driver app use from fare quote to payment. The hard parts are a trip state machine that survives retries on flaky mobile networks and live driver tracking every few seconds.
A rider asks for a fare estimate, requests a ride, waits for a driver, tracks the car, completes the trip, pays and rates. A driver goes online, sends location, receives offers, accepts one, navigates through pickup and drop-off, and gets paid. Both apps run on mobile networks that drop, switch towers and retry.
What must the API for a ride-hailing app do?
- Request a ride: Rider requests a ride against a quote; cancelling is free until a driver is assigned and costs a fee if done more than 2 minutes after assignment.
- Live tracking: Rider sees the driver location updated every 3 to 5 seconds during matching and the trip.
How well must it do it?
- Flaky networks: Every state change survives retries; a lost response must never cause a second ride or a double charge.
- Latency: Status and location updates reach the rider within 2 seconds; accept is confirmed to the driver within 500 ms.
What scale should you design for?
Use these numbers in your estimates.
The scale numbers unlock with this questionUnlock
Key concepts
- Trip state machine
- Idempotency keys
- Location updates
- Long polling and push
- REST API
- Mobile clients
How you’ll practise
- Use cases
- Resources
- Endpoints
- Errors, auth and limits
- Versioning
- Wrap-up
Lala, personalized to you, gives a hint when you ask and reviews your design when you are ready.
What do interviewers look for?
In any API design round.
- Starts from the clients and the use cases
- Names resources and operations consistently
- Defines request and response shapes and status codes
- Covers authentication, rate limits and idempotency
- Plans pagination, filtering and versioning
- Explains how clients learn about and recover from errors
Questions people ask about this interview question
- Which design type is this question?
- It is an API design question. You design the API for a ride-hailing app and explain your choices the way you would in an interview.
- Is this question asked at entry level?
- It is marked Hard. It suits engineers preparing for senior interviews, where you are expected to drive the discussion and go deep on trade-offs.
- What should I cover first?
- Start with the clients, the main use cases and the resources they need. Agree on scope with the interviewer before you design anything.
- Can I practise it for free?
- It is a premium question. Sign up and unlock it once for 10 credits; it then stays unlocked. When you finish, Lala, your personalized AI mentor, can review your design for 30 credits.
Related questions
Updated · Written by the SevyDevy team