Swagger UI
Explore and test APIs interactively.
Swagger UI is a free Spring Boot 4 Microservices & REST APIs lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Spring Boot 4 Microservices & REST APIs learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
What is Swagger UI?
Swagger UI renders your OpenAPI spec as an interactive web page. Developers can browse endpoints, read schemas, and send live requests - all from the browser.
Where it lives
With the -ui starter, Swagger UI is served at /swagger-ui.html by default. It loads the spec from /v3/api-docs.
// open in a browser:
// http://localhost:8080/swagger-ui.htmlTry it out
Each operation has a Try it out button. You fill in parameters and body, click Execute, and the UI shows the real request URL, response status, headers and body.
Reading the schema view
The Schemas section at the bottom lists every model with field types, descriptions and examples taken from your @Schema annotations.
Changing the UI path
Relocate the UI with a property - useful when serving docs under a custom route.
# application.yml
springdoc:
swagger-ui:
path: /docsSorting endpoints and tags
By default operations appear in an unsorted order. Properties let you sort operations and tags alphabetically for a cleaner page.
springdoc:
swagger-ui:
operations-sorter: alpha
tags-sorter: alphaTrying secured endpoints
If you declared a security scheme, the UI shows an Authorize button. Enter a token once and it is attached to every secured request you try.
Filtering operations
Enable a search box to filter the long list of endpoints by name, which helps in large APIs.
springdoc:
swagger-ui:
filter: trueDisplay options
You can control how much is expanded by default and whether request duration is shown, tuning the UI for your team's taste.
springdoc:
swagger-ui:
doc-expansion: none # collapse all by default
display-request-duration: trueSecuring the UI itself
Swagger UI exposes your API surface. In production, protect /swagger-ui/** and /v3/api-docs/** with Spring Security, or disable them, so they are not publicly browsable.
// permit only authenticated users
http.authorizeHttpRequests(a -> a
.requestMatchers("/swagger-ui/**", "/v3/api-docs/**").authenticated()
.anyRequest().permitAll());UI vs spec - division of labor
Remember: Swagger UI is just a viewer. The source of truth is the OpenAPI spec generated from your code and annotations. Improve the docs by improving annotations, not the UI.
Quick Check
Confirm your Swagger UI knowledge.
Recap
You explored Swagger UI:
- Served at
/swagger-ui.html, backed by/v3/api-docs - Try it out sends live requests; Authorize adds tokens
- Sort, filter and expansion are configurable via properties
- Protect or disable the UI in production
Frequently asked questions
Is the “Swagger UI” lesson free?
Yes — the full text of “Swagger UI” is free to read here on the web, and the Spring Boot 4 Microservices & REST APIs course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Spring Boot 4 Microservices & REST APIs course, upgrade to CoddyKit PRO.
What will I learn in “Swagger UI”?
Explore and test APIs interactively. You practise Spring Boot 4 Microservices & REST APIs with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Spring Boot 4 Microservices & REST APIs?
No prior experience is required. Spring Boot 4 Microservices & REST APIs on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Swagger UI” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Spring Boot 4 Microservices & REST APIs lesson?
Yes. Every Spring Boot 4 Microservices & REST APIs lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.