---
schema_version: "1"
id: 640dfaca66151e97e8805a64df5e4d46ca5e572b1ddd85c668cb51061e0131ba
title: ApexDoc Comment Structure and Tags
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexcode/apex_doc_format.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_doc_format.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 4be42796427669cffb69a2f4581571f08aa5c9babe4e3a566b528814bbda92a8
description: To promote consistency and parsability, ApexDoc comments have a defined structure and syntax. Each ApexDoc comment consists of a main description and a set of block and inline tags that provide information about the documented code element.
---
# ApexDoc Comment Structure and Tags

To promote consistency and parsability, ApexDoc comments have a defined structure and syntax. Each ApexDoc comment consists of a main description and a set of block and inline tags that provide information about the documented code element.

![Important](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/images/icon_note_important.png)

#### Important

Although the Apex compiler enforces existing [Apex comment syntax](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_expressions_comments.htm "Both single and multiline comments are supported in Apex code."), it doesn’t enforce the ApexDoc syntax or check comment accuracy in relation to corresponding Apex code.

## Basic Comment Format

ApexDoc comments are distinguished from [other Apex comments](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_expressions_comments.htm "Both single and multiline comments are supported in Apex code.") by their starting delimiter. Whereas other multiline comments demarcate the beginning and end of the comment block with /\* and \*/, ApexDoc comments begin with /\*\* and end with \*/.

An ApexDoc comment immediately precedes the class, interface, enum, method, constructor, or property declaration that it documents. No other code or comments are between the ApexDoc comment block and the element that it describes.

If an ApexDoc comment spans multiple lines, each subsequent line begins with an asterisk (\*). Documentation parsers ignore the leading asterisk and any whitespace that precedes it on the line.

/\*\*
 \* This is a simple ApexDoc comment.
 \*/
public with sharing class MyClass {
    //...
}

## Main Description

The main description is the first block of text within an ApexDoc comment. It doesn’t have an explicit tag. It provides a concise summary of the documented element.

In the main description, first include a one-sentence summary of the element. Documentation generation tools often extract this first sentence to use in summary tables or indexes. End the summary sentence with a period.

After the summary sentence, include any additional context about the element. For example, explain pre- or post-conditions, link to relevant documents, or describe variable constraints.

## Block and Inline Tags

Block tags and inline tags provide structured information about the element.

Use block tags after the main description of the ApexDoc comment. Block tags begin with the @ symbol followed by the tag name, such as @param, @return, and @author. Each block tag appears on a new line, and the information associated with a block tag follows the tag name on the same line or subsequent lines.

Use inline tags within the main description or within the description of a block tag. Inline tags also begin with the @ symbol followed by the tag name, but the tags are enclosed in curly braces ({@...}).

This table provides a comprehensive ApexDoc tag reference. For usage examples of each tag, see the examples following this table.

