{"openapi":"3.1.0","info":{"title":"BasicXII Finance API","version":"1.0.0","description":"Connect your online store, POS or website to BasicXII Finance: create customers, suppliers, products, invoices, refunds and payments, and receive webhooks when things happen. Every request is authenticated with an API token that belongs to one company.","x-description-ar":"اربط متجرك الإلكتروني أو نقطة البيع أو موقعك مع بيسك 12 للمالية: أنشئ العملاء والموردين والمنتجات والفواتير والمرتجعات والدفعات، واستقبل إشعارات Webhook عند وقوع الأحداث. كل طلب يُوثَّق بمفتاح API يخص شركة واحدة.","contact":{"name":"BasicXII","email":"info@basicxii.com","url":"https://basicxii.com"}},"servers":[{"url":"https://finance.basicxii.com/api/v1"}],"security":[{"bearerAuth":[]}],"x-scopes":["invoices.read","invoices.write","bills.read","bills.write","contacts.read","contacts.write","payments.read","payments.write","products.read","products.write","inventory.read","reports.read"],"x-webhook-events":["invoice.created","invoice.updated","invoice.deleted","invoice.posted","invoice.payment_status_changed","invoice.paid","invoice.voided","credit_note.posted","payment.received","customer.created","quotation.accepted"],"tags":[{"name":"Reference data","x-name-ar":"البيانات المرجعية","description":"IDs to look up once and cache: tax rates, payment accounts, warehouses, currencies.","x-description-ar":"المعرّفات التي تُجلب مرة وتُحفظ: نسب الضريبة وحسابات الدفع والمستودعات والعملات."},{"name":"Customers and suppliers","x-name-ar":"العملاء والموردون","description":"One contact can be a customer, a supplier, or both.","x-description-ar":"جهة الاتصال الواحدة قد تكون عميلاً أو مورداً أو كليهما."},{"name":"Products","x-name-ar":"المنتجات","description":"Keep your catalogue in step with your store. Look up by SKU before creating.","x-description-ar":"زامن كتالوجك مع متجرك. ابحث بالرمز SKU قبل الإنشاء."},{"name":"Invoices","x-name-ar":"فواتير المبيعات","description":"Create an invoice as a draft, then approve it to post it to the books.","x-description-ar":"أنشئ الفاتورة كمسودة ثم اعتمدها لترحيلها إلى الدفاتر."},{"name":"Refunds","x-name-ar":"المرتجعات","description":"Credit notes reverse all or part of an invoice.","x-description-ar":"الإشعارات الدائنة تعكس الفاتورة كلياً أو جزئياً."},{"name":"Customer payments","x-name-ar":"مقبوضات العملاء","description":"Receipt vouchers record money received and settle invoices.","x-description-ar":"سندات القبض تسجّل المبالغ المستلمة وتسدد الفواتير."},{"name":"Bills","x-name-ar":"فواتير المشتريات","description":"What you owe suppliers.","x-description-ar":"المبالغ المستحقة للموردين."},{"name":"Supplier payments","x-name-ar":"مدفوعات الموردين","description":"Payment vouchers record money paid and settle bills.","x-description-ar":"سندات الصرف تسجّل المبالغ المدفوعة وتسدد فواتير المشتريات."},{"name":"Stock","x-name-ar":"المخزون","description":"Quantities on hand per product and warehouse.","x-description-ar":"الكميات المتوفرة لكل منتج ومستودع."}],"paths":{"/reference-data":{"get":{"tags":["Reference data"],"operationId":"getReferenceData","summary":"Get reference data","x-summary-ar":"جلب البيانات المرجعية","description":"Tax rate, payment account and warehouse IDs for this company. Any token can call it.","x-description-ar":"معرّفات نسب الضريبة وحسابات الدفع والمستودعات لهذه الشركة. متاح لأي مفتاح.","x-scopes":[],"parameters":[],"responses":{"200":{"description":"OK","x-description-ar":"تم","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReferenceData"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/contacts":{"get":{"tags":["Customers and suppliers"],"operationId":"listContacts","summary":"List or find contacts","x-summary-ar":"عرض جهات الاتصال أو البحث عنها","description":"Filter by `email` or `code` (exact) to find a customer you created before, instead of creating a duplicate.","x-description-ar":"استخدم `email` أو `code` (تطابق تام) للعثور على عميل أنشأته سابقاً بدلاً من تكراره.","x-scopes":["contacts.read"],"parameters":[{"name":"type","in":"query","required":false,"schema":{"type":"string","enum":["customer","supplier","both"]},"description":"customer, supplier or both. Asking for customers also returns contacts that are both.","x-description-ar":"customer أو supplier أو both. طلب العملاء يُرجع أيضاً من هم عملاء وموردون معاً."},{"name":"email","in":"query","required":false,"schema":{"type":"string"},"description":"Exact email.","x-description-ar":"البريد الإلكتروني بتطابق تام."},{"name":"code","in":"query","required":false,"schema":{"type":"string"},"description":"Exact code, e.g. your store customer ID.","x-description-ar":"الرمز بتطابق تام، مثل رقم العميل في متجرك."},{"name":"search","in":"query","required":false,"schema":{"type":"string"},"description":"Partial match on name, code, email or phone.","x-description-ar":"بحث جزئي في الاسم أو الرمز أو البريد أو الهاتف."},{"$ref":"#/components/parameters/Page"}],"responses":{"200":{"description":"OK","x-description-ar":"تم","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactList"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"post":{"tags":["Customers and suppliers"],"operationId":"createContact","summary":"Create a customer or supplier","x-summary-ar":"إنشاء عميل أو مورد","description":"Use `type: both` for someone who buys from you and sells to you, so they appear in both receipt and payment vouchers.","x-description-ar":"استخدم `type: both` لمن يشتري منك ويبيعك، ليظهر في سندات القبض والصرف معاً.","x-scopes":["contacts.write"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"Created","x-description-ar":"تم الإنشاء","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"},"422":{"$ref":"#/components/responses/ValidationFailed"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactInput"},"example":{"code":"WEB-10231","type":"customer","name":"Sara Ahmad","email":"sara@example.com","phone":"+962790000000","billing_address":{"line1":"Mecca St. 12","city":"Amman","country":"JO"}}}}}}},"/contacts/{id}":{"get":{"tags":["Customers and suppliers"],"operationId":"getContact","summary":"Get a contact","x-summary-ar":"جلب جهة اتصال","description":"Full contact details.","x-description-ar":"بيانات جهة الاتصال كاملة.","x-scopes":["contacts.read"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Contact ID.","x-description-ar":"معرّف جهة الاتصال."}],"responses":{"200":{"description":"OK","x-description-ar":"تم","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"patch":{"tags":["Customers and suppliers"],"operationId":"updateContact","summary":"Update a contact","x-summary-ar":"تعديل جهة اتصال","description":"Send only the fields to change.","x-description-ar":"أرسل الحقول المراد تعديلها فقط.","x-scopes":["contacts.write"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Contact ID.","x-description-ar":"معرّف جهة الاتصال."}],"responses":{"200":{"description":"OK","x-description-ar":"تم","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"},"422":{"$ref":"#/components/responses/ValidationFailed"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactInput"},"example":{"phone":"+962791111111"}}}}}},"/products":{"get":{"tags":["Products"],"operationId":"listProducts","summary":"List or find products","x-summary-ar":"عرض المنتجات أو البحث عنها","description":"Filter by `sku` (exact) to match your store catalogue.","x-description-ar":"استخدم `sku` (تطابق تام) لمطابقة كتالوج متجرك.","x-scopes":["products.read"],"parameters":[{"name":"sku","in":"query","required":false,"schema":{"type":"string"},"description":"Exact SKU.","x-description-ar":"الرمز SKU بتطابق تام."},{"name":"search","in":"query","required":false,"schema":{"type":"string"},"description":"Partial match on name, SKU or barcode.","x-description-ar":"بحث جزئي في الاسم أو SKU أو الباركود."},{"$ref":"#/components/parameters/Page"}],"responses":{"200":{"description":"OK","x-description-ar":"تم","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductList"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"post":{"tags":["Products"],"operationId":"createProduct","summary":"Create a product","x-summary-ar":"إنشاء منتج","description":"`type` is `physical` (stock is tracked when `track_inventory` is true), `non_inventory` or `service`.","x-description-ar":"`type` هو `physical` (يُتتبع المخزون عند `track_inventory: true`) أو `non_inventory` أو `service`.","x-scopes":["products.write"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"Created","x-description-ar":"تم الإنشاء","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"},"422":{"$ref":"#/components/responses/ValidationFailed"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductInput"},"example":{"sku":"TSHIRT-BLK-M","name":"Black T-shirt (M)","name_ar":"قميص أسود (M)","type":"physical","selling_price":"15.000","purchase_price":"7.500","track_inventory":true}}}}}},"/products/{id}":{"get":{"tags":["Products"],"operationId":"getProduct","summary":"Get a product","x-summary-ar":"جلب منتج","description":"Product with its prices and tax rate.","x-description-ar":"المنتج مع أسعاره ونسبة ضريبته.","x-scopes":["products.read"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Product ID.","x-description-ar":"معرّف المنتج."}],"responses":{"200":{"description":"OK","x-description-ar":"تم","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"patch":{"tags":["Products"],"operationId":"updateProduct","summary":"Update a product","x-summary-ar":"تعديل منتج","description":"Send only the fields to change, e.g. a new price.","x-description-ar":"أرسل الحقول المراد تعديلها فقط، مثل سعر جديد.","x-scopes":["products.write"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Product ID.","x-description-ar":"معرّف المنتج."}],"responses":{"200":{"description":"OK","x-description-ar":"تم","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"},"422":{"$ref":"#/components/responses/ValidationFailed"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductInput"},"example":{"selling_price":"13.500"}}}}}},"/invoices":{"get":{"tags":["Invoices"],"operationId":"listInvoices","summary":"List or find invoices","x-summary-ar":"عرض الفواتير أو البحث عنها","description":"Filter by `reference` (exact) to find the invoice for an order.","x-description-ar":"استخدم `reference` (تطابق تام) للعثور على فاتورة طلب معيّن.","x-scopes":["invoices.read"],"parameters":[{"name":"reference","in":"query","required":false,"schema":{"type":"string"},"description":"Exact reference, e.g. your order number.","x-description-ar":"المرجع بتطابق تام، مثل رقم الطلب."},{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"draft, approved, partially_paid, paid, void.","x-description-ar":"draft أو approved أو partially_paid أو paid أو void."},{"name":"contact_id","in":"query","required":false,"schema":{"type":"string"},"description":"Only this customer.","x-description-ar":"لهذا العميل فقط."},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Invoice date from (YYYY-MM-DD).","x-description-ar":"تاريخ الفاتورة من (YYYY-MM-DD)."},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Invoice date to (YYYY-MM-DD).","x-description-ar":"تاريخ الفاتورة إلى (YYYY-MM-DD)."},{"$ref":"#/components/parameters/Page"}],"responses":{"200":{"description":"OK","x-description-ar":"تم","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceList"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"post":{"tags":["Invoices"],"operationId":"createInvoice","summary":"Create an invoice (draft)","x-summary-ar":"إنشاء فاتورة (مسودة)","description":"Creates a draft. Put your order number in `reference`. Totals and tax are calculated for you. Approve it to post it.","x-description-ar":"تُنشأ كمسودة. ضع رقم الطلب في `reference`. تُحسب الإجماليات والضريبة تلقائياً. اعتمدها لترحيلها.","x-scopes":["invoices.write"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"Created","x-description-ar":"تم الإنشاء","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"},"422":{"$ref":"#/components/responses/ValidationFailed"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceInput"},"example":{"contact_id":"01J9Z3CUSTOMERULID00000000","invoice_date":"2026-09-21","due_date":"2026-09-21","reference":"ORDER-10458","shipping_amount":"3.000","lines":[{"product_id":"01J9Z3PRODUCTULID000000000","quantity":"2","unit_price":"15.000","tax_rate_id":"01J9Z3TAXRATEULID000000000"},{"description":"Gift wrapping","quantity":"1","unit_price":"1.000"}]}}}}}},"/invoices/{id}":{"get":{"tags":["Invoices"],"operationId":"getInvoice","summary":"Get an invoice","x-summary-ar":"جلب فاتورة","description":"With its lines, totals, amount paid and amount due.","x-description-ar":"مع البنود والإجماليات والمدفوع والمستحق.","x-scopes":["invoices.read"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Invoice ID.","x-description-ar":"معرّف الفاتورة."}],"responses":{"200":{"description":"OK","x-description-ar":"تم","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"put":{"tags":["Invoices"],"operationId":"updateInvoice","summary":"Replace a draft invoice","x-summary-ar":"تعديل فاتورة مسودة","description":"Only while `status` is `draft`: send the whole invoice again (same body as create); the lines you send replace the old ones. Use it when the customer changes the order before it is paid. A posted invoice cannot be edited (403) — void it or issue a credit note.","x-description-ar":"متاح فقط والفاتورة `draft`: أرسل الفاتورة كاملة من جديد (نفس محتوى الإنشاء)، والبنود المرسلة تحل محل القديمة. استخدمه عندما يعدّل العميل الطلب قبل الدفع. الفاتورة المرحّلة لا تُعدّل (403) — ألغِها أو أصدر إشعاراً دائناً.","x-scopes":["invoices.write"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Invoice ID.","x-description-ar":"معرّف الفاتورة."}],"responses":{"200":{"description":"OK","x-description-ar":"تم","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"},"422":{"$ref":"#/components/responses/ValidationFailed"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceInput"},"example":{"contact_id":"01J9Z3CUSTOMERULID00000000","invoice_date":"2026-09-21","reference":"ORDER-10458","lines":[{"product_id":"01J9Z3PRODUCTULID000000000","quantity":"3","unit_price":"15.000","tax_rate_id":"01J9Z3TAXRATEULID000000000"}]}}}}},"delete":{"tags":["Invoices"],"operationId":"deleteInvoice","summary":"Delete a draft invoice","x-summary-ar":"حذف فاتورة مسودة","description":"Only while `status` is `draft` — nothing has been posted yet, so it leaves no trace in the books. Use it when an unpaid order is cancelled before you approved it.","x-description-ar":"متاح فقط والفاتورة `draft` — لم يُرحّل شيء بعد، فلا يبقى لها أثر في الدفاتر. استخدمه عند إلغاء طلب غير مدفوع قبل اعتماده.","x-scopes":["invoices.write"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Invoice ID.","x-description-ar":"معرّف الفاتورة."}],"responses":{"200":{"description":"OK","x-description-ar":"تم","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/invoices/{id}/void":{"post":{"tags":["Invoices"],"operationId":"voidInvoice","summary":"Void (cancel) a posted invoice","x-summary-ar":"إلغاء فاتورة مرحّلة","description":"For an approved invoice with **no payments**: reverses its journal entry and stock, and sets `status` to `void`. The invoice number is kept for the audit trail. If any payment was applied you get 422 — issue a credit note (refund) instead.","x-description-ar":"لفاتورة معتمدة **دون أي دفعات**: يعكس قيدها وحركة المخزون ويجعل `status` = `void`، ويبقى رقمها محفوظاً لسجل التدقيق. إذا طُبّقت عليها دفعة يُرجع 422 — أصدر إشعاراً دائناً (مرتجع) بدلاً من ذلك.","x-scopes":["invoices.write"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Invoice ID.","x-description-ar":"معرّف الفاتورة."}],"responses":{"200":{"description":"OK","x-description-ar":"تم","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"},"422":{"$ref":"#/components/responses/ValidationFailed"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoidInput"},"example":{"reason":"Order ORDER-10458 cancelled by customer"}}}}}},"/invoices/{id}/approve":{"post":{"tags":["Invoices"],"operationId":"approveInvoice","summary":"Approve and post an invoice","x-summary-ar":"اعتماد الفاتورة وترحيلها","description":"Posts the invoice to the books and gives it its final number. Returns 202 with `approval` if the company requires more approvals first.","x-description-ar":"يرحّل الفاتورة إلى الدفاتر ويمنحها رقمها النهائي. يُرجع 202 مع `approval` إذا كانت الشركة تشترط موافقات إضافية.","x-scopes":["invoices.write"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Invoice ID.","x-description-ar":"معرّف الفاتورة."}],"responses":{"200":{"description":"OK","x-description-ar":"تم","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/credit-notes":{"post":{"tags":["Refunds"],"operationId":"createCreditNote","summary":"Create a refund (credit note)","x-summary-ar":"إنشاء مرتجع (إشعار دائن)","description":"Link it to the invoice with `invoice_id`. Set `restock: true` to return items to stock. Created as a draft; post it next.","x-description-ar":"اربطه بالفاتورة عبر `invoice_id`، واستخدم `restock: true` لإعادة البضاعة إلى المخزون. يُنشأ كمسودة ثم يُرحّل.","x-scopes":["invoices.write"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"Created","x-description-ar":"تم الإنشاء","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"},"422":{"$ref":"#/components/responses/ValidationFailed"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditNoteInput"},"example":{"contact_id":"01J9Z3CUSTOMERULID00000000","invoice_id":"01J9Z3INVOICEULID000000000","date":"2026-09-25","reason":"Returned: wrong size","restock":true,"lines":[{"product_id":"01J9Z3PRODUCTULID000000000","quantity":"1","unit_price":"15.000","tax_rate_id":"01J9Z3TAXRATEULID000000000"}]}}}}}},"/credit-notes/{id}/post":{"post":{"tags":["Refunds"],"operationId":"postCreditNote","summary":"Post a refund","x-summary-ar":"ترحيل المرتجع","description":"Posts the credit note and reduces what the customer owes.","x-description-ar":"يرحّل الإشعار الدائن ويخفض المستحق على العميل.","x-scopes":["invoices.write"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Credit note ID.","x-description-ar":"معرّف الإشعار الدائن."}],"responses":{"200":{"description":"OK","x-description-ar":"تم","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/receipt-vouchers":{"get":{"tags":["Customer payments"],"operationId":"listReceipts","summary":"List customer payments","x-summary-ar":"عرض مقبوضات العملاء","description":"Newest first.","x-description-ar":"الأحدث أولاً.","x-scopes":["payments.read"],"parameters":[{"$ref":"#/components/parameters/Page"}],"responses":{"200":{"description":"OK","x-description-ar":"تم","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"post":{"tags":["Customer payments"],"operationId":"createReceipt","summary":"Record a customer payment","x-summary-ar":"تسجيل دفعة من عميل","description":"Posts a receipt voucher and settles the invoices in `allocations`. `deposit_account_id` comes from reference data (payment_accounts).","x-description-ar":"يرحّل سند قبض ويسدد الفواتير في `allocations`. يُؤخذ `deposit_account_id` من البيانات المرجعية (payment_accounts).","x-scopes":["payments.write"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"Created","x-description-ar":"تم الإنشاء","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"},"422":{"$ref":"#/components/responses/ValidationFailed"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptInput"},"example":{"contact_id":"01J9Z3CUSTOMERULID00000000","date":"2026-09-21","payment_method":"online","deposit_account_id":"01J9Z3BANKACCOUNTULID00000","amount":"37.800","reference":"PAYPAL-7G2K9","allocations":[{"invoice_id":"01J9Z3INVOICEULID000000000","amount":"37.800"}]}}}}}},"/bills":{"get":{"tags":["Bills"],"operationId":"listBills","summary":"List bills","x-summary-ar":"عرض فواتير المشتريات","description":"Newest first.","x-description-ar":"الأحدث أولاً.","x-scopes":["bills.read"],"parameters":[{"$ref":"#/components/parameters/Page"}],"responses":{"200":{"description":"OK","x-description-ar":"تم","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"post":{"tags":["Bills"],"operationId":"createBill","summary":"Create a bill (draft)","x-summary-ar":"إنشاء فاتورة مشتريات (مسودة)","description":"Put the supplier’s own invoice number in `supplier_invoice_number`. Approve it to post it.","x-description-ar":"ضع رقم فاتورة المورد في `supplier_invoice_number`، ثم اعتمدها لترحيلها.","x-scopes":["bills.write"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"Created","x-description-ar":"تم الإنشاء","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"},"422":{"$ref":"#/components/responses/ValidationFailed"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillInput"},"example":{"contact_id":"01J9Z3SUPPLIERULID00000000","bill_date":"2026-09-20","due_date":"2026-10-20","supplier_invoice_number":"SUP-5521","lines":[{"product_id":"01J9Z3PRODUCTULID000000000","quantity":"50","unit_price":"7.500","tax_rate_id":"01J9Z3TAXRATEULID000000000"}]}}}}}},"/bills/{id}/approve":{"post":{"tags":["Bills"],"operationId":"approveBill","summary":"Approve and post a bill","x-summary-ar":"اعتماد فاتورة المشتريات وترحيلها","description":"Posts the bill; stocked items are added to inventory at cost.","x-description-ar":"يرحّل الفاتورة، وتُضاف الأصناف المخزنية إلى المخزون بالتكلفة.","x-scopes":["bills.write"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Bill ID.","x-description-ar":"معرّف فاتورة المشتريات."}],"responses":{"200":{"description":"OK","x-description-ar":"تم","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/payment-vouchers":{"post":{"tags":["Supplier payments"],"operationId":"createPayment","summary":"Record a supplier payment","x-summary-ar":"تسجيل دفعة لمورد","description":"Posts a payment voucher and settles the bills in `allocations`.","x-description-ar":"يرحّل سند صرف ويسدد فواتير المشتريات في `allocations`.","x-scopes":["payments.write"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"Created","x-description-ar":"تم الإنشاء","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"},"422":{"$ref":"#/components/responses/ValidationFailed"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentInput"},"example":{"contact_id":"01J9Z3SUPPLIERULID00000000","date":"2026-09-22","payment_method":"bank_transfer","payment_account_id":"01J9Z3BANKACCOUNTULID00000","amount":"435.000","allocations":[{"bill_id":"01J9Z3BILLULID000000000000","amount":"435.000"}]}}}}}},"/inventory/stock":{"get":{"tags":["Stock"],"operationId":"listStock","summary":"Stock on hand","x-summary-ar":"المخزون المتوفر","description":"Quantity and value per product and warehouse. Requires a plan with inventory.","x-description-ar":"الكمية والقيمة لكل منتج ومستودع. يتطلب خطة تشمل المخزون.","x-scopes":["inventory.read"],"parameters":[{"$ref":"#/components/parameters/Page"}],"responses":{"200":{"description":"OK","x-description-ar":"تم","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}}},"webhooks":{"invoice.created":{"post":{"operationId":"webhook_invoice_created","summary":"invoice.created","description":"An invoice was created (as a draft).","x-description-ar":"أُنشئت فاتورة (كمسودة).","parameters":[{"name":"X-BasicXII-Event","in":"header","required":true,"schema":{"type":"string","const":"invoice.created"},"description":"The event name.","x-description-ar":"اسم الحدث."},{"name":"X-BasicXII-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"Delivery ID; the same on every retry.","x-description-ar":"معرّف الإرسال، ثابت في كل إعادة محاولة."},{"name":"X-BasicXII-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"`t=<unix time>,v1=<HMAC-SHA256 of \"t.body\">`.","x-description-ar":"`t=<الوقت>,v1=<توقيع HMAC-SHA256 للنص \"t.body\">`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id","type","created_at","data"],"properties":{"id":{"type":"string","description":"Event ID (evt_…). Store it and ignore an event you already processed.","x-description-ar":"معرّف الحدث (evt_…). احفظه وتجاهل أي حدث عالجته من قبل."},"type":{"type":"string","const":"invoice.created"},"created_at":{"type":"string","format":"date-time","description":"When it happened (ISO 8601). Events can arrive out of order; compare this or re-read the record.","x-description-ar":"وقت الحدث (ISO 8601). قد تصل الأحداث بغير ترتيبها، فقارن هذا الحقل أو أعد قراءة السجل."},"data":{"$ref":"#/components/schemas/WebhookInvoice"}}},"example":{"id":"evt_01J9Z3EVENTULID0000000000","type":"invoice.created","created_at":"2026-09-21T10:15:00+00:00","data":{"id":"01J9Z3INVOICEULID000000000","number":"INV-2026-000154","reference":"ORDER-10458","status":"draft","payment_status":null,"contact":{"id":"01J9Z3CUSTOMERULID00000000","code":"WEB-10231","name":"Sara Ahmad","email":"sara@example.com"},"currency":"JOD","invoice_date":"2026-09-21","due_date":"2026-09-21","total":"37.800","amount_paid":"0.000","amount_due":"37.800"}}}}},"responses":{"2XX":{"description":"Return any 2xx within 10 seconds. Anything else is retried after 1m, 5m, 30m, 2h and 6h.","x-description-ar":"أرجع أي رمز 2xx خلال 10 ثوانٍ، وإلا تُعاد المحاولة بعد 1د و5د و30د وساعتين و6 ساعات."}}}},"invoice.updated":{"post":{"operationId":"webhook_invoice_updated","summary":"invoice.updated","description":"A draft invoice was changed.","x-description-ar":"عُدّلت فاتورة مسودة.","parameters":[{"name":"X-BasicXII-Event","in":"header","required":true,"schema":{"type":"string","const":"invoice.updated"},"description":"The event name.","x-description-ar":"اسم الحدث."},{"name":"X-BasicXII-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"Delivery ID; the same on every retry.","x-description-ar":"معرّف الإرسال، ثابت في كل إعادة محاولة."},{"name":"X-BasicXII-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"`t=<unix time>,v1=<HMAC-SHA256 of \"t.body\">`.","x-description-ar":"`t=<الوقت>,v1=<توقيع HMAC-SHA256 للنص \"t.body\">`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id","type","created_at","data"],"properties":{"id":{"type":"string","description":"Event ID (evt_…). Store it and ignore an event you already processed.","x-description-ar":"معرّف الحدث (evt_…). احفظه وتجاهل أي حدث عالجته من قبل."},"type":{"type":"string","const":"invoice.updated"},"created_at":{"type":"string","format":"date-time","description":"When it happened (ISO 8601). Events can arrive out of order; compare this or re-read the record.","x-description-ar":"وقت الحدث (ISO 8601). قد تصل الأحداث بغير ترتيبها، فقارن هذا الحقل أو أعد قراءة السجل."},"data":{"$ref":"#/components/schemas/WebhookInvoice"}}},"example":{"id":"evt_01J9Z3EVENTULID0000000000","type":"invoice.updated","created_at":"2026-09-21T10:15:00+00:00","data":{"id":"01J9Z3INVOICEULID000000000","number":"INV-2026-000154","reference":"ORDER-10458","status":"draft","payment_status":null,"contact":{"id":"01J9Z3CUSTOMERULID00000000","code":"WEB-10231","name":"Sara Ahmad","email":"sara@example.com"},"currency":"JOD","invoice_date":"2026-09-21","due_date":"2026-09-21","total":"37.800","amount_paid":"0.000","amount_due":"37.800"}}}}},"responses":{"2XX":{"description":"Return any 2xx within 10 seconds. Anything else is retried after 1m, 5m, 30m, 2h and 6h.","x-description-ar":"أرجع أي رمز 2xx خلال 10 ثوانٍ، وإلا تُعاد المحاولة بعد 1د و5د و30د وساعتين و6 ساعات."}}}},"invoice.deleted":{"post":{"operationId":"webhook_invoice_deleted","summary":"invoice.deleted","description":"A draft invoice was deleted. `data` is the invoice as it was.","x-description-ar":"حُذفت فاتورة مسودة. `data` هي الفاتورة كما كانت قبل الحذف.","parameters":[{"name":"X-BasicXII-Event","in":"header","required":true,"schema":{"type":"string","const":"invoice.deleted"},"description":"The event name.","x-description-ar":"اسم الحدث."},{"name":"X-BasicXII-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"Delivery ID; the same on every retry.","x-description-ar":"معرّف الإرسال، ثابت في كل إعادة محاولة."},{"name":"X-BasicXII-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"`t=<unix time>,v1=<HMAC-SHA256 of \"t.body\">`.","x-description-ar":"`t=<الوقت>,v1=<توقيع HMAC-SHA256 للنص \"t.body\">`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id","type","created_at","data"],"properties":{"id":{"type":"string","description":"Event ID (evt_…). Store it and ignore an event you already processed.","x-description-ar":"معرّف الحدث (evt_…). احفظه وتجاهل أي حدث عالجته من قبل."},"type":{"type":"string","const":"invoice.deleted"},"created_at":{"type":"string","format":"date-time","description":"When it happened (ISO 8601). Events can arrive out of order; compare this or re-read the record.","x-description-ar":"وقت الحدث (ISO 8601). قد تصل الأحداث بغير ترتيبها، فقارن هذا الحقل أو أعد قراءة السجل."},"data":{"$ref":"#/components/schemas/WebhookInvoice"}}},"example":{"id":"evt_01J9Z3EVENTULID0000000000","type":"invoice.deleted","created_at":"2026-09-21T10:15:00+00:00","data":{"id":"01J9Z3INVOICEULID000000000","number":"INV-2026-000154","reference":"ORDER-10458","status":"draft","payment_status":null,"contact":{"id":"01J9Z3CUSTOMERULID00000000","code":"WEB-10231","name":"Sara Ahmad","email":"sara@example.com"},"currency":"JOD","invoice_date":"2026-09-21","due_date":"2026-09-21","total":"37.800","amount_paid":"0.000","amount_due":"37.800"}}}}},"responses":{"2XX":{"description":"Return any 2xx within 10 seconds. Anything else is retried after 1m, 5m, 30m, 2h and 6h.","x-description-ar":"أرجع أي رمز 2xx خلال 10 ثوانٍ، وإلا تُعاد المحاولة بعد 1د و5د و30د وساعتين و6 ساعات."}}}},"invoice.posted":{"post":{"operationId":"webhook_invoice_posted","summary":"invoice.posted","description":"An invoice was approved and posted to the books.","x-description-ar":"اعتُمدت فاتورة ورُحّلت إلى الدفاتر.","parameters":[{"name":"X-BasicXII-Event","in":"header","required":true,"schema":{"type":"string","const":"invoice.posted"},"description":"The event name.","x-description-ar":"اسم الحدث."},{"name":"X-BasicXII-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"Delivery ID; the same on every retry.","x-description-ar":"معرّف الإرسال، ثابت في كل إعادة محاولة."},{"name":"X-BasicXII-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"`t=<unix time>,v1=<HMAC-SHA256 of \"t.body\">`.","x-description-ar":"`t=<الوقت>,v1=<توقيع HMAC-SHA256 للنص \"t.body\">`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id","type","created_at","data"],"properties":{"id":{"type":"string","description":"Event ID (evt_…). Store it and ignore an event you already processed.","x-description-ar":"معرّف الحدث (evt_…). احفظه وتجاهل أي حدث عالجته من قبل."},"type":{"type":"string","const":"invoice.posted"},"created_at":{"type":"string","format":"date-time","description":"When it happened (ISO 8601). Events can arrive out of order; compare this or re-read the record.","x-description-ar":"وقت الحدث (ISO 8601). قد تصل الأحداث بغير ترتيبها، فقارن هذا الحقل أو أعد قراءة السجل."},"data":{"$ref":"#/components/schemas/WebhookInvoice"}}},"example":{"id":"evt_01J9Z3EVENTULID0000000000","type":"invoice.posted","created_at":"2026-09-21T10:15:00+00:00","data":{"id":"01J9Z3INVOICEULID000000000","number":"INV-2026-000154","reference":"ORDER-10458","status":"approved","payment_status":"unpaid","contact":{"id":"01J9Z3CUSTOMERULID00000000","code":"WEB-10231","name":"Sara Ahmad","email":"sara@example.com"},"currency":"JOD","invoice_date":"2026-09-21","due_date":"2026-09-21","total":"37.800","amount_paid":"0.000","amount_due":"37.800"}}}}},"responses":{"2XX":{"description":"Return any 2xx within 10 seconds. Anything else is retried after 1m, 5m, 30m, 2h and 6h.","x-description-ar":"أرجع أي رمز 2xx خلال 10 ثوانٍ، وإلا تُعاد المحاولة بعد 1د و5د و30د وساعتين و6 ساعات."}}}},"invoice.payment_status_changed":{"post":{"operationId":"webhook_invoice_payment_status_changed","summary":"invoice.payment_status_changed","description":"The payment status of an invoice changed: unpaid → partially_paid → paid. Sent once per change, with the payment that caused it. This is the event to update the order's payment state in your store.","x-description-ar":"تغيّرت حالة دفع فاتورة: unpaid ← partially_paid ← paid. يُرسل مرة لكل تغيير مع الدفعة التي سببته. هذا هو الحدث المناسب لتحديث حالة دفع الطلب في متجرك.","parameters":[{"name":"X-BasicXII-Event","in":"header","required":true,"schema":{"type":"string","const":"invoice.payment_status_changed"},"description":"The event name.","x-description-ar":"اسم الحدث."},{"name":"X-BasicXII-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"Delivery ID; the same on every retry.","x-description-ar":"معرّف الإرسال، ثابت في كل إعادة محاولة."},{"name":"X-BasicXII-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"`t=<unix time>,v1=<HMAC-SHA256 of \"t.body\">`.","x-description-ar":"`t=<الوقت>,v1=<توقيع HMAC-SHA256 للنص \"t.body\">`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id","type","created_at","data"],"properties":{"id":{"type":"string","description":"Event ID (evt_…). Store it and ignore an event you already processed.","x-description-ar":"معرّف الحدث (evt_…). احفظه وتجاهل أي حدث عالجته من قبل."},"type":{"type":"string","const":"invoice.payment_status_changed"},"created_at":{"type":"string","format":"date-time","description":"When it happened (ISO 8601). Events can arrive out of order; compare this or re-read the record.","x-description-ar":"وقت الحدث (ISO 8601). قد تصل الأحداث بغير ترتيبها، فقارن هذا الحقل أو أعد قراءة السجل."},"data":{"$ref":"#/components/schemas/WebhookPaymentStatusChanged"}}},"example":{"id":"evt_01J9Z3EVENTULID0000000000","type":"invoice.payment_status_changed","created_at":"2026-09-21T10:15:00+00:00","data":{"id":"01J9Z3INVOICEULID000000000","number":"INV-2026-000154","reference":"ORDER-10458","status":"partially_paid","payment_status":"partially_paid","contact":{"id":"01J9Z3CUSTOMERULID00000000","code":"WEB-10231","name":"Sara Ahmad","email":"sara@example.com"},"currency":"JOD","invoice_date":"2026-09-21","due_date":"2026-09-21","total":"37.800","amount_paid":"20.000","amount_due":"17.800","previous_payment_status":"unpaid","payment":{"id":"01J9Z3RECEIPTULID000000000","number":"RV-2026-000088","reference":"PAYPAL-7G2K9","amount":"20.000"}}}}}},"responses":{"2XX":{"description":"Return any 2xx within 10 seconds. Anything else is retried after 1m, 5m, 30m, 2h and 6h.","x-description-ar":"أرجع أي رمز 2xx خلال 10 ثوانٍ، وإلا تُعاد المحاولة بعد 1د و5د و30د وساعتين و6 ساعات."}}}},"invoice.paid":{"post":{"operationId":"webhook_invoice_paid","summary":"invoice.paid","description":"An invoice is now fully paid. Also covered by invoice.payment_status_changed; subscribe to one of them.","x-description-ar":"سُددت فاتورة بالكامل. يغطيه أيضاً invoice.payment_status_changed، فاشترك في أحدهما.","parameters":[{"name":"X-BasicXII-Event","in":"header","required":true,"schema":{"type":"string","const":"invoice.paid"},"description":"The event name.","x-description-ar":"اسم الحدث."},{"name":"X-BasicXII-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"Delivery ID; the same on every retry.","x-description-ar":"معرّف الإرسال، ثابت في كل إعادة محاولة."},{"name":"X-BasicXII-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"`t=<unix time>,v1=<HMAC-SHA256 of \"t.body\">`.","x-description-ar":"`t=<الوقت>,v1=<توقيع HMAC-SHA256 للنص \"t.body\">`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id","type","created_at","data"],"properties":{"id":{"type":"string","description":"Event ID (evt_…). Store it and ignore an event you already processed.","x-description-ar":"معرّف الحدث (evt_…). احفظه وتجاهل أي حدث عالجته من قبل."},"type":{"type":"string","const":"invoice.paid"},"created_at":{"type":"string","format":"date-time","description":"When it happened (ISO 8601). Events can arrive out of order; compare this or re-read the record.","x-description-ar":"وقت الحدث (ISO 8601). قد تصل الأحداث بغير ترتيبها، فقارن هذا الحقل أو أعد قراءة السجل."},"data":{"$ref":"#/components/schemas/WebhookInvoice"}}},"example":{"id":"evt_01J9Z3EVENTULID0000000000","type":"invoice.paid","created_at":"2026-09-21T10:15:00+00:00","data":{"id":"01J9Z3INVOICEULID000000000","number":"INV-2026-000154","reference":"ORDER-10458","status":"paid","payment_status":"paid","contact":{"id":"01J9Z3CUSTOMERULID00000000","code":"WEB-10231","name":"Sara Ahmad","email":"sara@example.com"},"currency":"JOD","invoice_date":"2026-09-21","due_date":"2026-09-21","total":"37.800","amount_paid":"37.800","amount_due":"0.000"}}}}},"responses":{"2XX":{"description":"Return any 2xx within 10 seconds. Anything else is retried after 1m, 5m, 30m, 2h and 6h.","x-description-ar":"أرجع أي رمز 2xx خلال 10 ثوانٍ، وإلا تُعاد المحاولة بعد 1د و5د و30د وساعتين و6 ساعات."}}}},"invoice.voided":{"post":{"operationId":"webhook_invoice_voided","summary":"invoice.voided","description":"A posted invoice was voided (cancelled).","x-description-ar":"أُلغيت فاتورة مرحّلة.","parameters":[{"name":"X-BasicXII-Event","in":"header","required":true,"schema":{"type":"string","const":"invoice.voided"},"description":"The event name.","x-description-ar":"اسم الحدث."},{"name":"X-BasicXII-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"Delivery ID; the same on every retry.","x-description-ar":"معرّف الإرسال، ثابت في كل إعادة محاولة."},{"name":"X-BasicXII-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"`t=<unix time>,v1=<HMAC-SHA256 of \"t.body\">`.","x-description-ar":"`t=<الوقت>,v1=<توقيع HMAC-SHA256 للنص \"t.body\">`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id","type","created_at","data"],"properties":{"id":{"type":"string","description":"Event ID (evt_…). Store it and ignore an event you already processed.","x-description-ar":"معرّف الحدث (evt_…). احفظه وتجاهل أي حدث عالجته من قبل."},"type":{"type":"string","const":"invoice.voided"},"created_at":{"type":"string","format":"date-time","description":"When it happened (ISO 8601). Events can arrive out of order; compare this or re-read the record.","x-description-ar":"وقت الحدث (ISO 8601). قد تصل الأحداث بغير ترتيبها، فقارن هذا الحقل أو أعد قراءة السجل."},"data":{"$ref":"#/components/schemas/WebhookInvoice"}}},"example":{"id":"evt_01J9Z3EVENTULID0000000000","type":"invoice.voided","created_at":"2026-09-21T10:15:00+00:00","data":{"id":"01J9Z3INVOICEULID000000000","number":"INV-2026-000154","reference":"ORDER-10458","status":"void","payment_status":null,"contact":{"id":"01J9Z3CUSTOMERULID00000000","code":"WEB-10231","name":"Sara Ahmad","email":"sara@example.com"},"currency":"JOD","invoice_date":"2026-09-21","due_date":"2026-09-21","total":"37.800","amount_paid":"0.000","amount_due":"37.800"}}}}},"responses":{"2XX":{"description":"Return any 2xx within 10 seconds. Anything else is retried after 1m, 5m, 30m, 2h and 6h.","x-description-ar":"أرجع أي رمز 2xx خلال 10 ثوانٍ، وإلا تُعاد المحاولة بعد 1د و5د و30د وساعتين و6 ساعات."}}}},"credit_note.posted":{"post":{"operationId":"webhook_credit_note_posted","summary":"credit_note.posted","description":"A refund (credit note) was posted.","x-description-ar":"رُحّل مرتجع (إشعار دائن).","parameters":[{"name":"X-BasicXII-Event","in":"header","required":true,"schema":{"type":"string","const":"credit_note.posted"},"description":"The event name.","x-description-ar":"اسم الحدث."},{"name":"X-BasicXII-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"Delivery ID; the same on every retry.","x-description-ar":"معرّف الإرسال، ثابت في كل إعادة محاولة."},{"name":"X-BasicXII-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"`t=<unix time>,v1=<HMAC-SHA256 of \"t.body\">`.","x-description-ar":"`t=<الوقت>,v1=<توقيع HMAC-SHA256 للنص \"t.body\">`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id","type","created_at","data"],"properties":{"id":{"type":"string","description":"Event ID (evt_…). Store it and ignore an event you already processed.","x-description-ar":"معرّف الحدث (evt_…). احفظه وتجاهل أي حدث عالجته من قبل."},"type":{"type":"string","const":"credit_note.posted"},"created_at":{"type":"string","format":"date-time","description":"When it happened (ISO 8601). Events can arrive out of order; compare this or re-read the record.","x-description-ar":"وقت الحدث (ISO 8601). قد تصل الأحداث بغير ترتيبها، فقارن هذا الحقل أو أعد قراءة السجل."},"data":{"$ref":"#/components/schemas/WebhookCreditNote"}}},"example":{"id":"evt_01J9Z3EVENTULID0000000000","type":"credit_note.posted","created_at":"2026-09-21T10:15:00+00:00","data":{"id":"01J9Z3CREDITNOTEULID000000","number":"CN-2026-000012","status":"posted","date":"2026-09-25","reason":"Returned: wrong size","restock":true,"contact":{"id":"01J9Z3CUSTOMERULID00000000","code":"WEB-10231","name":"Sara Ahmad","email":"sara@example.com"},"invoice":{"id":"01J9Z3INVOICEULID000000000","number":"INV-2026-000154","reference":"ORDER-10458"},"currency":"JOD","total":"17.250"}}}}},"responses":{"2XX":{"description":"Return any 2xx within 10 seconds. Anything else is retried after 1m, 5m, 30m, 2h and 6h.","x-description-ar":"أرجع أي رمز 2xx خلال 10 ثوانٍ، وإلا تُعاد المحاولة بعد 1د و5د و30د وساعتين و6 ساعات."}}}},"payment.received":{"post":{"operationId":"webhook_payment_received","summary":"payment.received","description":"A customer payment (receipt voucher) was recorded.","x-description-ar":"سُجّلت دفعة من عميل (سند قبض).","parameters":[{"name":"X-BasicXII-Event","in":"header","required":true,"schema":{"type":"string","const":"payment.received"},"description":"The event name.","x-description-ar":"اسم الحدث."},{"name":"X-BasicXII-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"Delivery ID; the same on every retry.","x-description-ar":"معرّف الإرسال، ثابت في كل إعادة محاولة."},{"name":"X-BasicXII-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"`t=<unix time>,v1=<HMAC-SHA256 of \"t.body\">`.","x-description-ar":"`t=<الوقت>,v1=<توقيع HMAC-SHA256 للنص \"t.body\">`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id","type","created_at","data"],"properties":{"id":{"type":"string","description":"Event ID (evt_…). Store it and ignore an event you already processed.","x-description-ar":"معرّف الحدث (evt_…). احفظه وتجاهل أي حدث عالجته من قبل."},"type":{"type":"string","const":"payment.received"},"created_at":{"type":"string","format":"date-time","description":"When it happened (ISO 8601). Events can arrive out of order; compare this or re-read the record.","x-description-ar":"وقت الحدث (ISO 8601). قد تصل الأحداث بغير ترتيبها، فقارن هذا الحقل أو أعد قراءة السجل."},"data":{"$ref":"#/components/schemas/WebhookPayment"}}},"example":{"id":"evt_01J9Z3EVENTULID0000000000","type":"payment.received","created_at":"2026-09-21T10:15:00+00:00","data":{"id":"01J9Z3RECEIPTULID000000000","number":"RV-2026-000088","reference":"PAYPAL-7G2K9","date":"2026-09-21","payment_method":"online","contact":{"id":"01J9Z3CUSTOMERULID00000000","code":"WEB-10231","name":"Sara Ahmad","email":"sara@example.com"},"currency":"JOD","amount":"20.000","invoices":[{"id":"01J9Z3INVOICEULID000000000","number":"INV-2026-000154","reference":"ORDER-10458","amount":"20.000"}]}}}}},"responses":{"2XX":{"description":"Return any 2xx within 10 seconds. Anything else is retried after 1m, 5m, 30m, 2h and 6h.","x-description-ar":"أرجع أي رمز 2xx خلال 10 ثوانٍ، وإلا تُعاد المحاولة بعد 1د و5د و30د وساعتين و6 ساعات."}}}},"customer.created":{"post":{"operationId":"webhook_customer_created","summary":"customer.created","description":"A customer was created.","x-description-ar":"أُنشئ عميل.","parameters":[{"name":"X-BasicXII-Event","in":"header","required":true,"schema":{"type":"string","const":"customer.created"},"description":"The event name.","x-description-ar":"اسم الحدث."},{"name":"X-BasicXII-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"Delivery ID; the same on every retry.","x-description-ar":"معرّف الإرسال، ثابت في كل إعادة محاولة."},{"name":"X-BasicXII-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"`t=<unix time>,v1=<HMAC-SHA256 of \"t.body\">`.","x-description-ar":"`t=<الوقت>,v1=<توقيع HMAC-SHA256 للنص \"t.body\">`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id","type","created_at","data"],"properties":{"id":{"type":"string","description":"Event ID (evt_…). Store it and ignore an event you already processed.","x-description-ar":"معرّف الحدث (evt_…). احفظه وتجاهل أي حدث عالجته من قبل."},"type":{"type":"string","const":"customer.created"},"created_at":{"type":"string","format":"date-time","description":"When it happened (ISO 8601). Events can arrive out of order; compare this or re-read the record.","x-description-ar":"وقت الحدث (ISO 8601). قد تصل الأحداث بغير ترتيبها، فقارن هذا الحقل أو أعد قراءة السجل."},"data":{"$ref":"#/components/schemas/WebhookContact"}}},"example":{"id":"evt_01J9Z3EVENTULID0000000000","type":"customer.created","created_at":"2026-09-21T10:15:00+00:00","data":{"id":"01J9Z3CUSTOMERULID00000000","code":"WEB-10231","name":"Sara Ahmad","email":"sara@example.com","type":"customer","phone":"+962790000000"}}}}},"responses":{"2XX":{"description":"Return any 2xx within 10 seconds. Anything else is retried after 1m, 5m, 30m, 2h and 6h.","x-description-ar":"أرجع أي رمز 2xx خلال 10 ثوانٍ، وإلا تُعاد المحاولة بعد 1د و5د و30د وساعتين و6 ساعات."}}}},"quotation.accepted":{"post":{"operationId":"webhook_quotation_accepted","summary":"quotation.accepted","description":"A quotation was accepted, in the app or by the customer through the share link (`via: portal`).","x-description-ar":"قُبل عرض سعر، من التطبيق أو من العميل عبر رابط المشاركة (`via: portal`).","parameters":[{"name":"X-BasicXII-Event","in":"header","required":true,"schema":{"type":"string","const":"quotation.accepted"},"description":"The event name.","x-description-ar":"اسم الحدث."},{"name":"X-BasicXII-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"Delivery ID; the same on every retry.","x-description-ar":"معرّف الإرسال، ثابت في كل إعادة محاولة."},{"name":"X-BasicXII-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"`t=<unix time>,v1=<HMAC-SHA256 of \"t.body\">`.","x-description-ar":"`t=<الوقت>,v1=<توقيع HMAC-SHA256 للنص \"t.body\">`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id","type","created_at","data"],"properties":{"id":{"type":"string","description":"Event ID (evt_…). Store it and ignore an event you already processed.","x-description-ar":"معرّف الحدث (evt_…). احفظه وتجاهل أي حدث عالجته من قبل."},"type":{"type":"string","const":"quotation.accepted"},"created_at":{"type":"string","format":"date-time","description":"When it happened (ISO 8601). Events can arrive out of order; compare this or re-read the record.","x-description-ar":"وقت الحدث (ISO 8601). قد تصل الأحداث بغير ترتيبها، فقارن هذا الحقل أو أعد قراءة السجل."},"data":{"$ref":"#/components/schemas/WebhookQuotation"}}},"example":{"id":"evt_01J9Z3EVENTULID0000000000","type":"quotation.accepted","created_at":"2026-09-21T10:15:00+00:00","data":{"id":"01J9Z3QUOTEULID00000000000","number":"QT-2026-000031","via":"portal"}}}}},"responses":{"2XX":{"description":"Return any 2xx within 10 seconds. Anything else is retried after 1m, 5m, 30m, 2h and 6h.","x-description-ar":"أرجع أي رمز 2xx خلال 10 ثوانٍ، وإلا تُعاد المحاولة بعد 1د و5د و30د وساعتين و6 ساعات."}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Create a token in Settings → Integrations → API tokens, choose its scopes, and send it as `Authorization: Bearer <token>`.","x-description-ar":"أنشئ مفتاحاً من الإعدادات ← التكاملات ← مفاتيح API، واختر صلاحياته، وأرسله في الترويسة `Authorization: Bearer <token>`."}},"parameters":{"IdempotencyKey":{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","maxLength":255},"description":"A unique value per operation (e.g. your order ID). Retrying with the same key within 24 hours returns the original response instead of creating a duplicate.","x-description-ar":"قيمة فريدة لكل عملية (مثل رقم الطلب لديك). إعادة المحاولة بالقيمة نفسها خلال 24 ساعة تُرجع الاستجابة الأصلية بدلاً من إنشاء نسخة مكررة."},"Page":{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Page number (25 results per page).","x-description-ar":"رقم الصفحة (25 نتيجة في كل صفحة)."}},"responses":{"Unauthenticated":{"description":"Missing, expired or revoked token.","x-description-ar":"المفتاح مفقود أو منتهٍ أو ملغى.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"message":"Unauthenticated."}}}},"Forbidden":{"description":"The token lacks the scope, or its owner lacks the permission.","x-description-ar":"المفتاح لا يملك الصلاحية، أو صاحبه لا يملك الإذن.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"message":"This action is unauthorized."}}}},"TooManyRequests":{"description":"Over 120 requests a minute for this token. Wait for `Retry-After` seconds.","x-description-ar":"تجاوزت 120 طلباً في الدقيقة لهذا المفتاح. انتظر عدد الثواني في `Retry-After`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"message":"Too Many Attempts."}}}},"ValidationFailed":{"description":"The request is invalid. `errors` lists what to fix per field.","x-description-ar":"الطلب غير صالح، ويبيّن `errors` ما يجب تصحيحه لكل حقل.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"},"example":{"message":"The email field must be a valid email address.","errors":{"email":["The email field must be a valid email address."]}}}}}},"schemas":{"Error":{"type":"object","properties":{"message":{"type":"string"}}},"ValidationError":{"type":"object","properties":{"message":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}}},"PageMeta":{"type":"object","properties":{"current_page":{"type":"integer"},"last_page":{"type":"integer"},"per_page":{"type":"integer"},"total":{"type":"integer"}}},"ReferenceData":{"type":"object","properties":{"data":{"type":"object","properties":{"organization":{"type":"object"},"currencies":{"type":"array","items":{"type":"object"}},"tax_rates":{"type":"array","items":{"type":"object"}},"payment_accounts":{"type":"array","items":{"type":"object"}},"warehouses":{"type":"array","items":{"type":"object"}},"payment_methods":{"type":"array","items":{"type":"string"}}}}}},"ContactInput":{"type":"object","required":["code","type","name"],"properties":{"code":{"type":"string","description":"Your own ID for this contact, unique in the company. Use your store customer ID (e.g. WEB-10231) so you can find it again with ?code=.","x-description-ar":"معرّفك الخاص لجهة الاتصال، فريد داخل الشركة. استخدم رقم العميل في متجرك (مثل WEB-10231) لتجده لاحقاً عبر ?code=.","maxLength":30},"type":{"type":"string","description":"customer, supplier or both.","x-description-ar":"customer أو supplier أو both.","enum":["customer","supplier","both"]},"name":{"type":"string","description":"Display name.","x-description-ar":"الاسم الظاهر.","maxLength":255},"legal_name":{"type":"string","description":"Registered company name.","x-description-ar":"الاسم القانوني المسجّل."},"email":{"type":"string","description":"Email.","x-description-ar":"البريد الإلكتروني.","format":"email"},"phone":{"type":"string","description":"Phone.","x-description-ar":"الهاتف."},"tax_number":{"type":"string","description":"Tax registration number.","x-description-ar":"الرقم الضريبي."},"currency_id":{"type":"integer","description":"Default currency (ID from reference data). New invoices for this contact use it.","x-description-ar":"العملة الافتراضية (المعرّف من البيانات المرجعية)، وتُستخدم في فواتيره الجديدة."},"billing_address":{"type":"object","description":"Free-form address object, e.g. line1, city, country.","x-description-ar":"عنوان بصيغة حرّة مثل line1 وcity وcountry."},"shipping_address":{"type":"object","description":"Free-form address object.","x-description-ar":"عنوان الشحن بصيغة حرّة."},"payment_terms_days":{"type":"integer","minimum":0,"maximum":365,"description":"Days until invoices are due.","x-description-ar":"عدد أيام الاستحقاق للفواتير."},"preferred_locale":{"type":"string","description":"en or ar, for documents sent to them.","x-description-ar":"en أو ar للمستندات المرسلة إليه.","enum":["en","ar"]}}},"Contact":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"type":{"type":"string","enum":["customer","supplier","both"]},"name":{"type":"string"},"legal_name":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"tax_number":{"type":["string","null"]},"currency":{"type":["object","null"]},"billing_address":{"type":["object","null"]},"shipping_address":{"type":["object","null"]},"payment_terms_days":{"type":["integer","null"]},"is_active":{"type":"boolean"},"created_at":{"type":"string"}}},"ContactEnvelope":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Contact"}}},"ContactList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Contact"}},"meta":{"$ref":"#/components/schemas/PageMeta"}}},"ProductInput":{"type":"object","required":["sku","name","type"],"properties":{"sku":{"type":"string","description":"Stock keeping unit, unique in the company. Use the same SKU as your store.","x-description-ar":"رمز الصنف SKU، فريد داخل الشركة. استخدم الرمز نفسه في متجرك.","maxLength":60},"barcode":{"type":"string","description":"Barcode.","x-description-ar":"الباركود."},"name":{"type":"string","description":"Name.","x-description-ar":"الاسم."},"name_ar":{"type":"string","description":"Arabic name, shown on Arabic documents.","x-description-ar":"الاسم العربي، يظهر في المستندات العربية."},"type":{"type":"string","description":"physical, non_inventory or service.","x-description-ar":"physical أو non_inventory أو service.","enum":["physical","non_inventory","service"]},"selling_price":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"Default selling price before tax. Decimal string, e.g. \"15.000\".","x-description-ar":"سعر البيع الافتراضي قبل الضريبة. نص رقمي عشري مثل \"15.000\"."},"purchase_price":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"Default cost. Decimal string, e.g. \"15.000\".","x-description-ar":"التكلفة الافتراضية. نص رقمي عشري مثل \"15.000\"."},"tax_rate_id":{"type":"string","description":"Default tax rate ID.","x-description-ar":"معرّف نسبة الضريبة الافتراضية."},"track_inventory":{"type":"boolean","description":"Track stock for physical products.","x-description-ar":"تتبع المخزون للمنتجات المادية."},"is_active":{"type":"boolean"}}},"Product":{"type":"object","properties":{"id":{"type":"string"},"sku":{"type":"string"},"barcode":{"type":["string","null"]},"name":{"type":"string"},"name_ar":{"type":["string","null"]},"type":{"type":"string"},"purchase_price":{"type":"string"},"selling_price":{"type":"string"},"tax_rate":{"type":["object","null"]},"track_inventory":{"type":"boolean"},"is_active":{"type":"boolean"}}},"ProductEnvelope":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Product"}}},"ProductList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Product"}},"meta":{"$ref":"#/components/schemas/PageMeta"}}},"Line":{"type":"object","required":["quantity","unit_price"],"properties":{"product_id":{"type":"string","description":"Product ID. Optional for free-text lines.","x-description-ar":"معرّف المنتج، اختياري للبنود النصية."},"description":{"type":"string","description":"Line text. Defaults to the product name.","x-description-ar":"نص البند، افتراضياً اسم المنتج.","maxLength":500},"quantity":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"Quantity, more than 0. Decimal string, e.g. \"15.000\".","x-description-ar":"الكمية، أكبر من صفر. نص رقمي عشري مثل \"15.000\"."},"unit_price":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"Price per unit before tax. Decimal string, e.g. \"15.000\".","x-description-ar":"سعر الوحدة قبل الضريبة. نص رقمي عشري مثل \"15.000\"."},"discount_type":{"type":"string","description":"percentage or fixed.","x-description-ar":"percentage أو fixed.","enum":["percentage","fixed"]},"discount_value":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"Discount amount or percent. Decimal string, e.g. \"15.000\".","x-description-ar":"قيمة الخصم أو نسبته. نص رقمي عشري مثل \"15.000\"."},"tax_rate_id":{"type":"string","description":"Tax rate ID from reference data.","x-description-ar":"معرّف نسبة الضريبة من البيانات المرجعية."}}},"InvoiceInput":{"type":"object","required":["contact_id","invoice_date","lines"],"properties":{"contact_id":{"type":"string","description":"Customer ID.","x-description-ar":"معرّف العميل."},"invoice_date":{"type":"string","description":"YYYY-MM-DD.","x-description-ar":"بصيغة YYYY-MM-DD.","format":"date"},"due_date":{"type":"string","description":"YYYY-MM-DD, on or after the invoice date.","x-description-ar":"بصيغة YYYY-MM-DD، في تاريخ الفاتورة أو بعده.","format":"date"},"reference":{"type":"string","description":"Your order number. Use it to find this invoice later.","x-description-ar":"رقم الطلب لديك، للعثور على الفاتورة لاحقاً."},"currency_id":{"type":"integer","description":"Currency ID. Defaults to the customer’s currency, then the company default.","x-description-ar":"معرّف العملة، افتراضياً عملة العميل ثم عملة الشركة."},"exchange_rate":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"Rate to the base currency for foreign-currency invoices. Taken from the rate table if omitted. Decimal string, e.g. \"15.000\".","x-description-ar":"سعر الصرف مقابل العملة الأساسية للفواتير الأجنبية، ويُؤخذ من جدول الأسعار إن لم يُرسل. نص رقمي عشري مثل \"15.000\"."},"shipping_amount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"Shipping charged to the customer. Decimal string, e.g. \"15.000\".","x-description-ar":"رسوم الشحن على العميل. نص رقمي عشري مثل \"15.000\"."},"warehouse_id":{"type":"string","description":"Warehouse the stock leaves from. Defaults to the default warehouse.","x-description-ar":"المستودع الذي يُصرف منه المخزون، افتراضياً المستودع الرئيسي."},"notes":{"type":"string","description":"Notes printed on the invoice.","x-description-ar":"ملاحظات تُطبع على الفاتورة."},"lines":{"type":"array","minItems":1,"items":{"$ref":"#/components/schemas/Line"},"description":"One or more lines. Each needs quantity and unit_price, plus product_id or description; discount_type, discount_value and tax_rate_id are optional.","x-description-ar":"بند واحد أو أكثر. كل بند يحتاج quantity وunit_price، مع product_id أو description، والخصم discount_type وdiscount_value ونسبة الضريبة tax_rate_id اختيارية."}}},"Invoice":{"type":"object","properties":{"id":{"type":"string"},"invoice_number":{"type":"string"},"status":{"type":"string","enum":["draft","approved","partially_paid","paid","void","cancelled"],"description":"Accounting status.","x-description-ar":"الحالة المحاسبية."},"payment_status":{"type":["string","null"],"enum":["unpaid","partially_paid","paid",null],"description":"Payment side only: null while draft or after void.","x-description-ar":"حالة الدفع فقط: null للمسودة أو الملغاة."},"reference":{"type":["string","null"]},"contact":{"type":"object"},"currency":{"type":"object"},"exchange_rate":{"type":"string"},"invoice_date":{"type":"string"},"due_date":{"type":["string","null"]},"is_overdue":{"type":"boolean"},"subtotal":{"type":"string"},"tax_total":{"type":"string"},"shipping_amount":{"type":"string"},"total":{"type":"string"},"amount_paid":{"type":"string"},"amount_due":{"type":"string"},"lines":{"type":"array","items":{"type":"object"}},"created_at":{"type":"string"}}},"InvoiceEnvelope":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Invoice"}}},"VoidInput":{"type":"object","properties":{"reason":{"type":"string","description":"Why it was cancelled (kept in the audit log).","x-description-ar":"سبب الإلغاء (يُحفظ في سجل التدقيق).","maxLength":500}}},"WebhookInvoice":{"type":"object","properties":{"id":{"type":"string","description":"Invoice ID.","x-description-ar":"معرّف الفاتورة."},"number":{"type":"string","description":"Invoice number (final once posted).","x-description-ar":"رقم الفاتورة (نهائي بعد الترحيل)."},"reference":{"type":["string","null"],"description":"Your order number, as you sent it.","x-description-ar":"رقم الطلب كما أرسلته."},"status":{"type":"string","description":"Accounting status.","x-description-ar":"الحالة المحاسبية.","enum":["draft","approved","partially_paid","paid","void","cancelled"]},"payment_status":{"type":["string","null"],"description":"unpaid, partially_paid or paid; null for drafts and voided invoices.","x-description-ar":"unpaid أو partially_paid أو paid؛ وnull للمسودة والملغاة.","enum":["unpaid","partially_paid","paid",null]},"contact":{"type":"object","description":"The customer: id, code (your store ID), name, email.","x-description-ar":"العميل: id وcode (رقمه في متجرك) وname وemail.","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"email":{"type":["string","null"]}}},"currency":{"type":"string","description":"ISO currency code.","x-description-ar":"رمز العملة ISO."},"invoice_date":{"type":"string","description":"YYYY-MM-DD.","x-description-ar":"بصيغة YYYY-MM-DD.","format":"date"},"due_date":{"type":["string","null"],"description":"YYYY-MM-DD.","x-description-ar":"بصيغة YYYY-MM-DD.","format":"date"},"total":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"Invoice total. Decimal string, e.g. \"15.000\".","x-description-ar":"إجمالي الفاتورة. نص رقمي عشري مثل \"15.000\"."},"amount_paid":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"Paid so far. Decimal string, e.g. \"15.000\".","x-description-ar":"المدفوع حتى الآن. نص رقمي عشري مثل \"15.000\"."},"amount_due":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"Still to pay. Decimal string, e.g. \"15.000\".","x-description-ar":"المتبقي. نص رقمي عشري مثل \"15.000\"."}}},"WebhookPaymentStatusChanged":{"type":"object","properties":{"id":{"type":"string","description":"Invoice ID.","x-description-ar":"معرّف الفاتورة."},"number":{"type":"string","description":"Invoice number (final once posted).","x-description-ar":"رقم الفاتورة (نهائي بعد الترحيل)."},"reference":{"type":["string","null"],"description":"Your order number, as you sent it.","x-description-ar":"رقم الطلب كما أرسلته."},"status":{"type":"string","description":"Accounting status.","x-description-ar":"الحالة المحاسبية.","enum":["draft","approved","partially_paid","paid","void","cancelled"]},"payment_status":{"type":["string","null"],"description":"unpaid, partially_paid or paid; null for drafts and voided invoices.","x-description-ar":"unpaid أو partially_paid أو paid؛ وnull للمسودة والملغاة.","enum":["unpaid","partially_paid","paid",null]},"contact":{"type":"object","description":"The customer: id, code (your store ID), name, email.","x-description-ar":"العميل: id وcode (رقمه في متجرك) وname وemail.","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"email":{"type":["string","null"]}}},"currency":{"type":"string","description":"ISO currency code.","x-description-ar":"رمز العملة ISO."},"invoice_date":{"type":"string","description":"YYYY-MM-DD.","x-description-ar":"بصيغة YYYY-MM-DD.","format":"date"},"due_date":{"type":["string","null"],"description":"YYYY-MM-DD.","x-description-ar":"بصيغة YYYY-MM-DD.","format":"date"},"total":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"Invoice total. Decimal string, e.g. \"15.000\".","x-description-ar":"إجمالي الفاتورة. نص رقمي عشري مثل \"15.000\"."},"amount_paid":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"Paid so far. Decimal string, e.g. \"15.000\".","x-description-ar":"المدفوع حتى الآن. نص رقمي عشري مثل \"15.000\"."},"amount_due":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"Still to pay. Decimal string, e.g. \"15.000\".","x-description-ar":"المتبقي. نص رقمي عشري مثل \"15.000\"."},"previous_payment_status":{"type":"string","description":"The payment status before this change.","x-description-ar":"حالة الدفع قبل هذا التغيير.","enum":["unpaid","partially_paid"]},"payment":{"type":"object","description":"The receipt that caused the change: id, number, reference (gateway transaction) and the amount applied to this invoice.","x-description-ar":"سند القبض الذي سبّب التغيير: id وnumber وreference (رقم العملية في البوابة) والمبلغ المطبّق على هذه الفاتورة.","properties":{"id":{"type":"string"},"number":{"type":"string"},"reference":{"type":["string","null"]},"amount":{"type":"string"}}}}},"WebhookPayment":{"type":"object","properties":{"id":{"type":"string","description":"Receipt voucher ID.","x-description-ar":"معرّف سند القبض."},"number":{"type":"string","description":"Voucher number.","x-description-ar":"رقم السند."},"reference":{"type":["string","null"],"description":"Payment gateway transaction ID.","x-description-ar":"رقم العملية في بوابة الدفع."},"date":{"type":"string","description":"YYYY-MM-DD.","x-description-ar":"بصيغة YYYY-MM-DD.","format":"date"},"payment_method":{"type":"string","description":"cash, bank_transfer, card, cheque, online or other.","x-description-ar":"cash أو bank_transfer أو card أو cheque أو online أو other."},"contact":{"type":"object","description":"The customer: id, code (your store ID), name, email.","x-description-ar":"العميل: id وcode (رقمه في متجرك) وname وemail.","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"email":{"type":["string","null"]}}},"currency":{"type":"string","description":"ISO currency code.","x-description-ar":"رمز العملة ISO."},"amount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"Total received. Decimal string, e.g. \"15.000\".","x-description-ar":"المبلغ المستلم. نص رقمي عشري مثل \"15.000\"."},"invoices":{"type":"array","description":"Invoices it paid: id, number, reference and amount applied.","x-description-ar":"الفواتير المسددة: id وnumber وreference والمبلغ المطبّق.","items":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"reference":{"type":["string","null"]},"amount":{"type":"string"}}}}}},"WebhookCreditNote":{"type":"object","properties":{"id":{"type":"string","description":"Credit note ID.","x-description-ar":"معرّف الإشعار الدائن."},"number":{"type":"string","description":"Credit note number.","x-description-ar":"رقم الإشعار الدائن."},"status":{"type":"string","description":"posted.","x-description-ar":"posted."},"date":{"type":"string","description":"YYYY-MM-DD.","x-description-ar":"بصيغة YYYY-MM-DD.","format":"date"},"reason":{"type":["string","null"],"description":"Why it was refunded.","x-description-ar":"سبب الإرجاع."},"restock":{"type":"boolean","description":"Items went back to stock.","x-description-ar":"أُعيدت الأصناف إلى المخزون."},"contact":{"type":"object","description":"The customer: id, code (your store ID), name, email.","x-description-ar":"العميل: id وcode (رقمه في متجرك) وname وemail.","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"email":{"type":["string","null"]}}},"invoice":{"type":["object","null"],"description":"The refunded invoice: id, number, reference.","x-description-ar":"الفاتورة المرتجعة: id وnumber وreference."},"currency":{"type":"string","description":"ISO currency code.","x-description-ar":"رمز العملة ISO."},"total":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"Amount credited. Decimal string, e.g. \"15.000\".","x-description-ar":"المبلغ المرتجع. نص رقمي عشري مثل \"15.000\"."}}},"WebhookContact":{"type":"object","properties":{"id":{"type":"string","description":"Contact ID.","x-description-ar":"معرّف جهة الاتصال."},"code":{"type":"string","description":"Your code for them.","x-description-ar":"الرمز الخاص بك."},"name":{"type":"string","description":"Name.","x-description-ar":"الاسم."},"email":{"type":["string","null"],"description":"Email.","x-description-ar":"البريد."},"type":{"type":"string","description":"customer or both.","x-description-ar":"customer أو both."},"phone":{"type":["string","null"],"description":"Phone.","x-description-ar":"الهاتف."}}},"WebhookQuotation":{"type":"object","properties":{"id":{"type":"string","description":"Quotation ID.","x-description-ar":"معرّف عرض السعر."},"number":{"type":"string","description":"Quotation number.","x-description-ar":"رقم عرض السعر."},"via":{"type":"string","description":"`portal` when the customer accepted it through the share link.","x-description-ar":"`portal` عندما يقبله العميل عبر رابط المشاركة."}}},"InvoiceList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Invoice"}},"meta":{"$ref":"#/components/schemas/PageMeta"}}},"CreditNoteInput":{"type":"object","required":["contact_id","date","lines"],"properties":{"contact_id":{"type":"string","description":"Customer ID.","x-description-ar":"معرّف العميل."},"invoice_id":{"type":"string","description":"The invoice being refunded.","x-description-ar":"الفاتورة المرتجعة."},"date":{"type":"string","description":"YYYY-MM-DD.","x-description-ar":"بصيغة YYYY-MM-DD.","format":"date"},"reason":{"type":"string","description":"Why it was refunded.","x-description-ar":"سبب الإرجاع."},"restock":{"type":"boolean","description":"Return the items to stock.","x-description-ar":"إعادة الأصناف إلى المخزون."},"lines":{"type":"array","minItems":1,"items":{"$ref":"#/components/schemas/Line"},"description":"One or more lines. Each needs quantity and unit_price, plus product_id or description; discount_type, discount_value and tax_rate_id are optional.","x-description-ar":"بند واحد أو أكثر. كل بند يحتاج quantity وunit_price، مع product_id أو description، والخصم discount_type وdiscount_value ونسبة الضريبة tax_rate_id اختيارية."}}},"ReceiptInput":{"type":"object","required":["contact_id","date","payment_method","deposit_account_id","amount","allocations"],"properties":{"contact_id":{"type":"string","description":"Customer ID.","x-description-ar":"معرّف العميل."},"date":{"type":"string","description":"YYYY-MM-DD.","x-description-ar":"بصيغة YYYY-MM-DD.","format":"date"},"payment_method":{"type":"string","description":"How it was paid.","x-description-ar":"طريقة الدفع.","enum":["cash","bank_transfer","card","cheque","online","other"]},"deposit_account_id":{"type":"string","description":"Cash or bank account it was paid into (reference data: payment_accounts).","x-description-ar":"حساب الصندوق أو البنك المودَع فيه (من البيانات المرجعية: payment_accounts)."},"amount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"Total received. Decimal string, e.g. \"15.000\".","x-description-ar":"المبلغ المستلم. نص رقمي عشري مثل \"15.000\"."},"reference":{"type":"string","description":"Payment gateway transaction ID.","x-description-ar":"رقم العملية في بوابة الدفع."},"allocations":{"type":"array","minItems":1,"items":{"type":"object","required":["invoice_id","amount"],"properties":{"invoice_id":{"type":"string"},"amount":{"type":"string"}}},"description":"Which invoices this pays. Amounts must add up to `amount`.","x-description-ar":"الفواتير المسددة بهذا السند، ومجموعها يساوي `amount`."}}},"BillInput":{"type":"object","required":["contact_id","bill_date","lines"],"properties":{"contact_id":{"type":"string","description":"Supplier ID.","x-description-ar":"معرّف المورد."},"bill_date":{"type":"string","description":"YYYY-MM-DD.","x-description-ar":"بصيغة YYYY-MM-DD.","format":"date"},"due_date":{"type":"string","description":"YYYY-MM-DD.","x-description-ar":"بصيغة YYYY-MM-DD.","format":"date"},"supplier_invoice_number":{"type":"string","description":"The supplier’s own invoice number.","x-description-ar":"رقم فاتورة المورد."},"reference":{"type":"string","description":"Your reference.","x-description-ar":"مرجعك الداخلي."},"lines":{"type":"array","minItems":1,"items":{"$ref":"#/components/schemas/Line"},"description":"One or more lines. Each needs quantity and unit_price, plus product_id or description; discount_type, discount_value and tax_rate_id are optional.","x-description-ar":"بند واحد أو أكثر. كل بند يحتاج quantity وunit_price، مع product_id أو description، والخصم discount_type وdiscount_value ونسبة الضريبة tax_rate_id اختيارية."}}},"PaymentInput":{"type":"object","required":["contact_id","date","payment_method","payment_account_id","amount","allocations"],"properties":{"contact_id":{"type":"string","description":"Supplier ID.","x-description-ar":"معرّف المورد."},"date":{"type":"string","description":"YYYY-MM-DD.","x-description-ar":"بصيغة YYYY-MM-DD.","format":"date"},"payment_method":{"type":"string","description":"How it was paid.","x-description-ar":"طريقة الدفع.","enum":["cash","bank_transfer","card","cheque","online","other"]},"payment_account_id":{"type":"string","description":"Cash or bank account it was paid from.","x-description-ar":"حساب الصندوق أو البنك المدفوع منه."},"amount":{"type":"string","pattern":"^\\d+(\\.\\d+)?$","description":"Total paid. Decimal string, e.g. \"15.000\".","x-description-ar":"المبلغ المدفوع. نص رقمي عشري مثل \"15.000\"."},"allocations":{"type":"array","minItems":1,"items":{"type":"object","required":["bill_id","amount"],"properties":{"bill_id":{"type":"string"},"amount":{"type":"string"}}}}}}}}}