API Design for System Design Interviews

In system design interviews, defining how clients interact with your system during the API step is a foundational component of the delivery framework. API design follows predictable patterns where you select a protocol, define core resources, specify data exchange formats, and establish robust handling for client requests and server responses. Most interviewers assess whether you can establish clean, intuitive contracts and select appropriate communication mechanisms for specific workload constraints.

Try This Problem Yourself

Practice with guided hints and real time AI feedback.

Start Practice

The 5 Step System Design Framework

When designing APIs during an interview, apply this structured five step framework to demonstrate systematic engineering decision making:

  1. Requirements & Estimations: Clarify functional and non functional expectations, client diversity, latency bounds, and traffic scale.
  2. Core Entities & Schema Design: Map high level domain objects and identify core resources that reflect underlying database entities.
  3. API Design: Establish protocol selection, resource endpoints, request payloads, query parameter options, and response structures.
  4. High Level Design: Draw the architectural interaction flow connecting clients, API gateways, microservices, and storage layers.
  5. Deep Dives & Production Optimization: Address security protocols, rate limiting, pagination mechanics, idempotency guarantees, and operational trade offs.

Step 1: Requirements & Estimations

Before writing out endpoint signatures or choosing protocols, evaluate the system constraints and client interactions. API design choices directly reflect three architectural drivers:

Client Diversity

Modern architectures serve varied client types. Web applications running on desktop browsers often demand rich aggregate payloads to render comprehensive dashboards in single network round trips. Mobile applications operating on cellular networks prioritize minimal payload sizes and bandwidth conservation to avoid latency bottlenecks. External third party integrations require strict contract stability, explicit versioning, and developer friendly documentation. Internal microservices communicate frequently across datacenter networks, prioritizing low overhead and sub millisecond execution speed.

Traffic Volumes & Throughput

Understanding request throughput dictates protocol choices and networking decisions. High volume public endpoints processing hundreds of thousands of read requests per second necessitate caching friendly protocols and stateless authentication mechanisms. Heavy write pipelines require lightweight serialization formats and asynchronous request handling to prevent connection exhaustion at the gateway tier.

Latency Budget & Connection Persistence

Interactive consumer features like live chat, notification feeds, or financial tickers cannot operate efficiently over standard request response polling loops. Evaluating whether an interaction requires short lived stateless HTTP calls versus long lived persistent socket connections ensures you pick the right communication layer early in the interview.


Step 2: Core Entities & Resource Modeling

Mapping Domain Objects

Successful API design begins by identifying the core entities in your system. Taking an event ticketing system like Ticketmaster as a concrete model, your domain contains distinct entities: events, venues, tickets, and customer bookings.

Good resource modeling maps these entities directly into clear, predictable endpoints. Resources represent nouns within your system rather than action verbs. Use plural nouns for resource paths to maintain consistency across endpoints:

Hierarchical Nesting vs Filtering

When modeling relationships between entities, choose between nested resource paths and top level query filters based on whether the relationship is strictly required:


Step 3: API Design & Protocol Selection

Protocol Selection Comparison

In a system design interview, you will evaluate three primary API communication protocols:

1. REST (Representational State Transfer)

REST relies on standard HTTP semantics, operating on resources identified by uniform resource locators. It utilizes standard HTTP verbs (GET, POST, PUT, PATCH, DELETE) to manipulate underlying entities, returning structured representations (typically JSON).

2. GraphQL

GraphQL consolidates resource endpoints into a single unified execution endpoint. Clients submit queries explicitly specifying the exact nested attributes they require, and the server returns data matching that exact structural shape.

3. RPC & gRPC (Remote Procedure Call)

RPC abstracts network calls into function invocations, framing interactions as actions rather than resource manipulations (for example, invoking checkPermission(userId, resourceId)). Modern RPC implementations like gRPC utilize Protocol Buffers for binary serialization over HTTP/2 multiplexed streams.

HTTP Verbs & Idempotency Rules

Understanding HTTP method semantics and idempotency guarantees is essential when designing RESTful interfaces:

Data Passing Mechanics

APIs receive input across three distinct channels based on parameter scope:

  1. Path Parameters: Identify specific, required resource instances in structural URLs (for example, /events/123).
  2. Query Parameters: Supply optional filtering, sorting, or pagination modifiers (for example, /events?city=NYC&limit=10).
  3. Request Payload Body: Encapsulates complex, multi attribute objects during creation or update operations (for example, JSON arrays passed during POST booking submissions).

HTTP Status Code Conventions

Group responses logically into standard HTTP status categories:


Step 4: High Level Design

Architectural interaction flow illustrating client applications connecting through unified edge gateways to internal microservices, caching layers, and persistence stores.

Architecture Diagram Generation Prompt: Create a detailed architecture diagram illustrating a complete API subsystem for a high scale event ticketing and reservation platform. Show client tiers including Mobile Applications, Web Dashboards, and Third Party Partner Integration API clients connecting to a unified API Gateway layer. Illustrate the API Gateway handling TLS termination, rate limiting, and JWT token authentication. Behind the gateway, depict external REST endpoints routing to fronting services while high throughput microservices communicate internally via gRPC RPC connections over HTTP/2. Show services interacting with PostgreSQL read replicas for event discovery, an In Memory Redis cluster for seat availability caching, and Apache Kafka for asynchronous booking event streams.


Step 5: Deep Dives & Real World Production Case Studies

Common API Design Patterns

Pagination Strategies

When querying extensive data collections, returning complete datasets saturates bandwidth and exhausts database memory. Select between two primary pagination strategies:

Versioning Strategies

APIs evolve over time, requiring strategies to update data contracts without breaking legacy client applications:

Security Considerations

Authentication vs Authorization

API Keys vs JWT Tokens

Choose authentication mechanisms based on client consumer characteristics:

Role Based Access Control (RBAC) & Rate Limiting

Real World Production Case Studies

1. High Scale Event Ticketing Platform

Handling flash sales for popular concerts requires preventing seat overselling while maintaining high reservation throughput.

2. Polyglot Microservice Architecture

Large enterprise engineering teams build specialized microservices using distinct programming languages suited for specific workloads.

3. Cross Platform Content Streaming Network

Digital media platforms deliver content across smart TVs, low bandwidth mobile devices, and high resolution desktop browsers.


Summary Checklist for System Design Interviews

  1. Identify Client Types: Evaluate whether public consumers require REST or GraphQL, and whether internal microservices require gRPC.
  2. Model Noun Resources: Establish plural, intuitive resource paths representing domain entities rather than action procedures.
  3. Apply Proper HTTP Verbs: Match operations cleanly with standard methods and enforce strict idempotency guarantees.
  4. Implement Robust Pagination: Recommend cursor based pagination for real time streams or massive collections to maintain stable performance.
  5. Enforce Security Boundaries: Implement JWT tokens for stateless user sessions, enforce role based access controls, and protect endpoints with gateway rate limiting.