Getting Started with the API
2 min readLast updated: Jun 3, 20262 views
Getting Started with the API
The Hisab REST API lets you automate invoicing — create customers and invoices, finalize them, export PDFs/XML, and more — straight from your own systems.
Plan requirement: API access is available on the Professional and Fiduciaire plans.
1. Create an API key
- Go to Settings → API Keys.
- Click Create API key.
- Give it a clear name (e.g. "Billing automation").
- Select the scopes it needs (least privilege — only what you'll use).
- Click create, then copy the key now — for security it's shown only once. Store it somewhere safe like a secrets manager.
2. Authenticate
Send your key as a Bearer token. The base URL is:
https://hisab.ma/api/v1
Example — list your invoices:
curl https://hisab.ma/api/v1/invoices \ -H "Authorization: Bearer hisab_your_api_key_here"
3. Scopes
Keys are scoped so you only grant what you need:
| Group | Scopes |
|---|---|
| Invoices | read, write, finalize, send, payment, void, export |
| Recurring invoices | read, write, delete |
| Customers | read, write, delete |
| Organization | read, write |
| Webhooks | read, write |
4. Create an invoice
curl -X POST https://hisab.ma/api/v1/invoices \ -H "Authorization: Bearer hisab_your_api_key_here" \ -H "Content-Type: application/json" \ -d '{ "customer_id": "cus_...", "issue_date": "2026-06-03", "items": [ { "description": "Consulting", "quantity": 10, "unit_price": 500, "tax_rate": 20 } ] }'
5. Use the official SDK (Node.js / TypeScript)
npm install hisab-sdk
import { HisabClient } from 'hisab-sdk'; const hisab = new HisabClient({ apiKey: process.env.HISAB_API_KEY }); const invoices = await hisab.invoices.list({ status: 'paid' });
6. Webhooks
To react to events (e.g. an invoice was paid), set up endpoints under Settings → Webhooks. Hisab signs each delivery so you can verify it's genuine.
Notes
- Requests are rate limited; if you hit the limit you'll get a
429— back off and retry. - Keep keys secret. If one leaks, revoke it from Settings → API Keys and create a new one.
Was this article helpful?