English

ה-API של חשבון מהיר

הפקת קבלות וחשבוניות לעסק ישראלי מתוך המערכת שלכם: חנות, CRM, מערכת הזמנות.

https://api.quicklyinvoice.com/v1

התחלה מהירה: הקבלה הראשונה ב-5 דקות

באפליקציית חשבון מהיר, פתחו הגדרות → API למפתחים וצרו מפתח (ה-API כלול במסלול החודשי והשנתי; מפתח בדיקה, בכל מסלול, לא מפיק שום דבר אמיתי, ראו בדיקות). העתיקו אותו למשתנה סביבה בשרת, QUICKLY_INVOICE_KEY, והפיקו קבלה:

curl https://api.quicklyinvoice.com/v1/documents \
  -H "Authorization: Bearer $QUICKLY_INVOICE_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-1842" \
  -d '{ "type": "receipt", "customer": { "externalId": "shop-1842", "name": "Dana Levi", "phone": "0501234567" }, "items": [{ "description": "Haircut", "price": 100 }], "payments": [{ "method": "credit_card", "amount": 100, "cardLast4": "4242" }], "send": { "email": "[email protected]" } }'

התשובה היא המסמך: המספר, הסכומים, המע״מ ו-pdfUrl. הוא מופיע מיד באפליקציה, במספור של שאר מסמכי העסק.

Node.js

const response = await fetch('https://api.quicklyinvoice.com/v1/documents', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.QUICKLY_INVOICE_KEY}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': `order-${order.id}`,
  },
  body: JSON.stringify({
    type: 'receipt',
    customer: { externalId: String(order.customerId), name: order.name, phone: order.phone },
    items: order.lines.map(line => ({ description: line.title, quantity: line.qty, price: line.price })),
    payments: [{ method: 'credit_card', amount: order.total }],
  }),
});
const document = await response.json();
if (!response.ok) throw new Error(`${document.error.code}: ${document.error.message}`);
console.log(document.number, document.pdfUrl);

Python

import os, requests

response = requests.post(
    "https://api.quicklyinvoice.com/v1/documents",
    headers={
        "Authorization": f"Bearer {os.environ['QUICKLY_INVOICE_KEY']}",
        "Idempotency-Key": f"order-{order_id}",
    },
    json={
        "type": "receipt",
        "items": [{"description": "Haircut", "price": 100}],
        "payments": [{"method": "cash", "amount": 100}],
    },
    timeout=70,
)
document = response.json()
response.raise_for_status()
print(document["number"], document["pdfUrl"])

PHP

$ch = curl_init('https://api.quicklyinvoice.com/v1/documents');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 70,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('QUICKLY_INVOICE_KEY'),
        'Content-Type: application/json',
        'Idempotency-Key: order-' . $orderId,
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'type' => 'receipt',
        'items' => [['description' => 'Haircut', 'price' => 100]],
        'payments' => [['method' => 'cash', 'amount' => 100]],
    ]),
]);
$document = json_decode(curl_exec($ch), true);
echo $document['number'] . ' ' . $document['pdfUrl'];

מפתחות והרשאות

שלחו את המפתח בכל בקשה כ-Authorization: Bearer qik_live_.... מפתח פועל בשם העסק, לכן הוא נשאר בשרת: בקשה מדפדפן (עם כותרת Origin) נדחית, ול-API אין CORS. בעלי העסק יכולים לבטל מפתח בכל רגע באותו מסך, והוא מפסיק לעבוד מיד. לכל מפתח הרשאות:

scope
documents:readList and read documents and their PDFs.
documents:writeMake, email and cancel documents.
customers:readList and read customers.
customers:writeAdd customers (also when a document names a new one).

ניסיונות חוזרים ו-Idempotency-Key

שלחו Idempotency-Key (מספר ההזמנה שלכם מתאים) עם כל POST. שליחה חוזרת של אותה בקשה עם אותו מפתח, בתוך 24 שעות, מחזירה את התשובה הראשונה עם Idempotent-Replayed: true ולעולם לא מפיקה מסמך שני. אותו מפתח עם גוף אחר נדחה (409). חשבונית מס יכולה לחכות לרשות המסים עד דקה, לכן תנו לבקשות זמן קצוב של 70 שניות; אם בקשה נקטעה (504 outcome_unknown), שלחו אותה שוב עם אותו מפתח.

מסמכים ישראליים בקצרה