<table class="featureTable sort_table" summary="">
          <caption><span class="tablecap">Table 1. ApexDoc Tags</span></caption>



          <thead class="thead sorted" align="left">
            <tr>
              <th class="featureTableHeader  " id="d91741e123">Tag</th>

              <th class="featureTableHeader  " id="d91741e126">Applicable Apex Elements</th>

              <th class="featureTableHeader  " id="d91741e129">Description and Example</th>

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d91741e123" data-title="Tag">
                <samp class="codeph apex_code">@author
                </samp><var class="keyword varname">value</var>
              </td>

              <td class="entry" headers="d91741e126" data-title="Applicable Apex Elements">Class, Interface, Enum</td>

              <td class="entry" headers="d91741e129" data-title="Description and Example">Specifies the author or authors of the element code. Multiple <samp class="codeph apex_code">@author</samp> tags are allowed.</td>

            </tr>

            <tr>
              <td class="entry" headers="d91741e123" data-title="Tag">
                <samp class="codeph apex_code"><span class="keyword">@deprecated</span>
                </samp><var class="keyword varname">description</var>
              </td>

              <td class="entry" headers="d91741e126" data-title="Applicable Apex Elements">All</td>

              <td class="entry" headers="d91741e129" data-title="Description and Example">Marks an element as deprecated. In the tag description, provide a reason and an
                alternative.</td>

            </tr>

            <tr>
              <td class="entry" headers="d91741e123" data-title="Tag">
                <samp class="codeph apex_code">@example
                </samp><var class="keyword varname">example</var>
              </td>

              <td class="entry" headers="d91741e126" data-title="Applicable Apex Elements">All</td>

              <td class="entry" headers="d91741e129" data-title="Description and Example">Provides a usage example. The example is formatted as code if the <samp class="codeph apex_code">{@code … }</samp> inline tag is used.</td>

            </tr>

            <tr>
              <td class="entry" headers="d91741e123" data-title="Tag">
                <samp class="codeph apex_code">@group
                </samp><var class="keyword varname">groupName</var>
              </td>

              <td class="entry" headers="d91741e126" data-title="Applicable Apex Elements">Class, Interface, Enum, Method, Property, Variable</td>

              <td class="entry" headers="d91741e129" data-title="Description and Example">Specifies the element’s group in documentation. Grouping elements is useful for
                generated documentation.</td>

            </tr>

            <tr>
              <td class="entry" headers="d91741e123" data-title="Tag">
                <samp class="codeph apex_code">@param
                </samp><var class="keyword varname">paramName</var>
              </td>

              <td class="entry" headers="d91741e126" data-title="Applicable Apex Elements">Method, Constructor</td>

              <td class="entry" headers="d91741e129" data-title="Description and Example">Describes a method or constructor parameter. It must match the parameter order
                and name.</td>

            </tr>

            <tr>
              <td class="entry" headers="d91741e123" data-title="Tag">
                <samp class="codeph apex_code">@<span class="statement">return</span>
                </samp><var class="keyword varname">description</var>
              </td>

              <td class="entry" headers="d91741e126" data-title="Applicable Apex Elements">Method</td>

              <td class="entry" headers="d91741e129" data-title="Description and Example">Describes the return value of a method. Don’t use the <samp class="codeph apex_code">@<span class="statement">return</span></samp> tag for void methods or
                constructors.</td>

            </tr>

            <tr>
              <td class="entry" headers="d91741e123" data-title="Tag">
                <samp class="codeph apex_code">@see
                </samp><var class="keyword varname">reference</var>
              </td>

              <td class="entry" headers="d91741e126" data-title="Applicable Apex Elements">All</td>

              <td class="entry" headers="d91741e129" data-title="Description and Example">
                <p class="p">Adds a reference in the See Also section of the documentation.</p>

                <p class="p">The <samp class="codeph apex_code">@see</samp> tag allows these syntaxes. </p>

                <ul class="ul bulletList">
                  <li class="li">
                    <samp class="codeph apex_code">@see </samp><var class="keyword varname">class</var><samp class="codeph nolang">#</samp><var class="keyword varname">member</var>
                  </li>

                  <li class="li">
                    <samp class="codeph apex_code">@see
                      <span class="string">"</span></samp><var class="keyword varname">text-string</var><samp class="codeph nolang">"</samp>
                  </li>

                  <li class="li">
                    <samp class="codeph apex_code">@see &lt;a
                      href=<span class="string">"</span></samp><var class="keyword varname">URL</var><samp class="codeph nolang">"&gt;</samp><var class="keyword varname">label</var><samp class="codeph nolang">&lt;/a&gt;</samp>
                  </li>

                </ul>

                <p class="p">For the <samp class="codeph apex_code">@see
                  </samp><var class="keyword varname">class</var><samp class="codeph nolang">#</samp><var class="keyword varname">member</var> syntax:</p>

                <p class="p">
                  <var class="keyword varname">class</var>—The fully-qualified name of the class or interface that
                  you want to link to.
                </p>

                <p class="p">
                  <var class="keyword varname">#member</var>—The specific member within a class that you want to
                  link to. For example,
                </p>

                <ul class="ul bulletList">
                  <li class="li">For fields or properties, use <samp class="codeph apex_code">#</samp><var class="keyword varname">fieldName</var>.</li>

                  <li class="li">For constructors, use <samp class="codeph apex_code">#</samp><var class="keyword varname">ClassName</var><samp class="codeph nolang">(</samp><var class="keyword varname">parameterTypes</var><samp class="codeph nolang">)</samp>.</li>

                  <li class="li">For methods, use <samp class="codeph apex_code">#</samp><var class="keyword varname">methodName</var><samp class="codeph nolang">(</samp><var class="keyword varname">parameterTypes</var><samp class="codeph nolang">)</samp>. The <var class="keyword varname">parameterTypes</var> are important to
                    distinguish overloaded methods. Use the fully-qualified name for the parameter
                    types if they’re from a different package.</li>

                </ul>


              </td>

            </tr>

            <tr>
              <td class="entry" headers="d91741e123" data-title="Tag">
                <samp class="codeph apex_code">@since </samp><var class="keyword varname">value</var>
              </td>

              <td class="entry" headers="d91741e126" data-title="Applicable Apex Elements">All</td>

              <td class="entry" headers="d91741e129" data-title="Description and Example">Indicates the version or date that the element was introduced. This tag is
                particularly useful for package authors. </td>

            </tr>

            <tr>
              <td class="entry" headers="d91741e123" data-title="Tag">
                <samp class="codeph apex_code">@throws </samp><var class="keyword varname">exceptionType
                  description</var>
              </td>

              <td class="entry" headers="d91741e126" data-title="Applicable Apex Elements">Method, Constructor</td>

              <td class="entry" headers="d91741e129" data-title="Description and Example">Documents an exception that can be thrown, where <samp class="codeph nolang">exceptionType</samp> and <samp class="codeph nolang">description</samp> are
                placeholder values.</td>

            </tr>

            <tr>
              <td class="entry" headers="d91741e123" data-title="Tag">
                <samp class="codeph apex_code">@version
                </samp><var class="keyword varname">value</var>
              </td>

              <td class="entry" headers="d91741e126" data-title="Applicable Apex Elements">Class, Interface, Enum</td>

              <td class="entry" headers="d91741e129" data-title="Description and Example">Specifies the version of the element. </td>

            </tr>

            <tr>
              <td class="entry" headers="d91741e123" data-title="Tag">
                <samp class="codeph apex_code">{@code </samp><var class="keyword varname">text</var><samp class="codeph nolang">}</samp>
              </td>

              <td class="entry" headers="d91741e126" data-title="Applicable Apex Elements">ApexDoc comment</td>

              <td class="entry" headers="d91741e129" data-title="Description and Example">Formats comment text as inline code. </td>

            </tr>

            <tr>
              <td class="entry" headers="d91741e123" data-title="Tag">
                <samp class="codeph apex_code">{@hidden </samp><var class="keyword varname">text</var><samp class="codeph nolang">}</samp>
              </td>

              <td class="entry" headers="d91741e126" data-title="Applicable Apex Elements">All</td>

              <td class="entry" headers="d91741e129" data-title="Description and Example">Prevents an element from appearing in generated docs.</td>

            </tr>

            <tr>
              <td class="entry" headers="d91741e123" data-title="Tag">
                <samp class="codeph apex_code">{@link
                </samp><var class="keyword varname">reference</var><samp class="codeph nolang">}</samp>
              </td>

              <td class="entry" headers="d91741e126" data-title="Applicable Apex Elements">ApexDoc comment</td>

              <td class="entry" headers="d91741e129" data-title="Description and Example">Creates an inline link to another element, where <samp class="codeph nolang">reference</samp> is a placeholder value.<p class="p">The <samp class="codeph apex_code">@link</samp> tag allows these syntaxes, where <samp class="codeph nolang">class</samp>, <samp class="codeph nolang">member</samp>, <samp class="codeph nolang">text-string</samp>, <samp class="codeph nolang">URL</samp>, and <samp class="codeph nolang">label</samp> are placeholder
                  values. </p>
                <ul class="ul bulletList">
                  <li class="li">
                    <samp class="codeph apex_code">@link </samp><var class="keyword varname">class</var><samp class="codeph nolang">#</samp><var class="keyword varname">member</var>
                  </li>

                  <li class="li">
                    <samp class="codeph apex_code">@link
                      <span class="string">"</span></samp><var class="keyword varname">text-string</var><samp class="codeph nolang">"</samp>
                  </li>

                  <li class="li">
                    <samp class="codeph apex_code">@link &lt;a
                      href=<span class="string">"</span></samp><var class="keyword varname">URL</var><samp class="codeph nolang">"&gt;</samp><var class="keyword varname">label</var><samp class="codeph nolang">&lt;/a&gt;</samp>
                  </li>

                </ul>
                <p class="p">For the <samp class="codeph apex_code">@link
                  </samp><var class="keyword varname">class</var><samp class="codeph nolang">#</samp><var class="keyword varname">member syntax</var>:</p>
                <p class="p"><var class="keyword varname">class</var>—The
                  fully-qualified name of the class or interface that you want to link
                  to.</p>
                <p class="p"><samp class="codeph apex_code">#</samp><var class="keyword varname">member</var>—The
                  specific member within a class that you want to link to. For example, </p>
                <ul class="ul bulletList">
                  <li class="li">For fields or properties, use <samp class="codeph apex_code">#</samp><var class="keyword varname">fieldName</var>.</li>

                  <li class="li">For constructors, use <samp class="codeph apex_code">#</samp><var class="keyword varname">ClassName</var><samp class="codeph nolang">(</samp><var class="keyword varname">parameterTypes</var><samp class="codeph nolang">)</samp>.</li>

                  <li class="li">For methods, use <samp class="codeph apex_code">#</samp><var class="keyword varname">methodName</var><samp class="codeph nolang">(</samp><var class="keyword varname">parameterTypes</var><samp class="codeph nolang">)</samp>. The <var class="keyword varname">parameterTypes</var> are important to
                    distinguish overloaded methods. Use the fully-qualified name for the parameter
                    types if they’re from a different package.</li>

                </ul>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d91741e123" data-title="Tag">
                <samp class="codeph apex_code">{@literal
                </samp><var class="keyword varname">text</var><samp class="codeph nolang">}</samp>
              </td>

              <td class="entry" headers="d91741e126" data-title="Applicable Apex Elements">ApexDoc comment</td>

              <td class="entry" headers="d91741e129" data-title="Description and Example">Shows text literally without HTML tag interpretation.</td>

            </tr>

          </tbody>

        </table>

