حصة الخطة المجانية 3 فواتير/شهر: الإنشاء فوقها → 409 quota_exceeded. لا تُحصَّل مدفوعات عبر الـ API: العميل يدفع من رابط الفاتورة عبر StreamPay.
حمولة QR الزاتكاوية (TLV base64) في كل فاتورة وفي GET /invoices/{id}/zatca — المرحلة الأولى فقط (لا ربط مع منصة فاتورة).
نقاط الاتصال
الحساب / Account
GET/api/v1/me
الهوية والخطة والحدود / Identity, plan, quotas
يتحقق من المفتاح ويعيد المستخدم والمنشأة والخطة الحالية وحصص الشهر. Checks a key; returns user, business, current plan and monthly quota. · الصلاحية: read
curl -X GET "https://invoice.emm.sa/api/v1/me" \
-H "Authorization: Bearer $EMM_KEY"
GET/api/v1/plan
الخطة الحالية وكل الخطط / Current plan and catalogue
الخطة الحالية مع الاستهلاك وكل الخطط بأسعارها بالريال. Current plan with usage plus every plan (SAR/month, final, no VAT). · الصلاحية: read
curl -X GET "https://invoice.emm.sa/api/v1/plan" \
-H "Authorization: Bearer $EMM_KEY"
GET/api/v1/quota
حصة الشهر / Monthly quota
عدد الفواتير المنشأة هذا الشهر ميلادياً وحد الخطة (3 للمجاني، غير محدود لـ Pro). Invoices created this Gregorian month and the plan limit. · الصلاحية: read
curl -X GET "https://invoice.emm.sa/api/v1/quota" \
-H "Authorization: Bearer $EMM_KEY"
العملاء / Clients
GET/api/v1/clients
العملاء / Clients
قائمة العملاء مع بحث وترقيم صفحات. Lists clients with search and pagination. · المعاملات: qlimitoffset · الصلاحية: read
curl -X GET "https://invoice.emm.sa/api/v1/clients?q=&limit=50&offset=0" \
-H "Authorization: Bearer $EMM_KEY"
POST/api/v1/clients
إضافة عميل / Add client
عميل باسم (مطلوب) وبريد وهاتف ورقم ضريبي وعنوان. Client with name (required), email, phone, VAT number (15 digits 3…3 when given) and address. · الصلاحية: write
فواتير المنشأة مع فلتر status (draft|sent|paid|overdue) وclient_id وترقيم صفحات. Invoices with status/client filters and pagination. · المعاملات: statusclient_idlimitoffset · الصلاحية: read
curl -X GET "https://invoice.emm.sa/api/v1/invoices?status=all&client_id=&limit=50&offset=0" \
-H "Authorization: Bearer $EMM_KEY"
POST/api/v1/invoices
إنشاء فاتورة / Create invoice
تنشئ فاتورة زاتكا مبسطة (مسودة، أو مرسلة مع send=true) ضمن حصة الشهر (409 quota_exceeded). المبالغ نص بالريال. Creates a ZATCA simplified invoice (draft, or sent with send=true) within the monthly quota. · الصلاحية: write
curl -X POST "https://invoice.emm.sa/api/v1/invoices" \
-H "Authorization: Bearer $EMM_KEY" \
-H "Content-Type: application/json" \
-d '{"client_id":1,"due_date":"2026-12-16","notes":"الدفع خلال 14 يوماً","items":[{"description":"تصميم شعار","qty":"1","unit_price":"1000","discount":"100"},{"description":"طباعة","qty":"2","unit_price":"250.5","discount":"0"}]}'
GET/api/v1/invoices/{id}
فاتورة / Invoice
فاتورة كاملة: البنود، الإجماليات، UUID، رمز QR (TLV base64)، رابط المشاركة. One invoice with items, totals, UUID, ZATCA QR payload and share link. · المعاملات: id* · الصلاحية: read
curl -X GET "https://invoice.emm.sa/api/v1/invoices/{id}" \
-H "Authorization: Bearer $EMM_KEY"
PUT/api/v1/invoices/{id}
تعديل فاتورة / Update invoice
تعديل البنود والعميل وتاريخ الاستحقاق والضريبة والملاحظات — مسودة أو مرسلة فقط (409 locked للمدفوعة). Replaces lines and header fields of a non-paid invoice. · المعاملات: id* · الصلاحية: write
curl -X PUT "https://invoice.emm.sa/api/v1/invoices/{id}" \
-H "Authorization: Bearer $EMM_KEY" \
-H "Content-Type: application/json" \
-d '{"client_id":1,"due_date":"2026-12-16","notes":"الدفع خلال 14 يوماً","items":[{"description":"تصميم شعار","qty":"1","unit_price":"1000","discount":"100"},{"description":"طباعة","qty":"2","unit_price":"250.5","discount":"0"}]}'
POST/api/v1/invoices/{id}/status
تغيير الحالة / Transition
status: sent (اعتماد للإرسال) | paid (تعليم كمدفوعة، مع paid_at وpayment_ref اختيارياً) — يتخطى الحالة المدفوعة. sent / paid; paid invoices are final. · المعاملات: id* · الصلاحية: write
الحقائق الخمسة بترميز TLV: اسم البائع، الرقم الضريبي، الطابع الزمني +03:00، الإجمالي شامل الضريبة، مبلغ الضريبة + base64 وصورة PNG. The five TLV tags plus base64 and a PNG data URI. · المعاملات: id* · الصلاحية: read
curl -X GET "https://invoice.emm.sa/api/v1/invoices/{id}/zatca" \
-H "Authorization: Bearer $EMM_KEY"
GET/api/v1/invoices/{id}/share
رابط المشاركة / Public share link
الرابط العام للفاتورة، رابط الطباعة، ونص واتساب جاهز مع رابط wa.me. Public URL, print URL and a ready WhatsApp reminder with its wa.me link. · المعاملات: id* · الصلاحية: read
curl -X GET "https://invoice.emm.sa/api/v1/invoices/{id}/share" \
-H "Authorization: Bearer $EMM_KEY"
التذكيرات / Reminders
GET/api/v1/reminders
قائمة التذكيرات / Payment reminders
الفواتير غير المدفوعة (المتأخرة أولاً) مع نص تذكير ورابط واتساب لكل منها — ميزة Pro (403 plan_required). Unpaid invoices with a reminder text + wa.me link each — Pro feature. · المعاملات: limitoffset · الصلاحية: read
curl -X GET "https://invoice.emm.sa/api/v1/reminders?limit=50&offset=0" \
-H "Authorization: Bearer $EMM_KEY"
MCP
نفس المفتاح، POST إلى https://invoice.emm.sa/mcp (JSON-RPC 2.0، Streamable HTTP): initialize ← notifications/initialized ← tools/list ← tools/call. الأدوات: invoice_capabilitiesinvoice_pricinginvoice_clientsinvoice_listinvoice_getinvoice_createinvoice_mark_paid . مثال كامل في دليل الوكلاء.