---
title: "How to use Swagger"
slug: "how-to-use-swagger"
description: "Swagger is an interface description language that describes RESTful APIs expressed using JSON. It allows you to create interactive, machine and human-readable."
updated: 2026-02-01T01:52:04Z
published: 2026-02-01T01:52:04Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.document360.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to use Swagger

Swagger is an interface description language that describes RESTful APIs expressed using JSON. It allows you to create interactive, machine and human-readable [API documentation](https://document360.com/blog/api-documentation/). It helps you visualize and interact with the API's resources without any implementation logic. It is a web-based application.

---

## Swagger documentation site

1. Open the [Swagger documentation site](https://apihub.document360.io/).
2. To authenticate the documentation, click **Authorize**. The **Available authorizations** panel will appear.
3. Enter the API token in the **Value** field.

> [!NOTE]
> ** NOTE
> 
> You can select an existing token, or you can generate a new token as per your requirement. To generate a new token, follow the below steps
> 
> - Navigate to **Settings** (**) in the left navigation bar****in the Knowledge base portal.
> - In the left navigation pane, navigate to ****Knowledge base portal****> **API Tokens**.
> - Type a name for the API token in the **Enter token name**.
> - Select the required HTTP method(s). You have four methods under **Allowed method(s)**: **GET**, **PUT**, **POST** and **DELETE**.
> - You can only use the generated token for the selected method(s). It cannot be used to perform other methods.
> - Click **Copy**to copy the API token.
4. Click the **Authorize** button.
5. Once done, click the **Close** button. The authorization is done successfully.

![Image showing authorize panel in Swagger](https://cdn.document360.io/860f9f88-412e-4570-8222-d5bf2f4b7dd1/Images/Documentation/17_ScreenShot-Swagger.png)

> [!NOTE]
> ** NOTE
> 
> If you wish to change to a different token, click **Authorize** > **Logout** > enter your **API token** > **Authorize** > **Close**.

### GET

- The**GET**method is used to retrieve information.
- Below is an example of **GET**action, to retrieve all records about the user.

![Image showing GET action in Swagger](https://cdn.document360.io/860f9f88-412e-4570-8222-d5bf2f4b7dd1/Images/Documentation/12_ScreenShot-Swagger_Get.png)

1. Fill the marked fields and click the **Execute** button.

The information about the user will be available under the **Responses**section.

![Image showing GET action in Swagger](https://cdn.document360.io/860f9f88-412e-4570-8222-d5bf2f4b7dd1/Images/Documentation/13_ScreenShot-Swagger_Get.png)

### POST

- The **POST** method is used to add an item.
- Below is an example of a **POST**action, to add a user to a project.

![Image showing POST action in Swagger](https://cdn.document360.io/860f9f88-412e-4570-8222-d5bf2f4b7dd1/Images/Documentation/14_ScreenShot-Swagger_Post.png)

1. You should add the user information such as email_id, first_name, and last_name to add a user to the project. The user will be added to the project.
2. Click the **Execute** button. The addition of the user will be successful if the status is 200 and the success is true.

### PUT

- The**PUT**method is used to update an existing item.
- Below is an example of **PUT**action, to update a user role in the project.

![Image showing PUT action in Swagger](https://cdn.document360.io/860f9f88-412e-4570-8222-d5bf2f4b7dd1/Images/Documentation/15_ScreenShot-Swagger_Put.png)

1. Enter the **userId** in the marked field.
2. Update the user role with the number mentioned for the user role syntax. The numbers for the respective roles are as follows:
  - 1 → Administrator
  - 2 → Editor
  - 3 → Draft Writer
  - 4 → Reader
  - 7 → Owner
3. Once done, click on the **Execute** button.

The update of the user is successful if the status is 200 and the success is true.

### DELETE

- The **DELETE**method is used to delete an item.
- Below is an example of a **DELETE**action, to delete a **userId**.

1. Enter the **userId**in the marked field.
2. Once done, click on the **Execute** button. If the status is 200 and the success is true, the **userId**will be successfully deleted.

![Image showing DELETE action in Swagger](https://cdn.document360.io/860f9f88-412e-4570-8222-d5bf2f4b7dd1/Images/Documentation/16_ScreenShot-Swagger_Delete.png)

> [!NOTE]
> ** NOTE
> 
> It is mandatory to enter the content in the field that are marked ***required**.

For more information, refer to the following blogs

1. [Ultimate guide to create an API documentation with examples](https://document360.com/blog/api-documentation/)
2. [Feature spotlight – API in Document360](https://www.google.com/search?q=Feature+spotlight+%E2%80%93+API+in+Document360&amp;rlz=1C1CHBD_enIN1119IN1119&amp;oq=Feature+spotlight+%E2%80%93+API+in+Document360&amp;gs_lcrp=EgZjaHJvbWUyBggAEEUYOTIGCAEQRRg80gEHNDI5ajBqN6gCALACAA&amp;sourceid=chrome&amp;ie=UTF-8)

---

### FAQs

#### What should I do if refreshing the page ends my session?

If you refresh the page, the session might end, and you will have to authenticate again. Follow the steps provided for authentication.

#### How should I format fields that require a specific character?

You must use an underscore wherever required. For example, use “email_id” instead of “email id.” Using spaces will result in an error.

## Related

- [How to use Postman](/how-to-use-postman.md)
