> For the complete documentation index, see [llms.txt](https://raviram.gitbook.io/webapi-module-1/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://raviram.gitbook.io/webapi-module-1/introduction/swagger-ui.md).

# Swagger UI

### Swagger UI <a href="#swagger-ui" id="swagger-ui"></a>

Swagger UI offers a web-based UI that provides information about the service, using the generated OpenAPI specification. Both Swashbuckle and NSwag include an embedded version of Swagger UI, so that it can be hosted in your ASP.NET Core app using a middleware registration call.&#x20;

The web UI looks like this:

![Swagger UI](https://learn.microsoft.com/en-us/aspnet/core/tutorials/web-api-help-pages-using-swagger/_static/swagger-ui.png?view=aspnetcore-7.0)

Each public action method in your controllers can be tested from the UI. Select a method name to expand the section. Add any necessary parameters and select **Try it out!**

![Example Swagger GET test](https://learn.microsoft.com/en-us/aspnet/core/tutorials/web-api-help-pages-using-swagger/_static/get-try-it-out.png?view=aspnetcore-7.0)

### Note

The Swagger UI version used for the screenshots is version 2, while latest versions also exist.

### Try a demo

This is a sample server [Petstore server](https://petstore.swagger.io/). You can find out more about Swagger at [http://swagger.io](http://swagger.io/)

For this sample, you can use the api key `special-key` to test the authorization filters!

Try getting a pet with id 2 (id 1 does not work for some good reason!)

{% embed url="<https://petstore.swagger.io/>" %}
