api-007 must API docs Apply the same brand voice principles (clear, concise, helpful) to developer and API documentation as to other content types.
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:
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
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
create() method when initializing a Component object.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
_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
listUsers() method instead, and update callers to handle its paginated response.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.mdGetStarted_Auth (v2).mdRationale
Lowercase, hyphenated, ASCII filenames are portable across systems and produce clean, predictable URLs.
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
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.
inline-001 should code-009 should code-012 should inline-002 should timeless-001 should code-003 should code-010 should 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.