Nou: potrivire automată între extrasul de cont și facturi — fără să mai alergi după chitanțe.
Docuro by ScaleFlow
Începeți gratuit

API Docuro pentru dezvoltatori

Conectați propriul program la Docuro: citiți documente și plăți, trimiteți documente și creați sau emiteți facturi pentru o firmă. Fiecare cheie aparține unui singur cont și nu poate ajunge niciodată la alt cont.

Versiunea API 1.15.0 · openapi.json

Autentificare

Titularul contului creează cheile în Setări → Chei API și alege ce poate face fiecare cheie. O cheie este afișată o singură dată; trimiteți-o în fiecare cerere ca token Bearer. O cheie poate avea o dată de expirare și poate fi revocată oricând.

Authorization: Bearer sf_live_…

Permisiuni (scopes)

Fiecare endpoint cere o permisiune (rezumatul lunar cere două). O cheie primește doar permisiunile bifate la creare.

Există două tipuri de chei. O cheie pentru tot contul citește documente, plăți și fișiere și poate trimite documente în inbox (read:documents, read:payments, read:files, documents:write). O cheie de firmă aparține exact unei firme din cont, aleasă la crearea cheii, și are doar invoices:write și/sau invoices:read: nu poate citi sau emite niciodată facturile altei firme. O cheie nu este niciodată ambele.

POST /api/v1/invoices salvează implicit o CIORNĂ: fără număr, nimic trimis. Adăugați "issue": true pentru a emite factura; "send": true funcționează doar împreună cu "issue": true.

Câmpuri de factură pentru sisteme de rezervări

Pentru o firmă din România, POST /api/v1/invoices acceptă și: "series" (codul seriei, de ex. "REPS"), "issueDate" (azi sau o zi recentă din trecut; niciodată o zi viitoare), "deliveryDate", "notes" (tipărite sub totaluri și trimise ca mențiune în e-Factura, de ex. referințele rezervării), "language" ("ro" sau "en", pentru documentul tipărit), "paid" (o plată deja încasată: metoda card, numerar sau transfer bancar, data și suma; tipărită ca încasată) și "contactName" și "phone" ale cumpărătorului. O persoană fizică nu are nevoie de cod poștal și nici un cumpărător persoană juridică din afara României (pentru un cumpărător din străinătate codul poștal este opțional; nu trimiteți un cod inventat). Un cumpărător persoană juridică din România are în continuare nevoie de cod poștal. Fiecare factură emisă întoarce "pdfUrl", un link valabil 5 minute către PDF-ul ei.

Endpointuri

Referința de mai jos este în engleză și provine direct din fișierul OpenAPI.

GET/api/v1/documents

List documents

Permisiune: read:documents

Documents of the account (deleted ones excluded unless filtered by status), ordered by id. Scope: `read:documents`.

Răspunsuri
  • 200 A page of documents
  • 400
  • 401
  • 403
  • 429

POST/api/v1/documents

Send documents into the account

Permisiune: 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`.

Răspunsuri
  • 200 The same Idempotency-Key and files again: the first request (`replayed: true`, `data.inboundId`)
  • 202 Stored and queued for processing
  • 400 Invalid 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`)
  • 401
  • 403
  • 409 `idempotency_key_reused`: this key was already used for different files
  • 413 `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)
  • 429 Too many requests: the per-key limit or the separate write limit (`X-RateLimit-Write-*`)

GET/api/v1/documents/{id}

One document

Permisiune: read:documents

404 when the id does not exist or belongs to another account. Scope: `read:documents`.

Răspunsuri
  • 200 The document
  • 401
  • 403
  • 404
  • 429

GET/api/v1/files/{token}

Download a file by signed link

Permisiune: niciuna (link semnat, valabil scurt timp)

The URL returned by `/documents/{id}/file`. The link itself is the credential.

Răspunsuri
  • 200 The original file
  • 403 Invalid link
  • 404
  • 410 Link expired — request a new one

GET/api/v1/payments

Bank payments with match status

Permisiune: 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`.

Răspunsuri
  • 200 A page of payments
  • 400
  • 401
  • 403
  • 429

GET/api/v1/periods/{period}/summary

Month summary: counts, totals, VAT, what is missing

Permisiune: 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.

Răspunsuri
  • 200 The summary
  • 400
  • 401
  • 403
  • 429

GET/api/v1/invoices

List the company's invoices

Permisiune: invoices:read

