Skip to content

OpenAPI Documentation

Michael Pisman edited this page Aug 7, 2025 · 1 revision

OpenAPI Documentation

As our API is built using FastAPI, we can use OpenAPI to document our API. OpenAPI is a specification for describing RESTful APIs. It allows us to describe the API in a human-readable format and generate documentation and client libraries automatically.

Accessing Interactive Documentation

Once your API server is running, you can access the interactive OpenAPI documentation at:

  • Swagger UI: http://localhost:9000/docs
  • ReDoc: http://localhost:9000/redoc

These interfaces provide:

  • Complete API endpoint documentation
  • Interactive request/response testing
  • Schema definitions
  • Authentication testing

Benefits of OpenAPI

Automatic Documentation Generation

  • Self-updating documentation that stays in sync with your code
  • Interactive documentation that allows testing endpoints directly
  • Multiple format outputs (JSON, YAML, HTML)

Client Code Generation

You can generate client libraries for many programming languages using tools like:

Tool Integration

OpenAPI specifications work with many development tools:

  • Postman - Import OpenAPI specs for API testing
  • Insomnia - Alternative API testing tool
  • Code editors - Many support OpenAPI for autocompletion and validation

Getting the OpenAPI Schema

You can download the OpenAPI schema in JSON format using:

unipoll-api get-openapi

Or access it directly at: http://localhost:9000/openapi.json

This JSON file can be imported into various tools or used to generate client libraries for your applications.

Clone this wiki locally