All articles
December 4, 2026

What Not to Include in Public API Documentation

what-not-to-include-in-api-documentation-cover.png

With DocStar, your public API docs do far more than sit on a website: the same published collection feeds your docs site, your llms.txt, a Markdown copy of every page, the MCP server AI assistants use to call your API, and the DocStar CLI. That makes the question "what should not be in our API docs?" more important than ever. The short answer: leave out every private, internal or admin endpoint, and every internal detail (secrets, internal hostnames, table names, known weaknesses). Document only the endpoints your users actually call.

In this guide we show how DocStar's AI-agent-first workflow keeps those things out by default, what a coding agent connected to DocStar checks before it documents an endpoint, and the few judgment calls that stay with you.

#

Why "what to leave out" matters more with AI agents

A few years ago, an accidental admin route in your API reference was embarrassing. Today it travels further. In DocStar, a published endpoint can show up in:

Where Who reads it
Your public docs site Customers, partners, search engines
llms.txt and the .md copy of each page AI crawlers and assistants
Your collection's MCP server AI assistants that search your docs and call your API
DocStar CLI Developers and coding agents running your endpoints as commands

So "public" really means public to people and machines. DocStar's help docs say it plainly: only published content is visible, and drafts never reach your MCP server. Everything you publish is fair game. That is why the decision about what to publish has to happen before the endpoint goes live, not after someone finds it.

#

What not to include in public API documentation

Here is the list DocStar builds into its own rules for AI agents (the same rule appears in the GitHub Sync guide and in docstar.md):

Endpoints to leave out

  • Admin and back-office routes. Anything only your staff or internal tools use.

  • Cron jobs and scheduled tasks. Routes your own scheduler hits.

  • Webhooks that other services call. Inbound callbacks from payment providers, queues or partners are not something your users call.

  • Service-to-service routes. Internal calls between your own microservices.

  • Anything you can't confirm your frontend or public API uses. DocStar's rule is simple: if you cannot confirm the frontend calls an endpoint, do not add it.

Details to leave out of descriptions

  • Secrets: API keys, tokens, passwords, sample credentials that actually work.

  • Internal hostnames: staging servers, internal service URLs, private IPs.

  • Table, queue and class names: they reveal how your system is built and tend to go stale.

  • Security weaknesses: "this endpoint doesn't check X yet" belongs in your issue tracker, not your docs.

What to keep in

  • Endpoints your frontend or app calls, and your public API.

  • For each one: purpose, auth, headers, parameters, a request body example, field descriptions, and success and error responses.

If you're new to the basics, our guide What Is API Documentation? covers what a good reference includes.

#

How DocStar keeps private endpoints out: let your AI agent do it

The fastest and safest way to get this right is to let a coding agent document your API, with DocStar's rules loaded from the start. Here is the workflow.

#

1. Connect your coding agent to DocStar