The key's company's invoices (never another company's), oldest first, paged. Scope: `invoices:read`.

Răspunsuri
  • 200 A page of invoices
  • 400
  • 401
  • 403
  • 422 `company_cannot_issue`: the key's company does not issue invoices in the app
  • 429

POST/api/v1/invoices

Save a draft or issue an invoice

Permisiune: 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`.

Răspunsuri
  • 200 The same Idempotency-Key again: a draft updated with this content, or (issued) the invoice issued the first time (`replayed: true`, `sendQueued: false`)
  • 201 Draft saved, or issued now
  • 400 Missing 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`)
  • 401
  • 403
  • 409 `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)
  • 422 Refused 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).
  • 429 Too many requests: the per-key limit or the separate write limit (`X-RateLimit-Write-*`)

GET/api/v1/invoices/{id}

Status of one invoice

Permisiune: 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`.

Răspunsuri
  • 200 The invoice (no `sendQueued`, no `replayed`)
  • 401
  • 403
  • 404
  • 422 `company_cannot_issue`: the key's company does not issue invoices in the app
  • 429

GET/api/v1/invoice-pdf/{token}

Download an invoice PDF by signed link

Permisiune: niciuna (link semnat, valabil scurt timp)

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.

Răspunsuri
  • 200 The invoice PDF
  • 403 Invalid link, its API key was revoked or expired (`link_key_revoked`), or a HEAD / link-preview request (`preview`, nothing produced)
  • 404
  • 410 Link expired — read the invoice again for a new one
  • 429
  • 503 `pdf_unavailable`: the PDF cannot be produced right now; try again later

Erori

Erorile sunt JSON cu un cod „error” și, unde ajută, un „message” sau „issues”. 400 cerere invalidă, 401 cheie lipsă sau revocată, 403 permisiune lipsă sau planul nu include API, 404 negăsit (sau al altui cont), 409 Idempotency-Key refolosit cu alt conținut, 413/415 fișier prea mare sau de tip neacceptat, 422 refuzat de regulile de facturare, 429 prea multe cereri.

HTTP/1.1 403
{ "error": "insufficient_scope" }

Limite de cereri

Cererile se numără pe cheie, pe minut (implicit 120) și apar în antetele X-RateLimit-*. Scrierile (trimiterea de documente, salvarea sau emiterea facturilor) se numără și într-o limită separată, mai mică (implicit 30 pe minut, antetele X-RateLimit-Write-*). Peste limită răspunsul este 429 cu Retry-After.

Corpul unei cereri poate avea cel mult 100 MiB în total (toate fișierele împreună; base64 în JSON este cu aproximativ o treime mai mare). O cerere mai mare este refuzată cu 413 request_too_large înainte de a fi citită: trimiteți restul în altă cerere. Fiecare fișier are și propria limită de mărime, aceeași ca la o încărcare în aplicație.

Idempotență (reîncercări sigure)

Trimiteți antetul Idempotency-Key (8–64 caractere: litere, cifre, . _ : -; un UUID se potrivește). Este obligatoriu pentru POST /invoices și recomandat pentru POST /documents. Aceeași cheie cu același conținut întoarce primul rezultat (200) în loc să creeze ceva nou; aceeași cheie cu alt conținut este refuzată cu 409. La o factură ciornă, aceeași cheie cu conținut nou actualizează ciorna, iar trimisă din nou cu "issue": true o emite. O cerere refuzată nu lasă nimic în urmă, deci aceeași cheie poate fi trimisă din nou cu conținutul corectat.

Exemple (curl)

Documentele lunii curente

curl -H "Authorization: Bearer $SF_KEY" \
  "https://app.scaleflow.ro/api/v1/documents?period=2026-11&limit=50"

Trimiterea unui fișier (multipart), sigur de repetat cu același 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

Trimiterea unui fișier ca 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

Salvarea unei facturi ca ciornă (implicit)

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

Emiterea aceleiași facturi (aceeași cheie, "issue": true) și trimiterea în e-Factura (firme din România)

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

Emiterea unei facturi de hotel (codul seriei, mențiuni, plată încasată)

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

Prețuri cu TVA: totalul cu TVA este exact cel trimis (350,00 la 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

Starea unei facturi, inclusiv starea e-Factura

curl -H "Authorization: Bearer $SF_INVOICE_KEY" https://app.scaleflow.ro/api/v1/invoices/INVOICE_ID