קראו קודם ל-GET /business: הוא אומר אם העסק עוסק מורשה, חברה או עוסק פטור, אילו סוגי מסמכים מותרים לו, ומה סף מספר ההקצאה. מחירים כוללים מע״מ אלא אם פריט מציין "vatIncluded": false; ה-API מחשב מע״מ, הנחה ועיגול בדיוק כמו האפליקציה. tax_invoice או invoice_receipt מהסף ומעלה (לפני מע״מ) מקבלים מספר הקצאה מרשות המסים: העסק צריך לחבר את רשות המסים באפליקציה, וללקוח צריך taxId. receipt ו-invoice_receipt מקבלים payments, שסכומם חייב להיות שווה לסך המסמך.

typeקודשםתשלומיםעוסק פטור
receipt400קבלה✓✓
tax_invoice305חשבונית מס
invoice_receipt320חשבונית מס קבלה✓
credit_invoice330חשבונית זיכוי
transaction_invoice300חשבון עסקה✓
order100הזמנה✓
quote10הצעת מחיר✓
delivery_note200תעודת משלוח✓

אמצעי תשלום

cash cheque credit_card bank_transfer payment_app withholding_tax

שגיאות

שגיאה עונה {"error": {"code", "message", "details"}}. פעלו לפי code; message מיועד לאנשים (בעברית עם Accept-Language: he), ו-details מפרט כל שדה שגוי. בכל תשובה יש כותרת request-id: שלחו לנו אותה כשמשהו לא ברור.

סטטוסקודמשמעות
400invalid_requestהבקשה לא תקינה: details מפרט כל שדה.
400idempotency_key_invalidIdempotency-Key צריך להיות 8 עד 255 תווי ASCII.
401unauthorizedאין מפתח, מפתח לא תקין או מבוטל, מפתח של משרד מפתחים שהחיבור שלו הסתיים, או קריאה מדפדפן.
402plan_requiredלמסלול של העסק אין API (המסלול החודשי והשנתי כוללים). מפתחות בדיקה עובדים בכל מסלול.
402plan_limitהעסק הגיע למכסת המסמכים החודשית של המסלול.
403forbidden_scopeלמפתח אין הרשאה לפעולה הזו.
403customers_scope_neededהוספת לקוח דרך מסמך דורשת customers:write.
404not_foundאין מסמך או לקוח כזה בעסק.
409already_cancelledהמסמך כבר בוטל.
409already_cancellingבקשה אחרת מבטלת את המסמך ברגע זה.
409idempotency_key_reusedה-Idempotency-Key הזה נשלח עם גוף אחר.
409idempotency_key_in_useבקשה עם אותו Idempotency-Key עדיין רצה.
422document_type_not_allowedעוסק פטור לא יכול להפיק סוג מסמך זה.
422payments_mismatchסכום התשלומים לא שווה לסכום המסמך.
422payments_not_allowedרק קבלה וחשבונית מס קבלה מקבלות תשלומים.
422tax_authority_not_connectedחשבונית מעל הסף דורשת חיבור לרשות המסים באפליקציה.
422cannot_cancelאי אפשר לבטל סוג מסמך זה.
422send_failedשליחת המייל נכשלה.
422rejectedשירות המסמכים סירב; ההודעה מסבירה למה.
429rate_limitedיותר מ-60 בקשות בדקה. יש לחכות לפי Retry-After.
429daily_limitהמפתח הגיע ל-5,000 בקשות היום (מתאפס בחצות UTC).
500internal_errorתקלה אצלנו. נסו שוב, ואם חוזר כתבו לנו עם ה-request-id.
500outcome_unknownנכשל אחרי שהתחיל וייתכן שבוצע: בדקו ברשימה, או שלחו שוב עם אותו Idempotency-Key.
503unavailableה-API לא זמין כרגע. נסו שוב לפי Retry-After.

מגבלות

כל מפתח יכול לשלוח 60 בקשות בדקה ו-5,000 ביום (היום מתאפס בחצות UTC). מעבר לכך התשובה היא 429 עם Retry-After בשניות. מסמכים נספרים במסלול של העסק כמו מסמכים שהופקו באפליקציה.

בדיקות

