API Reference¶
Complete API endpoint documentation.
Auto-Generated Documentation¶
FastAPI provides interactive API docs:
- Swagger UI: http://localhost:8020/docs
- ReDoc: http://localhost:8020/redoc
API Endpoints¶
Authentication (/api/auth)¶
All Tiers:
POST /api/auth/login- Email/password loginPOST /api/auth/signup- Create accountGET /api/auth/logout- LogoutGET /api/auth/current- Get current userGET /api/auth/google/authorize- Start Google OAuthGET /api/auth/google_callback- Google OAuth callbackPOST /api/auth/forgot-password- Request password resetPOST /api/auth/reset-password- Reset password with tokenPUT /api/auth/profile- Update user profile
Articles (/api/articles)¶
All Tiers:
GET /api/articles- List articlesPOST /api/articles- Create articleGET /api/articles/{id}- Get articlePUT /api/articles/{id}- Update articleDELETE /api/articles/{id}- Delete article
Payments (/api/payments) - Top G+¶
GET /api/payments/products- List Stripe productsPOST /api/payments/checkout/create- Create checkout sessionPOST /api/payments/portal/create- Create customer portal sessionPOST /api/payments/webhook- Stripe webhook handlerPOST /api/payments/cancel-subscription- Cancel subscription
Analytics (/api/analytics) - Top G+¶
GET /api/analytics/basic- Basic analytics (Starter+)GET /api/analytics/advanced- Advanced analytics (Pro+)GET /api/analytics/reporting- Premium reporting (Premium+)GET /api/analytics/team- Team analytics (Enterprise)
Integrations (/api/integrations) - Top G+¶
GET /api/integrations- List available integrationsGET /api/integrations/status- Integration statusGET /api/integrations/{id}- Integration detailsPOST /api/integrations/{id}/setup- Setup integration
Plans (/api/plans) - Top G+¶
GET /api/plans/me- Current user's plan infoPOST /api/plans/check-feature- Check feature accessGET /api/plans/upgrades- Available upgradesGET /api/plans/features- All featuresGET /api/plans/comparison- Plan comparison
Upgrades (/api/upgrades) - Top G+¶
GET /api/upgrades/options- Upgrade optionsPOST /api/upgrades/checkout- Create upgrade checkoutPOST /api/upgrades/proration-preview- Preview proration
Authentication¶
JWT Token Authentication¶
Login to get token: ```bash curl -X POST http://localhost:8020/api/auth/login \ -H "Content-Type: application/json" \ -d '{"email":"[email protected]","password":"password123"}'
Use token in requests:
Or use cookie (automatic in browser).
TypeScript API Client¶
Auto-generated TypeScript client in frontend/src/client/.
Generate Client¶
```bash
ALWAYS run after backend API changes¶
task frontend:generate-client
| Text Only | |
|---|---|
Request/Response Examples¶
Create Article¶
Request:
| Bash | |
|---|---|
Response:
| JSON | |
|---|---|
| |
Create Checkout Session (Top G+)¶
Request:
| Bash | |
|---|---|
Response:
| JSON | |
|---|---|
Error Responses¶
Standard Error Format¶
Common Status Codes¶
200- Success201- Created400- Bad request401- Unauthorized (login required)403- Forbidden (insufficient permissions)404- Not found422- Validation error500- Server error
API Base URL¶
- Local: http://localhost:8020
- Production: https://yourdomain.com
Rate Limiting¶
Currently no rate limiting implemented.
Add if needed for production.
CORS Configuration¶
Configured in main.py:
| Python | |
|---|---|
Update for your production domain.
Learning Resources¶
Learn FastAPI: Free interactive tutorials for mastering FastAPI.
Related Documentation¶
- Authentication - Auth system
- Stripe Payments - Payment endpoints (Top G+)
- Analytics - Analytics endpoints (Top G+)
- Development - API development
- FastAPI Docs - FastAPI documentation