API Endpoints

API Endpoints #

This document provides an overview of the main API endpoints available in BonsAPI.

Authentication #

POST /api/auth/login #

Authenticates a user and returns a JWT token.

Request:

{
  "email": "user@example.com",
  "password": "password"
}

Response:

{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "expires_at": "2023-12-31T23:59:59Z"
}

POST /api/auth/refresh #

Refreshes an existing JWT token.

Entities #

GET /api/entities #

Returns a list of entities the user has access to.

GET /api/entities/{entity_id} #

Returns details for a specific entity.

POST /api/entities #

Creates a new entity.

PUT /api/entities/{entity_id} #

Updates an existing entity.

Documents #

POST /api/documents/upload #

Uploads a document for processing.

GET /api/documents/{document_id} #

Retrieves information about a specific document.

GET /api/documents #

Lists documents for the authenticated user or specified entity.

Invoices #

POST /api/invoices/extract #

Extracts data from an invoice document.

GET /api/invoices/{invoice_id} #

Retrieves information about a specific invoice.

GET /api/invoices #

Lists invoices for the authenticated user or specified entity.

Integration #

GET /api/integrations #

Lists available integrations.

POST /api/integrations/{integration_id}/connect #

Connects to a third-party service.

GET /api/integrations/{integration_id}/status #

Checks the status of an integration.

Settings #

GET /api/settings/{entity_id} #

Retrieves settings for a specific entity.

PUT /api/settings/{entity_id} #

Updates settings for a specific entity.

Error Responses #

All endpoints follow a consistent error response format:

{
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable error message",
    "details": { ... }
  }
}

Common HTTP status codes:

  • 200: Success
  • 400: Bad Request
  • 401: Unauthorized
  • 403: Forbidden
  • 404: Not Found
  • 500: Internal Server Error