API keys and webhooks
Let other software read and write your data, or send events to other systems.
Overview
An API lets another program use Hesabu ERP, for example a website that creates orders. A webhook does the opposite: Hesabu ERP calls another system when something happens, such as a submitted invoice.
These tools are for developers or technical staff.
API keys
- Use a dedicated user for the integration, such as
[email protected], with only the roles it needs. See Permissions and restricting access. - Open that user, scroll to API Access and click Generate Keys.
- Copy the API Secret immediately. It is shown only once.
- The other software sends
Authorization: token <api_key>:<api_secret>with each request.
Webhooks
- Search for Webhook and click Add Webhook.
- Choose the Document Type and the Event, for example Sales Invoice and on_submit.
- Enter the Request URL of the receiving system.
- Optionally add Request Headers, a Condition and a JSON body with the fields to send.
- Save. Submit a test document, then check the receiver and the Webhook Request Log.
Practical example
A courier company's system receives a webhook each time a delivery note is submitted, and starts the delivery job. Another uses an API key to read stock levels onto the shop's website.
Important notes
- Treat keys like passwords. Regenerate them if they leak, and remove them when a project ends.
- Use HTTPS addresses only.
- Mistakes in an API call can change real data. Test on a copy or with a test document.
Common mistakes
- Using the administrator's keys for an integration.
- Sending more fields than the receiver needs.
Troubleshooting
If a webhook fails, open its Webhook Request Log for the response from the other system, which usually names the reason.