API documentation writer: endpoint docs and an OpenAPI spec from your code
Your API works, but the only documentation is the code and a few Slack threads. Attach your route files or a list of endpoints and your todo.is agent writes developer-friendly docs: authentication, each endpoint with parameters, real request and response examples, error codes and an OpenAPI 3.1 file you can load into Swagger UI or Redoc.
The prompt
- Write API documentation for [API NAME] from [ROUTE FILES OR ENDPOINT LIST]. Authentication: [HOW AUTH WORKS]. Audience: [WHO WILL USE THE DOCS]. For every endpoint, document the method and path, what it does, parameters with types and whether they're required, a curl example, a sample JSON response and the possible errors. Add a getting-started section, pagination and rate-limit notes, and send me two files: docs.md for humans and openapi.yaml (OpenAPI 3.1). Validate the YAML in your workspace and list anything in the code that looked inconsistent.
What to change
- [API NAME]: E.g. "Plotline Bookings API v1".
- [ROUTE FILES OR ENDPOINT LIST]: Attach the route/controller files (Express, FastAPI, Django, Laravel…), or paste a list like "GET /bookings, POST /bookings".
- [HOW AUTH WORKS]: E.g. "Bearer API key in the Authorization header", "OAuth 2.0 client credentials".
- [WHO WILL USE THE DOCS]: E.g. "partner developers integrating with us", "our own front-end team".
Example result
- Plotline Bookings API v1: docs.md (excerpt)
- Getting started
- • Base URL: https://api.plotline.example/v1
- • Send your key in every request: Authorization: Bearer YOUR_API_KEY
- • All requests and responses are JSON, times are ISO 8601 in UTC
- Create a booking
- POST /bookings
- Creates a booking for a resource and time slot.
- Body parameters:
- • resource_id (string, required): the room or desk to book
- • start (datetime, required) and end (datetime, required): end must be after start
- • guest_email (string, optional): receives a confirmation email
- • notes (string, optional, max 500 characters)
- Example request:
- curl -X POST https://api.plotline.example/v1/bookings -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" -d '{"resource_id":"room_12","start":"2026-10-14T09:00:00Z","end":"2026-10-14T10:00:00Z"}'
- Example response (201 Created):
- {"id":"bk_8f2a","resource_id":"room_12","start":"2026-10-14T09:00:00Z","end":"2026-10-14T10:00:00Z","status":"confirmed"}
- Errors:
- • 400 invalid_time_range: end is before start
- • 401 unauthorized: missing or wrong API key
- • 409 slot_taken: the resource is already booked for part of that time
- • 429 rate_limited: more than 60 requests per minute; retry after the Retry-After header
- Pagination
- List endpoints return 25 items by default. Pass limit (max 100) and the next_cursor value from the previous response as cursor.
- What your agent noticed in the code
- • GET /bookings/:id returns 404 for other accounts' bookings, but DELETE returns 403. Pick one so callers can't tell which IDs exist
- • POST /resources accepts capacity as a string or a number; the docs say integer
- • The rate limit in middleware is 60/min, but a code comment says 100
- openapi.yaml
- 12 paths, 9 schemas, bearer security scheme. Validated in the workspace with no errors; loads in Swagger UI and Redoc.
How to do it with todo.is
- Copy the prompt and fill in the API name, routes, auth and audience.
- Attach the route files, models and any example responses you have (remove real keys and customer data).
- Paste it into todo.is on the Today screen or send it to your agent.
- Download docs.md and openapi.yaml, and read the inconsistencies list.
- When the API changes, send the new routes and ask for an updated spec and a changelog entry.
Tips for a better result
- Real examples beat descriptions. Attach a few actual responses (with fake data) so examples match exactly.
- Document errors as carefully as success. Developers spend most of their time on the error cases.
- Keep the OpenAPI file as the source of truth and generate reference pages from it with Swagger UI or Redoc.
- Version your API in the path or a header, and note breaking changes in a changelog section.
- Ask your agent to publish docs.md as a simple static page with a public link if partners need to read it.
API documentation writer: FAQ
- What is OpenAPI? OpenAPI is a standard YAML or JSON format that describes REST endpoints, parameters, responses and auth. Tools like Swagger UI, Redoc and Postman can turn it into interactive docs and client code.
- Can it document a GraphQL API? Yes. Attach your schema and resolvers and it writes docs with example queries, mutations and errors instead of an OpenAPI file.
- Can it test my live API? It doesn't call your private API with your keys. It builds the docs from your code and examples, and validates the OpenAPI file in its workspace.
- How is API reference different from a guide? Reference lists every endpoint and field. Guides walk through a task, like "create your first booking". Good docs have both, and the prompt asks for a getting-started guide on top of the reference.
JavaScript is required to use the todo.is app.