Make the Create Task API Safe to Retry With Idempotency Keys

Last updated: November 29, 2026

Quick Overview

A mobile client creates a task, the connection drops before the response arrives, and the client retries, creating a duplicate. Design idempotency keys for `POST /tasks` and implement the server-side wrapper.

Asana
Software Engineering Fundamentals
Software Engineer
Asana
November 29, 2026
Software Engineer
Technical Screen
Software Engineering Fundamentals
Medium

0

0

0 solved


A mobile client creates a task, the connection drops before the response arrives, and the client retries, creating a duplicate. Design idempotency keys for `POST /tasks` and implement the server-side wrapper.

Asana's mobile apps and API integrations operate on flaky networks, and duplicate tasks are a visible, annoying failure. The interviewer checks API design judgment: key scope, what is stored, how to handle concurrent duplicates and mismatched bodies, and how long keys live.

What the Interviewer Expects
  • Explains why POST is not naturally idempotent and why the client must generate the key
  • Scopes keys per client or user to avoid collisions
  • Stores a request fingerprint and replays the original response
  • Handles in-flight duplicates with a 409 and mismatched bodies with a 422
  • Gives keys a TTL and explains where the record lives in a multi-server deployment
Key Topics to Cover
idempotency
API design
retries
request fingerprinting
exactly-once effects
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
  • What happens if the server crashes after creating the task but before saving the response?
  • Where would you store these records across many API servers?
  • Should a failed request's key be reusable?
  • How would you do this for a batch endpoint that creates many tasks?
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

Clients send Idempotency-Key with creates. A retry with the same key and same body returns the original response without creating anything. Same key with a different body is a client bug. Two simult...

High-Level Design

Key the record by (client_id, key). On first sight, insert an in_progress record atomically, run the handler, then store the response. Later requests compare the body hash and replay. In productio...


Submit Your Answer
Markdown supported

Related Questions