API Documentation and Developer Experience Questions
Documentation and developer experience for API consumers: reference docs for endpoints and fields, OpenAPI-driven and interactive documentation, quickstarts and runnable code samples, doc comments that feed generated reference, changelogs, deprecation notices and migration guides, error messages and error tables that explain themselves, developer portals, sandboxes and onboarding flows. Covers developer experience (DX) as a product concern: time to first successful call, DX and docs-effectiveness metrics and dashboards, diagnosing onboarding drop-off, developer feedback loops, experiments and developer research, documentation standards and CI checks across teams, prioritising DX investment, and reducing support load through better docs and self-service. Designing the API itself (versioning policy, auth, rate limits, webhooks, gateways, SDK engineering) is a separate subject.
Two companies are integrating through an API with no shared context, and the first attempt at integration went wrong because each side read the contract differently. What would you put in front of the partner's engineers beyond the reference pages to remove that ambiguity, and how does each piece prevent a specific kind of misunderstanding?
Sample Answer
Direct answer
Reference pages describe each endpoint in isolation, but the failed integration came from how the pieces fit together and what words mean. I would put four kinds of thing in front of the partner: a machine-readable contract (the OpenAPI file), worked end-to-end examples with real requests and responses (plus a sequence diagram of the whole flow), a shared glossary and behaviour rules (units, time, states, retries, idempotency, and a change policy with a named contact), and executable checks the partner can run themselves (a sandbox with scripted scenarios, a Postman collection, contract tests). The table below breaks these into seven concrete pieces, and each removes one specific misunderstanding.
Terms: a Postman collection is a shareable file of ready-made example requests that the partner imports into the Postman tool and runs. Enums are fields limited to a fixed list of values (such as pending or paid). Polling means repeatedly asking "is it done yet?" instead of being notified. To deduplicate is to recognise a repeated event and process it once. ISO 8601 is the standard text format for dates and times (2026-03-04T09:30:00Z). An OpenAPI file is a machine-readable description of endpoints, fields and types. Idempotency means sending the same request twice has the effect of sending it once. A contract test is an automated test that checks each side's behaviour against the agreed contract.
Each piece and the misunderstanding it prevents
| Piece | Misunderstanding it prevents |
|---|---|
| OpenAPI file plus a validator or generated client | "I assumed this field was optional / a string / could be null." Types, required fields and enums are checked by a tool, not read by a human. |
| A sequence diagram of the whole flow (who calls whom, in what order, what happens on failure) | "I thought you would call us after payment" versus "we thought you would poll." Order and responsibility are shown, not implied. |
| Worked examples with full request and response, including one failure | "I did not know the amount is in cents." A concrete pair settles what prose leaves open. |
| A glossary and conventions page (units, time zone, ID formats, what each status means) | The same word meaning two things. "Cancelled" could mean refunded to one side and abandoned to the other. |
| Retry, ordering and idempotency rules | Duplicate charges and lost events, because one side retried on timeout and the other did not deduplicate. |
| A sandbox with scripted scenarios and a Postman collection or test suite | "It works on my reading." Both sides run the same scenarios and compare. |
| A change policy and a named contact | Silent contract changes, and no one to ask when readings differ. |
Worked example
The first attempt failed because the provider returned "amount": 1050 and the partner displayed 1050 dollars. The fix package:
{
"amount": 1050,
"currency": "USD",
"created_at": "2026-03-04T09:30:00Z",
"status": "pending"
}
- The OpenAPI field description says: "amount: integer, in the currency's smallest unit (cents for USD). 1050 means USD 10.50."
- The glossary defines
pending(funds not yet settled, may still fail) andcreated_at(always UTC, ISO 8601 format). - The example shows this exact response and the partner's expected screen text, "USD 10.50".
- A contract test sends amount
1050in the sandbox and asserts the partner's UI shows 10.50.
This particular ambiguity is unlikely to recur, because it is written down in a place a tool checks. Other ambiguities need their own row.
The sequence diagram, drawn as text (illustrative)
Partner app Provider API Provider webhooks
| POST /payments | |
|---------------->| 201 status=pending |
|<----------------| |
| | payment.completed |
|<-----------------------------------------|
| 200 OK (ack) | |
|----------------------------------------->|
| on failure: no ack within 10s -> retried up to 5 times; partner must deduplicate by event id
The diagram settles who calls whom (the partner does not poll), the order (the event comes after the request) and the failure path.
Consumer-driven contract testing is a contract-test style where the partner (the consumer) writes down exactly which fields and behaviours it relies on, and the provider runs those expectations in its own pipeline, so a change that would break the partner fails the provider's build before release.
Sequence I would use
- Run a joint walkthrough of the failed attempt to list every mismatch, so the package targets real failures.
- Publish the flow diagram and glossary first (cheapest, largest gain).
- Add worked examples for each mismatch found.
- Agree on contract tests both sides run on every change.
Trade-offs and pitfalls
- More documents are not better. Each piece must map to a mismatch you can name, or it is noise.
- Prose alone always drifts. Anything that can be checked by a machine should be.
- Do not let examples and spec diverge. Generate examples from the tests where possible.
You must retire an API version that partners still call. Write the communication plan for that deprecation: what notices go out and when, what the migration guide must contain, and how you track who has not moved.
Sample Answer
Direct answer
Announce early, repeat on a fixed schedule, make the migration guide good enough to follow without asking us, and track migration per partner from day one. I would run a 12-month runway with machine-readable warnings in the API itself, a partner-by-partner usage report, scheduled test outages ("brownouts") near the end, and a hard, documented shutdown that returns HTTP 410 Gone with a pointer to the guide.
Notice schedule
Example: v1 shuts down on 30 June 2027. "T-12 months" means twelve months before that date. A changelog is a dated public list of API changes, and a status page shows live service health and scheduled outages.
| When | What goes out | Channel |
|---|---|---|
| T-12 months | Announcement: what, why, date, link to guide, contact | Email to each partner's technical and business contacts, changelog, docs banner |
| T-12 months onward | Deprecation header (RFC 9745) and Sunset header (RFC 8594) (RFC means Request for Comments, an IETF standards document) on every v1 response | In the API itself, so it shows in partner logs |
| T-9 months | v2 in sandbox, migration guide complete, code samples | Docs, email |
| T-6 months | Reminder plus a personal usage report ("your key made N v1 calls last week") | Email, account manager |
| T-3 months | Brownouts: short scheduled v1 outages (for example one hour) that return the shutdown error | Email 2 weeks before each, status page |
| T-1 month, T-1 week | Final notices, escalation for stragglers (partners who have still not moved) | Email, phone call from account manager |
| Shutdown | v1 returns 410 Gone with a problem body (a structured JSON error with type, title, status, detail) linking to the guide | API |
The Deprecation header carries the date the endpoint became deprecated and Sunset the removal date. The sunset date must not be earlier than the deprecation date. A partner would see this in their logs on every v1 response:
Deprecation: @1782777600
Sunset: Wed, 30 Jun 2027 23:59:59 GMT
Link: <https://docs.example.com/migrate-v2>; rel="deprecation"
@1782777600 is the deprecation moment as a Unix timestamp (30 June 2026, 00:00 UTC), the Sunset value is an ordinary HTTP date, and the Link header points at the migration guide. A sample announcement email:
Subject: Action needed: Orders API v1 retires on 30 June 2027
Hi Priya,
Orders API v1 will stop working on 30 June 2027. Your key ak_live_41 made
12,300 v1 calls last week. Migrate to v2 using this guide: docs.example.com/migrate-v2.
v2 is available in sandbox from today. Reply to this email or book a call
with your account manager (the person who owns your commercial relationship) if you need help.
The shutdown returns 410 Gone rather than 404 Not Found because 410 says the resource existed and was removed on purpose, so a developer knows it is not a typo or a temporary fault.
What the migration guide must contain
- What changes and why, as a before/after table of fields, paths and behaviours.
- A visual diff of the breaking changes (changes that stop old client code working), so people see them at a glance:
- POST /v1/orders {"customer_name": "Ada Lovelace", "total": 25.00}
+ POST /v2/orders {"customer": {"first_name": "Ada", "last_name": "Lovelace"}, "total_cents": 2500}
- Compatibility rules: which v1 behaviours still hold in v2, what is additive, and that unknown fields must be ignored (a client should not crash when a response gains a field it does not recognise).
- Step-by-step migration: get v2 sandbox access, change base URL, update mappings, run your test suite, switch traffic gradually, confirm zero v1 calls.
- Before and after code in the languages partners actually use.
- How to test and roll back, the exact dates, and who to contact.
- Consumer notification: where partners are told about changes to this guide (changelog subscription).
Tracking who has not moved
Log v1 calls per API key and map each key to a partner and an owner. Report weekly: partner, share of calls still on v1, last v1 call. Example:
| Partner | v1 share of calls | Action |
|---|---|---|
| A | 0% | Done, thank them |
| B | 40% | Send usage report and sample diff |
| C | 100%, no replies | Account manager phones; offer an engineering call |
Stubborn clients and forced changes
- For ordinary deprecations, offer help first (a call, a code review of their integration), then a time-boxed adapter, a translation layer that accepts v1 shapes and calls v2, with its own end date. Extensions are exceptions approved per partner, not defaults.
- For a legally forced field removal with a short timeline (say 30 days), the schedule compresses but the mechanics stay: notify everyone at once, give the exact date, and offer an adapter that keeps the response shape intact but returns the field as null or empty so partner parsers do not crash. Before:
{"id": "ord_77", "total": 25.00, "buyer_national_id": "AB123456C"}. After:{"id": "ord_77", "total": 25.00, "buyer_national_id": null}. The key is still present, so a parser that requires it keeps working. You cannot extend the removal for anyone, because the law is the deadline, so contact the biggest callers personally in week one.
Pitfalls
Announcing once and going silent, hiding the date in a long changelog, and cutting off partners who never received a notice because it went to a stale contact are the common failures. Verify contacts before day one.
Product is split on two onboarding experiences: a browser-based runnable widget versus a guided quickstart with copy-paste snippets. Design an experiment to decide which is better, including what you would measure and what could make the result misleading.
Sample Answer
Direct answer
An arm is one version of the experience being compared. Randomly assign new developer sign-ups to the widget or the guided quickstart, with one primary success measure that reflects a real integration, a few guardrails, and a pre-agreed decision rule. The biggest trap is measurement: a browser widget can make "successful calls" that are not the developer's own integration, so the primary metric must count something the widget cannot inflate.
Design
- Unit and assignment: randomise per account (organisation), not per user, so colleagues at one company do not land in different arms and share tips. Split 50/50 at first visit to the onboarding page and keep it sticky (once an account is assigned to an arm it stays there on every later visit).
- Hypothesis: the widget increases the share of new developers who make a first successful call from their own code within 7 days.
- Primary metric: first successful API call made with the developer's own key from outside the widget (server-side or CLI, identified by origin or a header), within 7 days of signup. Not "widget runs".
- Secondary: median time to first call; completion of the tutorial; 30-day active use; trial-to-paid conversion (the share of free-trial accounts that become paying) at 30 or 60 days (slow, so read it later).
- Guardrails (measures that must not get worse, even if the main metric improves): support tickets per 100 sign-ups, error rate in the first week, sign-up rate itself (the widget must not scare people off), page load speed.
- Decision rule written beforehand: ship the arm that wins the primary metric with a confidence interval above zero (a range of plausible true differences between the arms; if the whole range sits above zero, the lift is unlikely to be luck) and no guardrail worse than an agreed limit; if tied, choose the cheaper one to maintain, or ship a hybrid (widget followed by a "copy this into your code" step).
Sample size (power calculation)
Say baseline activation is 20% and a 4-point lift (to 24%) is worth acting on. With 5% significance (false-positive rate) and 80% power (chance to detect a true lift):
In words: the more noise in the metric (the variance term) the more accounts you need, and the smaller the lift you care about (p2 - p1, squared) the far more you need. z_alpha (about 1.96 for 5% significance, two-sided) and z_power (about 0.84 for 80% power) are the standard-normal cut-offs for those two error rates, and the formula multiplies their sum, squared, by the variance and divides by the squared lift. Hand check for 20% to 24%: variance = 0.20 x 0.80 + 0.24 x 0.76 = 0.3424; (1.96 + 0.84)^2 = about 7.85; 7.85 x 0.3424 / 0.04^2 = about 1,680.
from math import ceil
from statistics import NormalDist
def n_per_arm(p1, p2, alpha=0.05, power=0.80):
z = NormalDist().inv_cdf
z_alpha, z_power = z(1 - alpha / 2), z(power)
variance = p1 * (1 - p1) + p2 * (1 - p2)
return ceil((z_alpha + z_power) ** 2 * variance / (p2 - p1) ** 2)
print("activation 20% -> 24%:", n_per_arm(0.20, 0.24), "per arm")
print("trial-to-paid 5% -> 6%:", n_per_arm(0.05, 0.06), "per arm")
Output:
activation 20% -> 24%: 1680 per arm
trial-to-paid 5% -> 6%: 8155 per arm
So about 3,360 accounts for activation. Trial-to-paid needs far more because its base rate is small, which is why it is a follow-up read, not the deciding metric.
A variation: testing auto-generated per-language sample code
The same method also answers whether sample code generated in the visitor's own programming language lifts trial-to-paid conversion. The same structure fits "does generated sample code in the visitor's language lift trial-to-paid conversion?": randomise at signup, primary metric trial-to-paid, secondary first-call rate and time to first call, guardrails on tickets and code-sample error rates. Given the 8,155-per-arm requirement, use first-call rate as the decision metric and check conversion as a longer-running confirmation.
What could make the result misleading
- Metric contamination: widget calls counted as activation (fixed above).
- Sample ratio mismatch (the arm sizes differ from the split you intended): with 10,000 accounts a fair 50/50 split should land within about 100 of 5,000 each (two standard deviations); 5,200 vs 4,800 is four standard deviations out, essentially impossible by chance, so assignment or logging is broken. Check this before reading results.
- Novelty effect (people try something new because it is new): a shiny widget wins week 1 then fades; run at least two full weeks.
- Segment mix: the widget may help beginners and hurt experienced developers; look at pre-declared segments, not fishing.
- Peeking (checking results repeatedly and stopping the moment they look good) inflates false positives. If you must rank the traps: metric contamination and sample ratio mismatch matter most, because they invalidate the result entirely.
- Confounders: a launch or marketing burst mid-test changes who signs up.
Pitfalls
Testing with too few sign-ups and declaring a winner from noise. If traffic is too low for a 4-point lift, test a bigger change or run a small qualitative study first.
You want a working feedback loop between developers using your API and the team that owns the docs and product. What signals would you collect, how do you turn them into a prioritised backlog, and how do you show developers that feedback was acted on?
Sample Answer
Direct answer
(Triage means sorting incoming items by type and urgency and deciding who handles each.) Collect feedback from three kinds of sources (asked-for, unprompted, and behavioural), route it into one tagged backlog owned by a named person, prioritise by how many developers it affects and how badly it blocks them, and close the loop publicly with a changelog and direct replies so developers see that reporting is worth their time.
Signals to collect
| Kind | Sources | What it tells you |
|---|---|---|
| Asked-for | "Was this page helpful?" thumbs on each docs page (with an optional comment), a short survey after first success, a periodic satisfaction survey (for example CSAT, customer satisfaction score) | What developers say is unclear |
| Unprompted | Support tickets, community forum and chat threads, GitHub issues on the SDKs (language-specific client libraries), sales and solutions engineers' call notes | What developers ask when they are stuck |
| Behavioural | Docs search terms with no results, pages with high exit rates (many readers leave from that page instead of continuing), error codes by frequency, drop-off in the onboarding funnel (the sequence signup, first key, first successful call, and how many developers are lost at each step) | What developers do, not what they say |
Behavioural data covers the silent majority: most stuck developers never write in.
Turning it into a prioritised backlog
- One intake, one owner: every signal becomes an item in a single tracker, tagged by area (auth, errors, pagination, SDK) and type (docs gap, bug, feature). A named owner triages weekly.
- Merge duplicates and count: each item carries the number of distinct developers affected and the source.
- Score: rank by developers affected times severity (blocked entirely, worked around, cosmetic) divided by effort. Use simple numeric weights: severity 3 = blocked entirely, 2 = worked around, 1 = cosmetic; effort 1 = under a day, 2 = a few days, 3 = weeks. Boost items that hit the first-call path, and give an enterprise-account request a multiplier (for example x2, meaning its revenue counts double) agreed with product, not decided by whoever shouts.
- Route: docs fixes go to the docs owner, bugs to engineering, feature requests into the product roadmap process.
Worked example (illustrative)
Docs search logs show "webhook signature" (the check that proves a webhook really came from us) returned no result 45 times in a month, three forum threads ask the same thing, and support has 9 tickets on it. De-duplicating by developer gives about 40 distinct developers. Blocking a common flow, so severity 3; one page to write, so effort 1.
webhook signature page: 40 x 3 / 1 = 120
cosmetic request from one enterprise customer: 5 developers x 1 / 2 = 2.5, x2 enterprise multiplier = 5
The docs page outranks the loud request by a wide margin. The enterprise item would only overtake it if its multiplier was enormous, which is a business decision to make openly.
Showing developers that feedback was acted on
- A public changelog entry that says "you asked, we did", linking the original issue where that is allowed.
- Reply directly to whoever reported it when the item ships, even a one-line message.
- A visible public roadmap or "top requested" list with status (planned, in progress, shipped, not planned), including an honest reason for "not planned".
- A quarterly "what we fixed from your feedback" note.
Pitfalls
- Prioritising by loudest voice: the single vocal developer, or the biggest account, always wins without a count.
- Collecting feedback and never replying, which teaches developers not to bother.
- Treating only ticket text as feedback and missing the search logs, where the silent majority speaks.
- Unowned backlog: without a weekly triage owner the list grows and stales within months.
Write a one-paragraph summary of a POST endpoint that creates a customer order, pitched at a product manager who will never call it. What do you include and what do you deliberately leave out?
Sample Answer
Direct answer
Write it in terms of business outcome, rules and consequences, not HTTP mechanics. A product manager needs to know what the endpoint lets the business do, what must be true for it to work, what happens after it succeeds, and what can go wrong for customers.
The paragraph
"Create Order is the call our storefront and partner systems make to place a customer's order. It needs a customer, at least one item that is in stock, and a delivery address; if any of these is missing, no order is created and the caller is told which one. When it succeeds, the order is saved in a 'pending' state, stock for those items is reserved, and the order appears in the customer's history and in the daily sales report. Payment is collected separately, so a pending order can still be abandoned if payment fails. It is safe for a caller to retry after a timeout without creating a duplicate order. Orders above our fraud-review threshold are held for manual approval, which can delay confirmation."
What I included and why
- Purpose in business words: who calls it and what it enables.
- Preconditions that change what customers experience (needs stock, needs address).
- What happens next: reserved stock, pending status, reporting. A PM plans features on these downstream effects.
- Consequences of failure: abandoned pending orders, held orders.
- Anything that changes an outcome: retry safety means no duplicate orders, so a customer is never asked to pay twice for one purchase by a retry (payment itself is collected by a separate call, which needs its own retry protection), which is a customer-facing promise.
What I left out on purpose
- Header names, authentication token format, field types and JSON structure.
- Exact status codes, the database tables touched, internal service names.
- Pagination, versioning details and other things the PM will never act on.
If the same summary were for an engineer, those omitted items become the core; the facts stay the same, the audience changes which ones matter.
Pitfalls
Copying the reference description ("POST /orders creates an order resource") gives the PM nothing to decide with. Also avoid promising business behaviour the code does not implement: check each claim (stock reservation, fraud threshold) with the owning team before it goes in the paragraph.
Unlock Full Question Bank
Get access to all 31 API Documentation and Developer Experience interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.