Request for Dolibarr Accounting (Compta) REST API Documentation

Hello Dolibarr Support Team,

I hope you’re doing well. I’m currently integrating Dolibarr’s double entry accounting module (compta) with our .NET-based remittance system for automated bank-account reconciliation. I have already enabled the REST server in Dolibarr, but I haven’t been able to locate any /compta (accounting) endpoints in the API explorer or documentation.

Could you please provide:

  1. Official REST API reference for the accounting module, including a list of available endpoints (journals, ledger entries, chart of accounts, period/fiscal-year management, etc.).

  2. Authentication and permission requirements for accessing accounting endpoints.

  3. Sample request/response payloads for common operations (e.g. creating a journal entry, retrieving account balances).

  4. Cache-management instructions (if any), such as how to clear or refresh API caches after enabling new modules.

  5. Any version-specific notes or module dependencies I should be aware of.

Any pointers to online documentation, PDF guides, or example code snippets would be greatly appreciated.

Thank you very much for your time and support!

Hi and welcome :slight_smile:

Good thing you found the API Explorer
(top menu tools, left side menu API Explorer for other readers)

You need an API key from a user, and that user needs to have access to the (accounting) module to get some data - but you can still see the endpoint.
(top menu home, left menu Users & Groups, list, find your user, and then modify. One of the fields are the API key.)

I’ve used the API quite a bit, but I never used the accounting API. Looking at it, I think you will be disappointed :-/

This picture below are all the API endpoints in my Dolibarr 21.0.1 and it depends on which modules I have enabled.

Clicking on the GET in the API Explorer will unfold to this picture - the others will also unfold - and to fold just click the same again.

IF you don’t find all the API endpoints you need - I didn’t - then it is not too hard to make them yourself. I’ve made quite a few contributions to expand Dolibarrs API endpoints
https://github.com/Dolibarr/dolibarr/pulls?q=api+is%3Apr+author%3AJonBendtsen+

For a lot of these PR’s all I did was find some similar API endpoints, copy that code and modify it a little to fit the new API endpoint I wanted to create. I did that both to preserve the look and feel of the code, but also because I am not an experienced PHP developer, I am not even an experienced developer. I come with a sysadmin background.

When I started using the API I used the GUI to put in some sample data, then I used the API to extract it, look at the extracted json and then I tried posting and putting json while looking in the GUI to observe the results. Naturally you can not do that with a live production Dolibarr, but don’t worry, it is very easy to get a development Dolibarr.

I’ve made a repository which makes it easier to get a development dolibarr from a backup file from a live production Dolibarr.

You can even run the same version as the live production - or any other version for that matter.

I posted about it here Easy dev setup using copy of production backup - #5 by jonbendtsen and the direct link are here GitHub - JonBendtsen/dolibarr_devtainer: Development container setup for dolibarr

Not so long ago someone posted this which I have not yet taken a close look at, but it says it has these features that might be inspiration for you.

  • Custom accounting report generation using Pandas.
  • Generation of tax and report data for Skatteverket.

My Dolibarr usage is as the backend for a dance class registration system. I have a python flask based form system running here https://shop.balboaswing.dk/ which uses the API to fetch classes (product/services) and events (projects) from Dolibarr, then some forms that the end user fills out to register for our dance classes. I’ve started this in October 2023, have on organisation onboard and I am looking to expand with a software as a service once it is a little better. Hopefully here in 2025.

You might also want to look in these files in github

JonSweet16:dolibarr jonbendtsen$ find htdocs/ -type f -iname *api* | grep -i account
htdocs/accountancy/class/api_accountancy.class.php
htdocs/compta/bank/class/api_bankaccounts.class.php