Connect another program — API keys and webhooks
Quick answerIn MAJA Books go to Settings → Integrations. New key makes an API key for a program — read only, or read and write — shown once; the program sends it in the X-Maja-Key header to https://www.majabooks.com/api/v1/… to read invoices, bills, customers, items and the rest, or to post documents through the very doors the page uses. New webhook gives an https address MAJA calls, signed, when an invoice, credit note, bill or receipt is posted or paid.
Steps — an API key
- Click Settings, then Integrations, then New key. Say what the key is for (the program's name) and whether it may read only or read and write. Make the key.
- Copy the key now — it is shown this once; MAJA keeps only its fingerprint. Give it to the program, which sends it in the header
X-Maja-Key(orAuthorization: Bearer). - The program reads with
GET /api/v1/invoices,/credit_notes,/bills,/expenses,/receipts,/payments,/customers,/vendors,/items,/accounts,/journals— with?since=for what changed after a time,?from=&to=,?status=,?limit=and?offset=; one document by?id=or?number=comes with its lines.GET /api/v1/pingsays who the key is. - A key that may write posts with
POST /api/v1/invoices(and credit_notes, bills, receipts, expenses, customers, vendors, items), the document as JSON; the answer carries the number MAJA gave it. The How to call MAJA box under the keys has an example. - The list shows each key's first characters, who made it, when it was last used and how many calls it made. Revoke stops it at once — make a new one instead; a revoked key is never revived.
Steps — a webhook
- Under Webhooks click New webhook: a name, the program's https:// address, and the events it should hear — invoice posted, invoice paid, credit note posted, bill posted, bill paid, receipt posted. Save.
- Copy the signing secret now — shown this once. Each call MAJA makes carries
X-Maja-Event,X-Maja-Delivery,X-Maja-TimestampandX-Maja-Signature: the HMAC-SHA256 of<timestamp>.<body>with the secret. The program verifies it the same way and answers 2xx within 15 seconds. - The last deliveries are listed under the webhooks — sent, or failed with the reason. Send again queues a failed one; MAJA calls the address again at once.
What MAJA does for you
- Judges every call on the server: the key's fingerprint, whether it may write, whether the member who made it is still active, and 600 calls a minute per key.
- Posts a document from the API through the same door the page uses, as the member who made the key — so the period locks, the VAT rules, the approval rules and the member's own rights apply exactly as on the page.
- Signs every webhook call with the webhook's secret and records each delivery with its answer; a webhook that keeps failing is counted, never silently dropped.
Good to know
- A key stands for its maker: an admin's key may do what the admin may. Make keys from the account that should own what the program does.
- A read-only key asked to write is refused with 403; a key MAJA does not know, 401; a refusal from the door (a locked period, a missing customer) comes back with the door's own words and 400.
- The address a webhook calls must be https://. A webhook switched off keeps its secret; a webhook removed takes its deliveries with it.
People also ask
- Does MAJA Books have an API?
- How do I connect my web shop or app to MAJA Books?
- Does MAJA Books support webhooks when an invoice is paid?
Still stuck? In the app, tap the ? button at the top and choose Chat with MAJA support — the screen you are on goes with your message and the reply comes to the same place (within one working day). Or write to support@majabooks.com, or ask MAJA's assistant (the round button at the bottom right of MAJA Books).