SevyDevy

Design an async API for long-running jobs

PremiumAPI designEasy

  • Async request reply
  • Long running operations
  • HTTP 202 accepted

Quick answer

This API design interview question asks you to design an async API for long-running jobs. 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 an async API for long-running jobs such as report exports and video transcodes that take 5 seconds to 40 minutes. Clients submit a job, get an ID back at once, then poll or receive a callback; the hard parts are safe retries, cheap polling and results that stay fetchable.

A data platform lets customers export reports, transcode uploaded videos and run data-quality scans. Today the API holds the HTTP connection open, which times out at load balancers, double-runs jobs when clients retry, and gives no progress. Design an asynchronous API pattern that every long-running operation on the platform will follow.

What must an async API for long-running jobs do?

  • Submit: Start a job with its parameters; the response returns immediately with a job ID and where to check.
  • Status: Read state (queued, running, succeeded, failed, cancelled), progress percentage, timestamps and an estimated finish.
5 more requirementsUnlock to see all

How well must it do it?

  • Submission safety: Retrying a submit after a timeout must not start a second job.
  • Polling cost: 10,000 concurrent jobs being polled must not overload the API; the contract must tell clients how often to poll.
3 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

  • Async request reply
  • Long running operations
  • HTTP 202 accepted
  • Job resource
  • Polling and callbacks
  • Retry after

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 an async API for long-running jobs and explain your choices the way you would in an interview.
Is this question asked at entry level?
It is marked Easy, so it suits engineers who are new to API design interviews. It is also a good warm-up before harder questions.
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