← Questions

Serve contacts from an API, then enrich them from a second API

0
StripeCodingLast asked Apr 2026

A coding interview question asked in Stripe's onsite coding (debug, integrate, build) round, last asked Apr 2026. It tests api integration, http and json.

You get an existing web service repository, written in Python with FastAPI and tested with pytest, plus the documentation for two JSON APIs. Extend the service in two steps, reading code and docs you have not seen before.

Part 1: expose contacts

Add an endpoint that reads contacts from the first JSON API and returns each contact's name and email address.

Part 2: enrich contacts

Call the second JSON API and merge its extra fields into each contact before returning it.

Interface

Unless you agree on a different interface with the interviewer, assume:

  • GET /contacts returns [{"name": str, "email": str, ...extra fields}].
  • The first API lists contacts; the second is looked up per contact by a shared key (for example, the email or a contact ID), as its documentation describes.

Example

first API:   [{"id": "c1", "name": "Ada Lovelace", "email": "ada@example.com", "phone": "555-0100"}]
second API:  GET /details/c1  ->  {"company": "Analytical Engines", "title": "Engineer"}

GET /contacts  ->  [{"name": "Ada Lovelace", "email": "ada@example.com",
                     "company": "Analytical Engines", "title": "Engineer"}]

Constraints

  • About 60 minutes.
  • Follow the patterns already in the repository (routing, HTTP client, configuration, tests).

Clarifying questions

  • Does the first API paginate? Should the endpoint return every contact or one page?
  • What should the response look like when the second API has no record for a contact, or fails?
  • Which fields from the second API are wanted, and what if they clash with fields of the first?
  • Are there rate limits or timeouts to respect?

What a strong answer covers

  • Reading the docs and existing code first, then a small change that matches the codebase's style.
  • Calling the APIs through a client that can be replaced in tests.
  • Handling errors: timeouts, non-200 responses, missing fields, a contact the second API does not know (return the contact without the extra fields, or flag it, and say which).
  • Avoiding one slow sequential request per contact when there are many: batch endpoints or concurrent requests with a limit.
  • Tests with mocked API responses for the normal case and each failure.

Follow-ups

  • The second API is slow. Add caching and say how long cached data stays valid.
  • Add filtering by email domain to the endpoint.
  • The first API paginates with a cursor. Stream all pages.

Where it's asked

  • Stripe · Onsite coding: debug, integrate, build · Last asked Apr 202660 min · Project editor with starter code and tests: fix bugs in an unfamiliar codebase, wire an external API spec into a service, or complete a skeleton in parts · Varies by session: some onsites have one AI-assisted session and an integration session without AI

What it tests

api integration · http · json

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding