Build e-invoicing into your application with our RESTful API. Full DGI compliance, webhooks, and real-time clearance.
The Hisab API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes.
https://hisab.ma/api/v1Authenticate your API requests using Bearer tokens. Include your API key in the Authorization header of every request.
hisab_live_xxxxxxxxxxxxxnot yet developedHisab uses conventional HTTP response codes to indicate the success or failure of an API request.
400401403404429500Webhooks allow you to receive real-time notifications when events happen in your Hisab account. Register webhook endpoints to listen for specific events.
invoice.createdTriggered when a new invoice is created
invoice.finalizedTriggered when an invoice is finalized and cleared by DGI
invoice.sentTriggered when an invoice is sent to the customer
invoice.paidTriggered when an invoice payment is confirmed
invoice.payment_failedTriggered when a payment attempt fails
invoice.canceledTriggered when an invoice is canceled
customer.createdTriggered when a new customer is created
customer.updatedTriggered when customer information is updated
Use our official libraries to integrate Hisab into your application faster.
npm install hisab-sdkOfficial SDK with full TypeScript support, auto-pagination, and webhook verification.
composer require hisab/phppip install hisabgem install hisabCreate a new draft invoice
curl -X POST https://hisab.ma/api/v1/invoices \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"customer_id": "d8e6b416-e946-48f8-994d-309906db0fe4",
"issue_date": "2025-11-27",
"due_date": "2025-12-27",
"currency": "MAD",
"payment_terms": "Net 30",
"notes": "Thank you for your business",
"items": [
{
"description": "Web Development Services",
"quantity": 10,
"unit_price": 500.00,
"tax_rate": 20
},
{
"description": "Hosting - Annual Plan",
"quantity": 1,
"unit_price": 1200.00,
"tax_rate": 20
}
]
}'