## Example: @author tag

\* @author Marie Hill
\* @author Ben Stuar

## Example: @deprecated tag

\* @deprecated in 1.3.2.
\* Use {@link #newFieldName} instead.

## Example: @example tag with {@code}

 \* @example
 \* {@code
 \* Account a;
 \* try {
 \*  a = new AccountManager().createAccount('Acme', 'Agriculture');
 \* } catch (AccountManager.AccountException caught) {
 \*   LOGGER.log(caught);
 \*   // further exception handling
 \* }
 \* }

## Example: @group tag

\* @group Account

## Example: @param tag

\* @param accountName The desired name for the new 
\* account. Cannot be null or empty.

## Example: @return tag

\* @return The newly created Account sObject with its
\* ID populated.

## Example: @see tag

\* @see GeolocationService#GeocodingException

## Example: @since tag

\* @since 0.1.0

## Example: @throws tag

\* @throws AccountManager.AccountException if 
\* accountName is invalid or if DML operation fails.

## Example: @version tag

\* @version 0.2.0

## Example: {@code} inline tag

 \* {@code
 \* Account a;
 \* try {
 \*  a = new AccountManager().createAccount('Acme', 'Agriculture');
 \* } catch (AccountManager.AccountException caught) {
 \*   LOGGER.log(caught);
 \*   // further exception handling
 \* }
 \* }

## Example: {@hidden} tag

\* {@hidden NOTE TO MAINTAINERS: Update this method
\* if new security threats are identified. 
\* The current regex is designed to handle common XSS
\* patterns but may not be exhaustive. 
\* The last major update was in v2.1.}

## Example: {@link} tag

 \* Populated after using the {@link AccountService}.

## Example: {@literal} tag

\* This string might contain malicious or unexpected characters,
 \* like a {@literal <script>} tag or a backslash {@literal \\}.

#### See Also

- [Document Apex Constructs and Features](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_doc_constructs.htm "Apex has unique constructs and platform-specific features that require particular attention in documentation. Use these guidelines to document these elements with ApexDoc.")
- [ApexDoc Examples](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_doc_examples.htm "See practical examples of ApexDoc comments applied to various Apex constructs.")