Add the DocStar MCP (https://mcp.docstar.io/mcp) to Claude Code, Cursor, Codex or another assistant. The first time it needs your workspace, you sign in to DocStar in your browser. There is no API key to copy, and the agent only sees the workspaces and collections your account can access, with your permissions.

#

2. Give it one prompt

Paste something like this:

Use the DocStar MCP to document my app's API in our "Public API" collection. First read https://api.docstar.io/docstar.md and follow it. Read the latest code on the main branch, including middleware and controllers, not just the route files. Document only the endpoints our frontend or public API calls. Skip admin, back-office, cron, inbound webhook and service-to-service routes, and never put secrets, internal hostnames, table or queue names, class names or security weaknesses in a description. Before you write anything, show me the list of endpoints you plan to document and the ones you plan to skip, with a reason for each. Save everything as drafts.

#

3. What the agent does

With docstar.md loaded, the agent follows DocStar's documentation rules:

  • Reads the code, not just the routes. For each endpoint it opens the router, its middleware (auth, permissions, validation) and the controller, so it can tell an admin-only route from a public one.

  • Sorts endpoints into "document" and "skip". Admin-only, private, internal and cron endpoints are skipped by default. When it can't tell whether a route counts as private, the rules tell it to ask you.

  • Writes clean descriptions. Parameters, body fields, status codes and examples come from the code, without the internal detail the rules ban.

  • Asks before changing anything and saves the endpoints as drafts, which only your workspace can see.

[Screenshot: Coding agent listing endpoints to document and endpoints to skip]

For the full documenting workflow, see How to Document a REST API with DocStar.

#

4. Your part: review and decide

This is where a person matters most. The agent proposes; you decide:

  • Confirm the skip list. You know which "internal" route a big customer secretly relies on, and which "public-looking" route should stay hidden.

  • Check names and examples. Make sure sample values are fake and no real customer data slipped into a response example.

  • Decide what is private versus partner-only (more on that below).

  • Publish. Nothing goes live until you publish. When you publish an endpoint in the DocStar editor and it contains what looks like a secret, such as a token, DocStar shows a Sensitive Information Warning so you can remove it first.

#

Keep it current: the same rule on every change

Leaving things out once is easy. Staying clean as the code changes is the hard part. That is where DocStar GitHub Sync helps.

With GitHub Sync, your OpenAPI files live in the repo under api-docs/, next to the code, so they change in the same commit and pull request. Add docstar.md to the repo root and one line to your AGENTS.md (or CLAUDE.md):

- Whenever any endpoint is added, changed, renamed or removed, read `docstar.md` in this repo and follow it to update `api-docs/` in the same change.

Now every time your coding agent adds an endpoint, it reads the same "never add a private, internal or admin API" rule before touching the docs. And because spec changes show up in the PR diff, your reviewers see exactly which endpoint is about to become public, and can catch an admin route before it merges. On push, the GitHub Action sends the changed files to DocStar, so the docs site, MCP tools and CLI update with no manual import.

If something private does get published, deleting its file or operation archives the matching endpoint on the next sync (you can restore it for about 30 days).

Two honest limits: the agent still has to follow the rule. If a developer changes code without an agent, or the agent skips the docstar.md step, nothing catches it automatically. DocStar doesn't watch your repo or compare code with docs. The PR review is your safety net. You can let your agent set the whole thing up with one prompt: "Set up DocStar GitHub Sync for this repo." See the GitHub Sync guide for details.

#

When docs need to be private, not just trimmed

Some endpoints aren't for everyone, but aren't secret either: a partner API, a beta, a client integration. DocStar gives you clear levels of access control:

You want Do this in DocStar
Only your team can read it Leave the collection unpublished. It stays inside your workspace.
A limited outside group can read it Publish the collection and turn on password protection.
Anyone can read it Publish the collection with no password.

A few things to know, straight from the help docs:

  • The password covers the whole collection, so put partner-only endpoints in a separate collection rather than mixing them with public ones.

  • Password-protected pages aren't read by search engines or AI crawlers, but page names and links can still appear in the collection's sitemap.xml and llms.txt. Don't put sensitive information in page or endpoint titles.

  • Only the workspace Owner can change access control.

#

Control what AI agents can do, not just read

Leaving endpoints out of the docs is the first layer. On your DocStar MCP server, you also shape how assistants use the endpoints you did publish:

  • Endpoint tools: give up to 20 of your most important published endpoints their own named tool, so assistants pick the right action.

  • Safety hints: mark tools read-only or destructive, so assistants know when to ask before running them.

  • Skill and instructions: tell assistants which endpoints are safe to call freely and which to confirm first.

  • Sign-in: let assistants call your API as the signed-in user, with their own account.

For keeping the tokens behind your docs automation safe, see How to Secure API Tokens for Docs Automation.

#

Prefer to do it yourself?

You can apply the same rules by hand in DocStar. Import your OpenAPI or Postman file, delete or leave unpublished any endpoint that matches the "leave out" list, scrub descriptions and examples, and publish only what's left. Endpoints you don't publish stay as drafts that only your workspace sees. It works, but you'll be repeating the review on every release, which is exactly what the agent workflow and GitHub Sync take off your plate.

#

Why teams choose DocStar

  • Safe defaults for AI agents. docstar.md gives every coding agent the same "only what users call, never private or admin" rule.

  • Drafts first. Nothing reaches your docs site, llms.txt or MCP server until you publish.

  • Docs reviewed like code. With GitHub Sync, every newly public endpoint shows up in a pull request.

  • One collection, many outputs. Publish once and get a docs site, an MCP server and CLI commands, all from the same reviewed content.

  • Simple access levels. Internal, password-protected or public, per collection.

#

FAQ

Should internal APIs ever go in DocStar? Yes, if the collection stays unpublished. An unpublished collection is visible only to members of your workspace with access to it, so it's a fine place for internal reference. Just never mix internal endpoints into a published collection.

Will my AI agent skip admin endpoints automatically? When it follows docstar.md, it skips admin-only, private, internal and cron endpoints by default and asks you when it's unsure. Always review its "skip" list before publishing.

Do draft endpoints show up on my MCP server or in llms.txt? No. Only published content is visible. Drafts never reach your MCP server, and llms.txt is generated from published pages.

Does DocStar detect secrets in endpoint docs? When you publish an endpoint in the editor, DocStar shows a Sensitive Information Warning if it finds what looks like a secret, such as a token. Treat it as a last check, not a replacement for review.

Can I hide a single page with a password? No. Password protection applies to the whole collection. To share only some endpoints, put them in a separate collection.

#

Get started free

Connect your coding agent to DocStar, give it one prompt, and get public API docs that contain exactly what your users need, and nothing they shouldn't see. Your docs site, MCP server and CLI come from the same reviewed collection.

Get started free

what not to include in API documentationpublic API docsinternal APIsAPI documentation securityAI coding agentsGitHub Sync