צרו מפתח בדיקה (qik_test_...) באותו מסך: הוא עובד בכל מסלול, ושום דבר שהוא עושה אינו אמיתי. הבקשות נבדקות בדיוק כמו עם מפתח חי, כך שסכום שגוי או מספר עוסק חסר נכשלים באותה צורה, אבל לא נוצר מסמך בעסק, לא נצרך מספר, לא פונים לרשות המסים, לא נשלח מייל ולא נוסף לקוח. למסמך בדיקה אין PDF (pdfUrl הוא null), המספור שלו מתחיל מ-1 לכל סוג, אפשר לקרוא, לרשום, לשלוח ולבטל אותו כמו מסמך אמיתי, והוא נמחק אחרי 7 ימים. בבדיקה לא נשמרים לקוחות: הרשימה ריקה. GET /business מחזיר את העסק האמיתי. בכל תשובה יש "test": true. כשהכול עובד, מחליפים למפתח חי: שום דבר אחר לא משתנה.

בונים לכמה עסקים

בונים לכמה עסקים (סוכנות, קופה, מערכת הזמנות או חנויות)? פתחו משרד מפתחים באפליקציה: הגדרות → API למפתחים → משרד המפתחים. השם והלוגו שלו הם מה שהעסק רואה. שלחו לכל עסק את הקישור למפתחים של המשרד; בעל העסק מאשר באפליקציה שלו. אחר כך יוצרים את המפתחות של העסק מהמשרד, בלי להיכנס לאפליקציה שלו. כל מפתח פועל לעסק אחד בלבד, בשם בעל העסק: המסמכים שלו נושאים את השם והמספור של אותו עסק, והמגבלות ויומן הבקשות שלו נפרדים. שמרו בשרת מפתח לכל עסק, ופנו לכל עסק עם המפתח שלו. מפתחות בדיקה עובדים באותה צורה.

מפתח שנוצר במשרד מפתחים מפסיק לעבוד מיד (401 unauthorized) כשבעל העסק מנתק את המשרד, כשהמשרד משחרר את העסק, או כשאחד החשבונות חסום. חיבור חדש צריך מפתח חדש.

המשרד יכול גם לשלם על המסלולים של העסקים שלו: מסמנים אותם בעמוד החיוב של המשרד. עסק שאתם משלמים עליו מקבל את המסלול עם ה-API, ואתם מקבלים חשבון אחד בחודש, שמחויב ב-1 לחודש בכרטיס של אחד העסקים שלכם, על העסקים שהפיקו מסמכים באותו חודש. המחיר לכל עסק, לחודש, לפני מע״מ, וכל אחד כולל 100 מסמכים (מעבר לכך, המדרגות של המסלול). ככל שיש יותר עסקים, המחיר יורד לעסקים שמעבר לכל מדרגה. מחירון

גרסאות

/v1 משתנה רק בתוספות: שדות, נקודות קצה וקודי שגיאה חדשים. התעלמו משדות שאינכם מכירים. כל שינוי שעלול לשבור קוד קיים יגיע ב-/v2, עם הודעה של חצי שנה מראש במייל לכל בעלי המפתחות.

עזרה

כתבו ל[email protected] עם ה-request-id של הבקשה. יומן הבקשות בהגדרות → API מציג את 30 הימים האחרונים של כל מפתח.

מדריך נקודות הקצה

GET /v1/business

The business, its VAT status and what it may make. Call it first: it says which document types the business makes and when an invoice needs an approval number. Needs no scope.

GET /v1/documents

List documents, newest first. Scope: documents:read.

פרמטרים

namein
typequery
fromqueryFirst day, Israel time.
toqueryLast day, Israel time.
customerqueryA customer's id.
pagequery
perPagequery

POST /v1/documents

Make a document. Made exactly as the Quickly Invoice app makes it: the business's numbering, its plan limit, and an approval number from the Tax Authority for a tax_invoice or invoice_receipt from the threshold up (see GET /business). Scope: documents:write.

פרמטרים

namein
Idempotency-KeyheaderAny unique string (8 to 255 characters), e.g. your order id. Sending the same request again with the same key answers the first answer (for 24 hours) and never makes a second document.

גוף הבקשה

{
  "type": "receipt",
  "customer": {
    "externalId": "shop-1842",
    "name": "Dana Levi",
    "phone": "0501234567",
    "email": "[email protected]"
  },
  "items": [
    {
      "description": "Haircut",
      "quantity": 1,
      "price": 100
    }
  ],
  "payments": [
    {
      "method": "credit_card",
      "amount": 100,
      "cardLast4": "4242"
    }
  ],
  "send": {
    "email": "[email protected]"
  }
}

תשובה (201)

