Overview
TrailBase automatically generates OpenAPI 3.0 specifications for your APIs, providing interactive documentation through Swagger UI and enabling API client generation.Accessing API Documentation
Swagger UI
Access interactive API documentation at:- Interactive testing: Try API endpoints directly from the browser
- Request/response examples: See sample data for each endpoint
- Authentication: Test authenticated endpoints
- Schema documentation: Explore data models and types
OpenAPI JSON
Download the raw OpenAPI specification:API Structure
Fromcrates/core/src/lib.rs:
API Categories
Authentication API
Endpoints under/api/auth/v1:
POST /register- Register new userPOST /login- Login with email/passwordPOST /logout- Logout current userGET /user- Get current user profilePOST /verify_email- Request email verificationPOST /reset_password- Request password resetGET /oauth/{provider}- OAuth loginGET /oauth/{provider}/callback- OAuth callbackGET /oauth/providers- List OAuth providers
Records API
Endpoints under/api/records/v1/{table}:
GET /{table}- List recordsPOST /{table}- Create recordGET /{table}/{id}- Get record by IDPATCH /{table}/{id}- Update recordDELETE /{table}/{id}- Delete recordGET /files/{id}- Download file
Custom API Documentation
Document Custom Endpoints
Add OpenAPI annotations to your endpoints:Group Custom APIs
Schema Generation
Derive Schema
Nested Schemas
Response Documentation
Success Responses
Error Responses
Authentication Documentation
Bearer Token
Client Generation
Generate TypeScript Client
Use openapi-typescript:Generate Python Client
Use openapi-python-client:Generate Go Client
Use oapi-codegen:Testing with OpenAPI
Validate Responses
Contract Testing
Best Practices
Customizing Swagger UI
The Swagger UI can be customized by modifying the HTML template in the TrailBase source:Alternative API Documentation
Redoc
Use Redoc for a different documentation style:RapiDoc
RapiDoc offers a customizable API console:Next Steps
Custom Endpoints
Build documented APIs
WASM Components
Create custom endpoints
OAuth Providers
Document auth flows
Object Storage
File upload APIs