Skip to content
The style guide is in beta: content and structure may change.

API documentation principles

This section of the style guide defines rules about writing API reference documentation. In contrast to the task-based and scenario-based intent of a developer guide, API reference documentation describes individual API elements, such as classes, interfaces, and members, in a format that focuses on allowing the reader to quickly reference individual descriptions of code elements. This use case must include readers viewing reference content in a page or in the UI of an IDE. As such, these rules consider that a reader might need to read reference descriptions in tooltips and not only in a webpage.

If the conciseness and scope of API descriptions feel too limiting, it typically means that you are trying to include content that belongs in developer guides and tutorials. When you successfully separate those content types, you must also properly implement cross-referencing between your API reference content and guides. Because so much API reference content is automated, effective cross-referencing with guides is rarely done or maintained, but it is one of the most important requirements for supporting discoverability in developer content.

This page provides guidance that can apply to any type of API element or section of a reference page. The remaining API reference rules apply to these documentation sections, which are commonly found in API reference pages:

  • Deprecation notice, first on the page when the element is deprecated (api-002).
  • Intro: the first one or two sentences, reused wherever the element is listed (intros).
  • Overview and remarks: when to use the element, how it relates to its neighbors, and the behavior the signature does not show (overview and remarks).
  • Members, parameters, return values, and errors, one section per public member (members and parameters, return values, and errors and exceptions).
  • Examples, introduced by what they accomplish (api-001 and api-009, on this page).
  • Links to related elements and further reading (refer and link).
api-007 must API docs

Apply the same brand voice principles (clear, concise, helpful) to developer and API documentation as to other content types.

Examples

  • ✓ Use this endpoint to get a user.
  • ✗ The aforementioned endpoint facilitates the retrieval of user entities.

Rationale

People read API reference documentation the same way they read other content. A reference page needs the same clarity and helpfulness as a developer guide.

api-001 should API docs

On each reference page, include a code example that shows how to use the programming element.

Examples

  • ✓ copyFile(src, dest): Copies a file. Example: await copyFile('report.txt', 'backup/report.txt')
  • ✗ copyFile(src, dest): Copies a file.

Rationale

A working example shows how to call the element in real code, with realistic arguments. The signature shows the parameters and their types, but not how a caller uses them.

api-009 should API docs

Introduce a code example by stating what it accomplishes and in what situation, not by naming the call it makes.

Examples

  • ✓ This example shows how to call the create() method when initializing a Component object.
  • ✗ This example calls the create() method.

Rationale

On a reference page, the reader already knows which element the example is about. An introduction that states what the example achieves, and when a reader needs it, tells the reader whether to read the code. code-003 requires an introduction for every code sample. This rule specifies what the introduction contains on a reference page.

api-003 should API docs

Review auto-generated documentation comments for quality. Remove internal implementation details that aren’t appropriate for end users, and add missing information that developers need.

Examples

  • ✓ Gets the user’s display name.
  • ✗ Getter for the internal _displayName field populated by UserCacheImpl.

Rationale

Documentation generated from source comments often includes internal details and leaves out information that callers need. A review removes the internal details and adds the missing information before the documentation is published.

api-002 should API docs

When an element is deprecated, put the notice first on the page, before the intro. State that the element is deprecated, the version in which it was deprecated if version tracking is used, the replacement with a link, and what developers must do to update their code. Use the form This [element type] is deprecated followed by Use the [replacement] instead.

Examples

  • ✓ This method is deprecated in v2.3. Use the listUsers() method instead, and update callers to handle its paginated response.
  • ✗ Deprecated. Don’t use.
  • ✗ A deprecation note placed after the examples at the end of the page.

Rationale

A developer who reaches a deprecated element needs to know what replaces it and how to migrate before they read anything else on the page. A notice at the end of the page comes after the developer has already written code against the deprecated element.

api-006 should API docs

Use lowercase, hyphen-separated filenames for documentation files; use only standard ASCII alphanumeric characters.

Examples

  • ✓ get-started-auth.md
  • ✗ GetStarted_Auth (v2).md

Rationale

Lowercase, hyphenated, ASCII filenames are portable across systems and produce clean, predictable URLs.

Don’t use “API reference” alone as a noun

Section titled “Don’t use “API reference” alone as a noun”
api-008 should GuidesAPI docsMarketingBlog

Don’t use API reference alone as the noun for the documentation, and don’t pluralize it as API references. Give it a head noun, as in API reference documentation, API reference content, or API reference docs. API reference is fine as a label or a modifier, as in an “API reference” heading or an API reference page.

Examples

  • ✓ Link each type to its API reference page.
  • ✗ Link each type to the API reference.
  • ✓ How to write API reference documentation.
  • ✗ How to write API references.

Rationale

Reference names what the documentation is for, not what it is. Used alone as a noun, API reference sounds like jargon, and its plural, API references, is a form that readers rarely use. A head noun such as documentation or content names what the reader is looking at.

  • api-005 (retired 2026-09-13): “Use gender-neutral pronouns and a diverse set of names when depicting people in documentation examples, and avoid reinforcing stereotypes about job roles.” It restated incl-001, incl-008, and incl-009, which apply to API reference documentation as they do to every content type, and its example pair showed a pronoun violation, not a naming one. The ID stays reserved and is never reused.