API

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 #

Authentication #

BonsAPI uses Clerk for authentication. All API requests require:

  • Bearer token in the Authorization header
  • Valid Clerk session

See the API Endpoints documentation for authentication details.

Quick Start #

  1. Start the development environment

    mise run dev
    
  2. Access Swagger UI - Pre-configured with automatic authentication

    • Local: http://localhost:8001
    • Coder: https://app--dev--{workspace}--{owner}.coder.internal.gotofu.com
  3. 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.