BonsAPI Documentation #
BonsAPI is the backend service powering the BonsAI platform. Built with Rust and Actix Web, it provides a RESTful API for document processing, invoice extraction, and data management.
Architecture #
BonsAPI follows a layered architecture:
- Controllers - Handle HTTP requests and responses
- Services - Contain business logic
- Repositories - Interact with the database (PostgreSQL)
- Models - Data structures and types
Tech Stack: Rust, Actix Web, PostgreSQL, Redis, RabbitMQ
Documentation Sections #
- Overview - Architecture, features, and tech stack
- API Endpoints - Complete API reference with request/response examples
- Integration Guide - How to integrate with BonsAPI
- Billing System - Comprehensive guide to the billing and subscription system
Authentication #
BonsAPI uses Clerk for authentication. All API requests require:
- Bearer token in the
Authorizationheader - Valid Clerk session
See the API Endpoints documentation for authentication details.
Quick Start #
-
Start the development environment
mise run dev -
Access Swagger UI - Pre-configured with automatic authentication
- Local:
http://localhost:8001 - Coder:
https://app--dev--{workspace}--{owner}.coder.internal.gotofu.com
- Local:
-
Test endpoints immediately - Authentication credentials are pre-filled from
.config.yaml(test section) and can be overridden in the Swagger UI “Authorize” dialog
For detailed setup and troubleshooting, see the Swagger UI Setup Guide.
Related Documentation #
- Example Workflow: Adding a New Field - Complete guide showing how to add a new field to the API
- Database Schema - Understanding the data models
- Webapp Documentation - Frontend that consumes this API
- Hinoki - Document processing engine used by BonsAPI
- Swagger Setup.