Design a Paginated List API With Stable Continuation Tokens

Last updated: November 29, 2026

Quick Overview

Design the pagination contract for an API that lists a user's files sorted by last modified, like a Microsoft Graph drive listing. Pages must not skip or repeat items when files are added between requests, and clients must not be able to tamper with tokens.

Microsoft
Software Engineering Fundamentals
Software Engineer
Microsoft
November 29, 2026
Software Engineer
Onsite
Software Engineering Fundamentals
Medium

0

0

0 solved


Design the pagination contract for an API that lists a user's files sorted by last modified, like a Microsoft Graph drive listing. Pages must not skip or repeat items when files are added between requests, and clients must not be able to tamper with tokens.

API design questions are common for Microsoft teams that own public surfaces like Microsoft Graph and Azure REST APIs, which follow published guidelines using opaque nextLink tokens. The interviewer checks keyset versus offset pagination, a deterministic sort with a tie-breaker, opaque and tamper-resistant tokens, and binding a token to its query.

What the Interviewer Expects
  • Explains why offset pagination skips or repeats under concurrent inserts
  • Uses keyset pagination with a unique tie-breaker in the sort
  • Makes the continuation token opaque and signed
  • Binds the token to the original filter and sort
  • Describes the response shape with a next link that is absent on the last page
Key Topics to Cover
API design
keyset pagination
continuation tokens
consistency
REST conventions
How to Approach This
  1. Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
  2. Choose data structures based on access patterns, not familiarity.
  3. Prefer immutable data and message passing over shared mutable state for concurrency.
  4. Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
  • How would you support jumping to page 50 or showing a total count?
  • What happens if the sort field of an item changes while a client is paging?
  • How do you evolve the token format without breaking clients that hold old tokens?
  • How does this map to a database index?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements
  • GET /files?filter=...&pageSize=n returns items ordered by modified descending plus nextLink (or a token) when more exist.
  • No skipped or duplicated items across pages even when files are crea...
High-Level Design

Offset pagination (skip=200) breaks when a new file is inserted at the top: everything shifts down one, and page 2 repeats an item. Keyset pagination remembers the sort key of the last item ...


Submit Your Answer
Markdown supported