I Stopped Writing API Reference Docs and Started Writing Cookbooks — Engagement Tripled
Three years ago I shipped an API that I was genuinely proud of. Clean REST design, consistent error handling, thoughtful pagination. I spent two weeks writing the reference docs — every endpoint, every parameter, every response code. I shipped it and waited for the adoption flood.
Crickets. A dozen signups. Two developers who actually built something. Both emailed me asking questions the docs technically answered.
The problem wasn't the quality of the reference. It was the shape. Here's what I learned.
Nobody reads reference docs cover to cover
Reference documentation is a dictionary. You don't read a dictionary — you look up a word when you're stuck. But when a developer is evaluating whether to use your API, they aren't stuck yet. They're asking one question:
"Can this solve my problem, and how much code do I have to write?"
A dictionary can't answer that. A cookbook can.
The cookbook format that changed everything
I rewrote our docs around task-oriented recipes. Each recipe follows this structure:
- Goal — what you'll build (a working feature, not an abstract concept)
- Prerequisites — literally what's needed (API key, SDK installed, any setup)
- Steps — numbered, copy-paste-ready code blocks
- Full working example — the entire script, runnable as-is
- What's next — links to related recipes
Here's a concrete example. Old reference-style docs might say:
POST /v1/chat/completions— Creates a model response for the given conversation. Acceptsmodel,messages,temperature,max_tokens.
The cookbook version:
## Recipe: Build a customer support triage bot
**Goal**: A script that reads a customer message, classifies urgency,
and drafts a suggested reply.
**Prerequisites**: API key from dashboard, Python 3.8+
**Step 1**: Install the SDK
bash
pip install acme-ai
**Step 2**: Classify urgency
python
from acme_ai import Client
client = Client(api_key="your-key-here")
urgency = client.chat.create(
model="acme-4",
messages=[
{"role": "system", "content": "Classify as: urgent, normal, or low."},
{"role": "user", "content": "My account was charged twice this month!"}
]
)
print(urgency.choices[0].message.content) # → "urgent"
**Step 3**: Generate a draft reply
python
reply = client.chat.create(
model="acme-4",
messages=[
{"role": "system", "content": "Draft a polite, helpful reply."},
{"role": "user", "content": "My account was charged twice this month!"}
]
)
print(reply.choices[0].message.content)
**Full script**: [See gist](https://gist.github.com/example)
**Next**: [Add context from your database →](/recipes/context-augmentation)
Same endpoint. Completely different experience. The developer can copy, paste, run, and see it work in under 60 seconds.
What happened when I switched
Within three months:
- Time-to-first-API-call dropped from ~40 minutes to ~6 minutes. We measured this by instrumenting the gap between account creation and first successful 200 response.
- Support tickets about "how do I do X" dropped 60%. Not because developers got smarter — because the answer was already in a recipe.
- Word-of-mouth referrals increased. Developers started tweeting "check out this API, their docs are actually good" — a sentence I never heard about our reference docs.
The reference docs didn't go away. They're still there, linked from every recipe for developers who need the fine print. But they went from being the front door to being the appendix.
Three rules for writing cookbook docs
After a few years of iterating, here's what I've learned:
1. Every recipe must end with a working script
Not a snippet. A complete file. If a developer can't run it without filling in blanks, it's not a recipe — it's a suggestion. The "full working example" section is the most important part of the page.
2. Recipes should answer "why would I use this?"
Every recipe title is a job to be done. Not "Using the Webhook API" — that's a feature name. Instead: "Get Real-Time Notifications When an Order Ships." The developer knows immediately whether this recipe is for them.
3. Measure what matters
We track these metrics per recipe page:
- Completion rate: what percentage of visitors scroll to the bottom?
- Copy-paste rate: how many people click the "copy" button on code blocks?
- Error rate on copied code: do people paste our examples and get errors? (We run automated tests on every code block in CI.)
If a recipe has low completion and high copy-paste errors, we rewrite it — regardless of whether anyone filed a ticket.
When NOT to use a cookbook
Cookbook docs aren't always the answer:
- Very simple APIs (3 endpoints, no auth complexity). Your "Getting Started" page might be enough. A cookbook might feel like padding.
- Internal tools with a captive audience of 5 engineers who already know the domain. Reference + a few examples is fine.
- Unstable APIs where endpoints change weekly. Cookbooks rot fast. Stabilize the API first.
But for any public-facing API with a real developer audience, the cookbook approach pays for itself within weeks.
Start small
If the idea of rewriting all your docs into recipes feels overwhelming (it did for me), start with three:
- The "hello world" recipe — the simplest possible working example (under 10 lines).
- The "90% use case" recipe — what most developers actually come to your API for.
- The "aha moment" recipe — the one that makes developers say "oh, THAT's what this is for."
Ship those three, measure the difference, then decide whether to do the rest.
I've been building APIs for a while now, and the single highest-leverage decision I ever made was treating documentation as a product, not an afterthought. Reference docs tell developers what your API can do. Cookbooks show them what they can build.
The second one is what gets people to ship.
Top comments (0)