<html><head><link rel="canonical" href="https://www.jetbrains.com/help/writerside/generate-api-reference.html.md/" data-react-helmet="true"/></head><body># Generate API reference

Use the  [&lt;api-doc&gt;](semantic-markup-reference.html#api-doc)  element to generate an API reference from a specification. You can generate the full API reference of all operations or a subset based on the specified [tags](https://swagger.io/docs/specification/grouping-operations-with-tags/).

Procedure: Generate API reference in new instance

1. Add the OpenAPI specification file (YAML or JSON) to the project.

2. In the  Writerside tool window toolbar, click ![the Options button](https://resources.jetbrains.com/help/img/writerside/moreVertical.svg) and select `New Instance | API Reference`.

![Create new API doc instance](https://resources.jetbrains.com/help/img/writerside/new_api_doc_instance.png)

3. In the Generate API Reference dialog, point to the location of the API specification file.

![Generate API Reference dialog](https://resources.jetbrains.com/help/img/writerside/add-api-reference-dialog.png)

You can choose to generate XML or Markdown topics, create separate topics for objects and endpoints. If you do not select any options, the API reference will be generated in one topic.

4. Click OK and wait for Writerside to generate the instance.

Procedure: Generate API reference in existing instance

1. Add the OpenAPI specification file (YAML or JSON) to the project.

2. In the  Table of Contents pane of the  Writerside tool window, click ![the Add Topic button](https://resources.jetbrains.com/help/img/writerside/add.svg) and select API Reference.

![Add API Reference](https://resources.jetbrains.com/help/img/writerside/add-api-reference.png)

3. In the Generate API Reference dialog, point to the location of the API specification file.

![Generate API Reference dialog](https://resources.jetbrains.com/help/img/writerside/add-api-reference-dialog.png)

You can choose to generate XML or Markdown topics, create separate topics for objects and endpoints. If you do not select any options, the API reference will be generated in one topic.

4. Click OK and wait for Writerside to generate the topics.

You can also use the  [&lt;api-doc&gt;](semantic-markup-reference.html#api-doc)  element in any topic where you want to add a generated reference of the API specification. If necessary, add the `tag` attribute to generate a reference only for operations with a specific tag.

Full reference:

```XML
<api-doc openapi-path="path/to/spec.yaml">
```

Specific tag:

```XML
<api-doc openapi-path="path/to/spec.yaml" tag="Pet">
```

Writerside generates a separate chapter for each operation, uses the summary as the title, and adds all necessary details about the endpoint: URL, parameters, headers, requests with optional samples, and responses. Use the [preview](preview-topics.html) to see how it will render.

&gt; **Note:**
&gt; If there is no summary for an operation, Writerside will generate a chapter without a title and display a warning in the preview.

Here is an example of a generated OpenAPI reference with just one endpoint:

## Create a new document

OpenAPI endpoint: POST /documents

### Request parameters

**Request**

Body

Content type: application/json

- **application/json** (Document, required)
- **title** (string)
- **content** (string)

**JSON example**

```JSON
{
  "title": "Example Document",
  "content": "This is some example content for the document."
}
```

### Responses

**Response 201**

Content type: application/json

Document created successfully

- **application/json** (null)

**201**

```JSON
{
  "message": "Document created"
}
```

**Response 400**

Content type: application/json

Bad Request

- **application/json** (null)

**400**

```JSON
{
  "message": "Bad Request"
}
```

</api-doc></api-doc></body></html>