SevyDevy

Design a product search API with faceted filters

PremiumAPI designMedium

  • Faceted search
  • Search API
  • Query parameters

Quick answer

This API design interview question asks you to design a product search API with faceted filters. 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 a product search API with faceted filters for an online store like Amazon with 12 million products. Shoppers type a query, narrow results by brand, price, size, colour and rating with live counts, then sort and page. The hard parts are correct facet counts and responses that cache well.

One endpoint serves the website, the apps and 40 marketplace partners. Design the request and response contract of this search endpoint and its companions (suggestions, a product by ID), including caching and errors.

What must a product search API with faceted filters do?

  • Filters: Category (hierarchical), brand (multi-select), price range, size, colour, rating at least, in stock only; filters can combine.
  • Facets: For each filterable field return the top values with counts for the current result set; a selected facet still shows counts for its sibling values.
6 more requirementsUnlock to see all

How well must it do it?

  • Latency: Search under 250 ms at p95 including facets; suggestions under 80 ms.
  • Cacheability: The same query from different shoppers should hit a shared cache; personalisation must not break that.
2 more requirementsUnlock to see all

What scale should you design for?

Use these numbers in your estimates.

The scale numbers unlock with this questionUnlock

Key concepts

  • Faceted search
  • Search API
  • Query parameters
  • Relevance and sorting
  • Cache keys
  • Cursor pagination

How you’ll practise

6 short steps · save and come back any time
  1. Use cases
  2. Resources
  3. Endpoints
  4. Errors, auth and limits
  5. Versioning
  6. 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 a product search API with faceted filters and explain your choices the way you would in an interview.
Is this question asked at entry level?
It is marked Medium. Entry-level engineers can practise it, but it expects you to reason about requirements and trade-offs, not only list components.
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

Premium questionSign up free, then unlock it