OpenAPI Setup
Learn how to add your API documentation using OpenAPI
What is OpenAPI?
OpenAPI (formerly known as Swagger) is a standard way to describe your API. It’s like a blueprint that tells others how your API works, what endpoints it has, and what data it expects and returns.
Getting Started
Let’s break down the process of adding OpenAPI documentation into simple steps:
Step 1: Prepare Your OpenAPI File
First, you’ll need an OpenAPI document that describes your API. This can be either:
- A JSON file
- A YAML file
Your document needs to follow OpenAPI version 3.0 or higher.
Not sure if your OpenAPI file is valid? Use our checker tool:
Step 2: Choose How to Add Your Documentation
You have two main options for adding OpenAPI documentation:
Option A: Quick Auto-Generation (Recommended for Beginners)
This is the fastest way to get started. Just add your OpenAPI file location to your docs.json
:
This will automatically create pages for all your API endpoints!
You can use either a URL or a local file path for the openapi
field.
Option B: Custom Pages (More Flexible)
If you want more control, you can create individual pages for each API endpoint. Here’s how:
- Create a new
.mdx
file for your endpoint - Add this to the top of your file:
Need to create many pages? Use our automatic page generator:
Step 3: Add More Details (Optional)
Once your basic setup is working, you can:
- Add custom descriptions to your endpoints
- Include example code
- Add authentication details
- Group related endpoints together
Advanced Configuration
Organizing Your API Documentation
You can organize your endpoints into groups:
Creating Schema Pages
Want to document your data models? You can create pages for your OpenAPI schemas:
The schema name must match exactly what’s in your OpenAPI file under components.schemas
.
Troubleshooting
If your OpenAPI documentation isn’t showing up:
- Check that your OpenAPI file is valid
- Make sure the paths and methods match exactly
- Verify that your file paths are correct
- Ensure you’re using OpenAPI 3.0 or higher
Need help? Join our Discord community for support!