<aside>

This section is part of the 5-hour System Design course by Mukul Raina

SLIDE 115: Section Intro, API Design

Section 9: API Design

image.png

The API layer is the contract between clients and the system. Every action a rider or driver takes in the app translates to an API call. Requesting a ride is a POST. Checking ETA is a GET. Cancelling is a DELETE. Accepting a dispatch is a WebSocket event. The API design determines how clients interact with the services we built in Section 4 and the data flows we traced in Section 5.

In an interview, API design is not about listing every endpoint. It is about showing that you understand the interaction model: which operations are REST request-response, which are real-time push over WebSocket, how authentication works at the edge, how rate limiting protects backend services, and why cursor pagination is the right choice for real-time datasets.

What We’ll Cover:

  1. Rider-facing APIs: endpoints, request/response examples, error handling
  2. Driver-facing APIs: REST endpoints and WebSocket events
  3. Real-time push mechanisms: WebSocket vs push notifications vs polling
  4. Auth and rate limiting at the API Gateway
  5. Cursor pagination and API versioning

This section connects backward to Section 4 (Architecture), where the API Gateway and WebSocket Gateway were defined, and Section 8 (Database Design), where the schemas these APIs read from and write to were specified.

<aside>

Mukul Raina | youtube.com/@mukulraina | slides.mukulraina.com | LinkedIn

</aside>


SLIDE 116: Rider-Facing APIs

Core Rider Endpoints

The rider interacts with the system through five primary endpoints. Each maps to a functional requirement from Section 2.

POST   /v1/rides                  Request a new ride
GET    /v1/rides/{id}             Get ride status and details
GET    /v1/rides/{id}/eta         Get current ETA for an active ride
DELETE /v1/rides/{id}             Cancel a ride
POST   /v1/rides/{id}/rating      Rate the driver after trip completion
GET    /v1/rides/history           Paginated trip history