{
  "id": "6ae7ad705b41bf815c641079",
  "type": "receipt",
  "typeCode": "400",
  "number": 1043,
  "date": "2026-11-01",
  "status": "issued",
  "customer": {
    "id": "6ae7aa88a8bda9fb93c58e1c",
    "name": "Dana Levi",
    "taxId": null,
    "companyName": null
  },
  "items": [
    {
      "description": "Haircut",
      "quantity": 1,
      "unitPrice": 100,
      "vatIncluded": true
    }
  ],
  "discount": 0,
  "total": 100,
  "vat": 15.25,
  "totalBeforeVat": 84.75,
  "currency": "ILS",
  "payments": [
    {
      "method": "credit_card",
      "amount": 100,
      "date": "2026-11-01"
    }
  ],
  "approvalNumber": null,
  "approvalNumberStatus": "not_needed",
  "note": null,
  "pdfUrl": "https://api.zenat.app/customer/document/pdf/6ae7ad705b41bf815c641079",
  "shareUrl": null,
  "createdAt": "2026-11-01T12:00:00.000Z"
}

GET /v1/documents/{id}

Read a document. Scope: documents:read.

פרמטרים

namein
idpathThe document's id.

תשובה (200)

{
  "id": "6ae7ad705b41bf815c641079",
  "type": "receipt",
  "typeCode": "400",
  "number": 1043,
  "date": "2026-11-01",
  "status": "issued",
  "customer": {
    "id": "6ae7aa88a8bda9fb93c58e1c",
    "name": "Dana Levi",
    "taxId": null,
    "companyName": null
  },
  "items": [
    {
      "description": "Haircut",
      "quantity": 1,
      "unitPrice": 100,
      "vatIncluded": true
    }
  ],
  "discount": 0,
  "total": 100,
  "vat": 15.25,
  "totalBeforeVat": 84.75,
  "currency": "ILS",
  "payments": [
    {
      "method": "credit_card",
      "amount": 100,
      "date": "2026-11-01"
    }
  ],
  "approvalNumber": null,
  "approvalNumberStatus": "not_needed",
  "note": null,
  "pdfUrl": "https://api.zenat.app/customer/document/pdf/6ae7ad705b41bf815c641079",
  "shareUrl": null,
  "createdAt": "2026-11-01T12:00:00.000Z"
}

GET /v1/documents/{id}/pdf

Redirect to the document's PDF. Answers 302 to the PDF, which opens without a key (the link the app shares). Scope: documents:read.

פרמטרים

namein
idpathThe document's id.

POST /v1/documents/{id}/send

Email the document's PDF. Scope: documents:write.

פרמטרים

namein
idpathThe document's id.
Idempotency-KeyheaderAny unique string (8 to 255 characters), e.g. your order id. Sending the same request again with the same key answers the first answer (for 24 hours) and never makes a second document.

גוף הבקשה

{
  "email": "[email protected]",
  "name": "Dana"
}

POST /v1/documents/{id}/cancel

Cancel a document. Makes the credit document for it, as the app does, and answers both. Quotes, orders, transaction invoices and credit invoices cannot be cancelled. Scope: documents:write.

פרמטרים

namein
idpathThe document's id.
Idempotency-KeyheaderAny unique string (8 to 255 characters), e.g. your order id. Sending the same request again with the same key answers the first answer (for 24 hours) and never makes a second document.

GET /v1/customers

List customers. Scope: customers:read.

פרמטרים

namein
searchqueryPart of a name, phone or email.
externalIdqueryYour system's id.
pagequery
perPagequery

POST /v1/customers

Add a customer. A customer with the same externalId or phone is not added twice: the answer is the existing one (200, existing: true). Scope: customers:write.

פרמטרים

namein
Idempotency-KeyheaderAny unique string (8 to 255 characters), e.g. your order id. Sending the same request again with the same key answers the first answer (for 24 hours) and never makes a second document.

גוף הבקשה

{
  "name": "Dana Levi",
  "phone": "0501234567",
  "externalId": "shop-1842"
}

GET /v1/customers/{id}

Read a customer. Scope: customers:read.

פרמטרים

namein
idpathThe customer's id.

תשובה (200)

{
  "id": "6ae7aa88a8bda9fb93c58e1c",
  "name": "Dana Levi",
  "phone": "+972501234567",
  "email": "[email protected]",
  "taxId": null,
  "companyName": null,
  "address": null,
  "externalId": "shop-1842",
  "createdAt": "2026-11-01T12:00:00.000Z"
}