Start now for free
14 days free trial - no credit card needed
Hisab
Pricing
Sales: +212 649 22 43 64
Start now for free

14 days free trial - no credit card needed

Login
API Reference v1.0

Hisab API Documentation

Build e-invoicing into your application with our RESTful API. Full DGI compliance, webhooks, and real-time clearance.

API Reference
Authentication
Invoices
Recurring Invoices
Customers
Webhooks

Getting Started

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.

Base URL
https://hisab.ma/api/v1

Make your first request

  1. Get your API key from the dashboard
  2. Include it in the Authorization header
  3. Make your first API call
Rate Limits
API requests are limited to 100 requests per minute per API key. Upgrade to higher plans for increased limits.

Authentication

Authenticate your API requests using Bearer tokens. Include your API key in the Authorization header of every request.

Keep your API keys secure
Never expose your secret API keys in client-side code, public repositories, or browser JavaScript. Store them securely on your server.

API Key Types

Secret Key
Full access to all API endpoints. Use on your server only.
hisab_live_xxxxxxxxxxxxx
Publishable Key
Read-only access. Safe to use in client-side code.
not yet developed

Error Codes

Hisab uses conventional HTTP response codes to indicate the success or failure of an API request.

400
Bad Request
The request was invalid or cannot be served. Check the error message for details.
401
Unauthorized
The API key is missing or invalid.
403
Forbidden
The API key doesn't have permissions to perform this request.
404
Not Found
The requested resource doesn't exist.
429
Too Many Requests
You've exceeded the rate limit. Please slow down.
500
Internal Server Error
Something went wrong on our end. Please try again later.

Webhooks

Webhooks allow you to receive real-time notifications when events happen in your Hisab account. Register webhook endpoints to listen for specific events.

Available Events

invoice.created

Triggered when a new invoice is created

invoice.finalized

Triggered when an invoice is finalized and cleared by DGI

invoice.sent

Triggered when an invoice is sent to the customer

invoice.paid

Triggered when an invoice payment is confirmed

invoice.payment_failed

Triggered when a payment attempt fails

invoice.canceled

Triggered when an invoice is canceled

customer.created

Triggered when a new customer is created

customer.updated

Triggered when customer information is updated

Official SDKs

Use our official libraries to integrate Hisab into your application faster.

Node.js / TypeScript SDK
npm install hisab-sdk

Official SDK with full TypeScript support, auto-pagination, and webhook verification.

View docs
PHP
Coming soon
composer require hisab/php
Python
Coming soon
pip install hisab
Ruby
Coming soon
gem install hisab
POST

Create Invoice

Create 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
      }
    ]
  }'

Need Help?

Contact our developer support team for assistance with API integration.

contact@hisab.ma →
    API Documentation - Hisab Developer Platform | Hisab - E-Invoicing Morocco