ה-API של Docuro למפתחים
חברו את התוכנה שלכם ל-Docuro: קריאת מסמכים ותשלומים, שליחת מסמכים, ויצירה או הפקה של חשבוניות לחברה אחת. כל מפתח שייך לחשבון אחד ולעולם לא יכול להגיע לחשבון אחר.
גרסת API 1.15.0 · openapi.json
אימות
בעל החשבון יוצר מפתחות בהגדרות → מפתחות API ובוחר מה כל מפתח רשאי לעשות. מפתח מוצג פעם אחת; שלחו אותו בכל בקשה כ-Bearer token. למפתח אפשר לקבוע תאריך תפוגה ואפשר לבטל אותו בכל רגע.
Authorization: Bearer sf_live_…
הרשאות (scopes)
כל endpoint דורש הרשאה אחת (הסיכום החודשי דורש שתיים). מפתח מקבל רק את ההרשאות שסומנו כשנוצר.
יש שני סוגי מפתחות. מפתח לכל החשבון קורא מסמכים, תשלומים וקבצים ויכול לשלוח מסמכים לתיבה (read:documents, read:payments, read:files, documents:write). מפתח חברה שייך לחברה אחת בדיוק בחשבון, שנבחרת כשהמפתח נוצר, ונושא רק invoices:write ו/או invoices:read: הוא לעולם לא יכול לקרוא או להפיק חשבוניות של חברה אחרת. מפתח אחד אף פעם אינו שניהם.
read:documents— מסמכים והפרטים שלהם (כל החשבון)read:payments— תשלומים מהבנק, הסטטוס שלהם והמסמכים המקושרים (כל החשבון)read:files— קישורים זמניים לקבצים המקוריים (כל החשבון)documents:write— שליחת מסמכים לחשבון הזה, כמו העלאה (חשבוניות, קבלות, דפי חשבון) (כל החשבון)invoices:write— הפקת חשבוניות לחברה שנבחרה (אותן בדיקות כמו באפליקציה) (חברה אחת, שנבחרה במפתח)invoices:read— קריאת הסטטוס של החשבוניות של החברה שנבחרה (חברה אחת, שנבחרה במפתח)
POST /api/v1/invoices שומר כברירת מחדל טיוטה: בלי מספר, ושום דבר לא נשלח. הוסיפו "issue": true כדי להפיק את החשבונית; "send": true עובד רק יחד עם "issue": true.
שדות חשבונית למערכות הזמנות
לחברה רומנית, POST /api/v1/invoices מקבל גם: "series" (קוד הסדרה, למשל "REPS"), "issueDate" (היום או יום קרוב בעבר; לעולם לא יום עתידי), "deliveryDate", "notes" (מודפס מתחת לסכומים ונשלח כהערה ב-e-Factura, למשל פרטי ההזמנה), "language" ("ro" או "en", למסמך המודפס), "paid" (תשלום שכבר נגבה: אמצעי כרטיס, מזומן או העברה בנקאית, תאריך וסכום; מודפס כנגבה) ו-"contactName" ו-"phone" של הקונה. אדם פרטי אינו צריך מיקוד, וגם לא קונה שהוא חברה מחוץ לרומניה (לקונה בחו״ל המיקוד אינו חובה; לא שולחים מיקוד מומצא). קונה שהוא חברה רומנית עדיין צריך מיקוד. כל חשבונית שהונפקה מחזירה "pdfUrl", קישור ל-PDF שלה התקף ל-5 דקות.
Endpoints
התיעוד שלמטה באנגלית ומגיע ישירות מקובץ ה-OpenAPI.
GET/api/v1/documents
List documents
הרשאה: read:documents
Documents of the account (deleted ones excluded unless filtered by status), ordered by id. Scope: `read:documents`.
תשובות
200A page of documents400401403429
POST/api/v1/documents
Send documents into the account
הרשאה: documents:write
Stores one or more files in the key's account through the same intake as an upload in the app (same accepted types: PDF, images, CSV/Excel/XML/ZIP; same size and count limits; a request body of at most 100 MiB) and queues them for processing; the documents appear in `GET /documents` once processed. Optional header `Idempotency-Key`: the same key with the same files returns the first request (200), with other files 409. Scope: `documents:write`.
תשובות
200The same Idempotency-Key and files again: the first request (`replayed: true`, `data.inboundId`)202Stored and queued for processing400Invalid body (`invalid_request`, `invalid_json`, `invalid_multipart`, `invalid_base64`, `no_file`), bad `Idempotency-Key` (`invalid_idempotency_key`), or a `businessId` / `bankLineId` not of this account (`unknown_business`, `unknown_bank_line`)401403409`idempotency_key_reused`: this key was already used for different files413`file_too_large` or `too_many_files`, or `request_too_large`: the whole request body is over 100 MiB (`max` in bytes; send the rest in another request)415`unsupported_type` (file) or `unsupported_media_type` (body: not multipart or JSON)429Too many requests: the per-key limit or the separate write limit (`X-RateLimit-Write-*`)
GET/api/v1/documents/{id}
One document
הרשאה: read:documents
404 when the id does not exist or belongs to another account. Scope: `read:documents`.
תשובות
200The document401403404429
GET/api/v1/documents/{id}/file
Short-lived link to the original file
הרשאה: read:files
Returns a signed URL valid for 5 minutes. Fetching that URL needs no API key. 404 when the document has no file. Scope: `read:files`.
תשובות
200Signed link401403404429503File links are not configured on this deployment
GET/api/v1/files/{token}
Download a file by signed link
הרשאה: ללא (קישור חתום וקצר מועד)
The URL returned by `/documents/{id}/file`. The link itself is the credential.
תשובות
200The original file403Invalid link404410Link expired — request a new one
GET/api/v1/payments
Bank payments with match status
הרשאה: read:payments
Bank-statement lines with their match status and the ids of the documents they are matched to, ordered by id. Unmatched lines are reported as `missing` (money out), `income` (money in) or `fee` (0.00: no money moved, no document asked); the `status` filter uses the same rule. Scope: `read:payments`.
תשובות
200A page of payments400401403429
GET/api/v1/periods/{period}/summary
Month summary: counts, totals, VAT, what is missing
הרשאה: read:documents + read:payments
Scopes: `read:documents` and `read:payments`. Lists in `missing` are capped at 500 items (`truncated: true`); use the list endpoints for the rest.
תשובות
200The summary400401403429
GET/api/v1/invoices
List the company's invoices
הרשאה: invoices:read
The key's company's invoices (never another company's), oldest first, paged. Scope: `invoices:read`.
תשובות
200A page of invoices400401403422`company_cannot_issue`: the key's company does not issue invoices in the app429
POST/api/v1/invoices
Save a draft or issue an invoice
הרשאה: invoices:write
Since 1.8.0 saves a DRAFT for the key's company by default (no number, nothing sent); with `"issue": true` issues it with the same checks as issuing in the app and returns its number. Header `Idempotency-Key` required: on a draft the same key updates that draft, and the same key with `"issue": true` issues it. With `send: true` (only together with `issue: true`) it is also queued for the company's e-invoicing authority where the country uploads e-invoices. Scope: `invoices:write`.
תשובות
200The same Idempotency-Key again: a draft updated with this content, or (issued) the invoice issued the first time (`replayed: true`, `sendQueued: false`)201Draft saved, or issued now400Missing or malformed `Idempotency-Key` (`idempotency_key_required`), body is not JSON (`invalid_json`) or not a valid invoice (`invalid_request`, with `issues`: each wrong field's `path` and `message`), or `send: true` without `issue: true` (`invalid_request`)401403409`idempotency_key_reused`: this key was already used for a different invoice (also when another request with this key and other content was issued at the same moment)422Refused by the issuing rules; nothing was numbered and no draft is left (a draft request, without `issue: true`, is not refused for its buyer's data alone: a missing or invalid tax id, a missing postal code or VAT status save the draft as sent, those fields listed for the owner to complete in the app, with `warnings: ["buyer_incomplete"]`; it cannot be issued until they are); the same `Idempotency-Key` can be retried with corrected content. `error` is the rule (e.g. `vat_rate`, `buyer_tax_id`, `buyer_vat`, `currency_unsupported`, `efactura_rules` with `issues`, `seller_profile_missing` with `detail.missing` (the seller fields to complete in Settings, e.g. `shareCapital` for a Romanian SRL), `account_currency` with `detail.currency` and `detail.currencies` (no company account in the invoice's currency), `no_series`, `fx_rate_missing`, `company_cannot_issue`, since 1.15.0 `vat_on_cash_affiliated` with `message` and `detail.field` = `buyerAffiliated`: say whether the buyer is affiliated with the company).429Too many requests: the per-key limit or the separate write limit (`X-RateLimit-Write-*`)
GET/api/v1/invoices/{id}
Status of one invoice
הרשאה: invoices:read
The invoice with its number and e-invoice status. 404 when the id does not exist or belongs to another company. Scope: `invoices:read`.
תשובות
200The invoice (no `sendQueued`, no `replayed`)401403404422`company_cannot_issue`: the key's company does not issue invoices in the app429
GET/api/v1/invoice-pdf/{token}
Download an invoice PDF by signed link
הרשאה: ללא (קישור חתום וקצר מועד)
The `pdfUrl` of an invoice. The link itself is the credential, for that one invoice only; it expires after 5 minutes and stops working when the API key it was made for is revoked or expires (403 `link_key_revoked`). At most 20 openings per minute per invoice (429). The first output of an Israeli invoice is the original ("מקור"), every later one "העתק נאמן למקור". A HEAD request or a known link-preview fetcher (User-Agent containing WhatsApp/, facebookexternalhit, TelegramBot, Slackbot, Twitterbot, LinkedInBot or Discordbot) gets 403 `preview` and never produces the PDF, so it never uses up the original.
תשובות
200The invoice PDF403Invalid link, its API key was revoked or expired (`link_key_revoked`), or a HEAD / link-preview request (`preview`, nothing produced)404410Link expired — read the invoice again for a new one429503`pdf_unavailable`: the PDF cannot be produced right now; try again later
שגיאות
שגיאות מוחזרות כ-JSON עם קוד "error" ולפי הצורך "message" או "issues". 400 בקשה לא תקינה, 401 מפתח חסר או מבוטל, 403 חסרה הרשאה או שהמסלול לא כולל API, 404 לא נמצא (או שייך לחשבון אחר), 409 שימוש חוזר ב-Idempotency-Key עם תוכן אחר, 413/415 קובץ גדול מדי או מסוג לא נתמך, 422 נדחה לפי כללי החשבוניות, 429 יותר מדי בקשות.
HTTP/1.1 403
{ "error": "insufficient_scope" }מגבלות קצב
הבקשות נספרות לכל מפתח בכל דקה (ברירת מחדל 120) ומדווחות בכותרות X-RateLimit-*. כתיבות (שליחת מסמכים, שמירה או הפקה של חשבוניות) נספרות גם במגבלה נפרדת ונמוכה יותר (ברירת מחדל 30 לדקה, כותרות X-RateLimit-Write-*). מעבר למגבלה התשובה היא 429 עם Retry-After.
גוף של בקשה אחת יכול להיות עד 100 MiB בסך הכול (כל הקבצים יחד; base64 ב-JSON גדול בערך בשליש). בקשה גדולה יותר נדחית עם 413 request_too_large לפני שהיא נקראת: שלחו את השאר בבקשה נוספת. לכל קובץ יש גם מגבלת גודל משלו, כמו בהעלאה באפליקציה.
Idempotency (שליחה חוזרת בטוחה)
שלחו כותרת Idempotency-Key (8–64 תווים: אותיות, ספרות, . _ : -; UUID מתאים). היא חובה ב-POST /invoices ומומלצת ב-POST /documents. אותו מפתח עם אותו תוכן מחזיר את התוצאה הראשונה (200) במקום ליצור משהו חדש; אותו מפתח עם תוכן אחר נדחה עם 409. בחשבונית טיוטה, אותו מפתח עם תוכן חדש מעדכן את הטיוטה, ונשלח שוב עם "issue": true מפיק אותה. בקשה שנדחתה לא משאירה כלום, כך שאפשר לשלוח שוב את אותו מפתח עם תוכן מתוקן.
דוגמאות (curl)
רשימת המסמכים של החודש
curl -H "Authorization: Bearer $SF_KEY" \ "https://app.scaleflow.ro/api/v1/documents?period=2026-11&limit=50"
שליחת קובץ (multipart), בטוח לשליחה חוזרת עם אותו Idempotency-Key
curl -X POST -H "Authorization: Bearer $SF_KEY" \ -H "Idempotency-Key: 6f1c2b7e-scan-0001" \ -F "file=@invoice.pdf" -F "kind=document" \ https://app.scaleflow.ro/api/v1/documents
שליחת קובץ כ-JSON (base64)
curl -X POST -H "Authorization: Bearer $SF_KEY" -H "Content-Type: application/json" \
-d '{"files":[{"fileName":"receipt.pdf","contentBase64":"JVBERi0xLjQK..."}]}' \
https://app.scaleflow.ro/api/v1/documentsשמירת חשבונית כטיוטה (ברירת המחדל)
curl -X POST -H "Authorization: Bearer $SF_INVOICE_KEY" -H "Content-Type: application/json" \
-H "Idempotency-Key: order-1042" \
-d '{"buyer":{"type":"b2c","name":"Guest name","street":"Street 1","city":"Bucharest","postalCode":"010101","country":"RO"},"lines":[{"description":"Room","qty":"2","unitPrice":"350","vat":"S:21"}],"currency":"RON"}' \
https://app.scaleflow.ro/api/v1/invoicesהפקת אותה חשבונית (אותו מפתח, "issue": true) ושליחה ל-e-Factura (חברות ברומניה)
curl -X POST -H "Authorization: Bearer $SF_INVOICE_KEY" -H "Content-Type: application/json" \
-H "Idempotency-Key: order-1042" \
-d '{"buyer":{...},"lines":[...],"currency":"RON","issue":true,"send":true}' \
https://app.scaleflow.ro/api/v1/invoicesהנפקת חשבונית מלון (קוד סדרה, הערות, תשלום שנגבה)
curl -X POST -H "Authorization: Bearer $SF_INVOICE_KEY" -H "Content-Type: application/json" \
-H "Idempotency-Key: booking-71879242" \
-d '{"series":"REPS","buyer":{"type":"b2c","name":"Jane Doe","street":"…","city":"…","country":"GB","phone":"+44…"},"lines":[...],"currency":"RON","notes":"Hostaway ID: 71879242\nBooked via: Booking.com","paid":{"method":"card","date":"2026-11-18","amount":"450.00"},"language":"en","issue":true}' \
https://app.scaleflow.ro/api/v1/invoicesמחירים כולל מע"מ: הסכום כולל המע"מ יהיה בדיוק מה ששלחתם (350.00 ב-11%: 315.32 + 34.68)
curl -X POST -H "Authorization: Bearer $SF_INVOICE_KEY" -H "Content-Type: application/json" \
-H "Idempotency-Key: booking-1001" \
-d '{"buyer":{...},"pricesIncludeVat":true,"lines":[{"description":"Accommodation","qty":"1","unitPrice":"350","vat":"S:11"}],"currency":"RON"}' \
https://app.scaleflow.ro/api/v1/invoicesסטטוס של חשבונית, כולל מצב e-Factura
curl -H "Authorization: Bearer $SF_INVOICE_KEY" https://app.scaleflow.ro/api/v1/invoices/INVOICE_ID
