Back to all posts
fastapi programming python

FastAPI built-in API docs

0 min read (70 words)

FastAPI has two documentations:

  • by swagger-ui (yourfastapiurl:port/docs)
  • by redoc (yourfastapiurl:port/redoc)
from fastapi import FastAPI

app = FastAPI()

@app.get("/")
async def root():
    return {"result": "It's working"}

@app.get("/ise/{mac_address}")
async def ise_search_mac_address(mac_address):
    return {"Search MAC": mac_address}

@app.get("/{mode}/ise")
async def ise_mode(mode):
    if mode == 'dev':
        return {'result': "Working with Dev ISE"}

    return {'result': "Working with Prod ISE"}

http://127.0.0.1:8089/docs/

FastAPI Swagger UI interface showing interactive API documentation with endpoint listings and testing capabilities

Also you can try it right there:

Interactive API testing interface in FastAPI's Swagger UI showing example endpoint execution

http://127.0.0.1:8089/redoc/

FastAPI ReDoc documentation interface displaying API endpoints in a clean, organized layout

And for sure, great FastAPI Documentation itself: here

Dmitry Golovach
About

Dmitry Golovach

Principal Network Engineer and AI enthusiast. Always learning, always building.

Share this post

All posts