Skip to content

External integrations

An external system calls the same HTTP API as the AnyBiz apps. That can be an ERP, a web shop, an accounting tool, or any other backend. Authenticate with an organization API key. Every endpoint is in the API reference.

The key acts as the owner who created it, inside that one organization, so it can call whatever that owner can: organization, partners, invoices, settings, and the rest of the reference. It cannot create or revoke API keys, and it does not work on /api/auth/*.

Keep the key on your server. Never ship it to a browser.

The rest of this page is one complete flow: issuing a sales invoice, then fiscalizing it or sending it to SEF. Other calls use the same key and the same error rules.

Done once, in the AnyBiz app, by the organization:

  • Settings → API keys: an organization owner creates a key for your system. It is shown once. See Authentication.
  • Settings → SEF: eFaktura base URL and API key, if you will send invoices to SEF.
  • Settings → Organization: registered name, address and bank account (IBAN). SEF refuses a sales invoice without the payee account.
  • Settings → Fiscalization: SDC type and endpoint, if you will fiscalize receipts.
  • The organization’s plan has the eFaktura and/or fiscalization feature enabled.

Your system needs the base URL of the deployment, for example https://api.anybiz.rs/api, and the key.

Send the key with every request:

Terminal window
Authorization: Bearer ak_your_key

or

Terminal window
X-API-Key: ak_your_key

The key acts as the owner who created it and is bound to one organization. Requests are limited per key, by default to 300 per minute; a refused request returns 429 with a Retry-After header. Keys cannot create or revoke keys.

  1. Make sure the buyer exists as a business partner.
  2. Create the invoice as a draft, with an externalRef.
  3. Finalize it.
  4. Fiscalize it (optional, for fiscal receipts).
  5. Send it to SEF (optional, for eFaktura).
  6. Poll the job until it completes, then read the invoice.

Fiscalization and SEF are asynchronous: the API validates, enqueues a job and returns a jobId. A worker does the actual call.

SEF needs the buyer’s PIB (TIN) and matični broj (company registration number, 8 or 13 digits). The invoice only carries the TIN; the partner row supplies the rest, so it must exist before you send to SEF.

Look the partner up by TIN first:

Terminal window
curl "https://api.anybiz.rs/api/settings/business-partners?search=101234567" \
-H "Authorization: Bearer ak_your_key"

Create it when missing:

Terminal window
curl -X POST "https://api.anybiz.rs/api/settings/business-partners" \
-H "Authorization: Bearer ak_your_key" \
-H "Content-Type: application/json" \
-d '{
"roles": ["customer"],
"name": "Kupac d.o.o.",
"tin": "101234567",
"companyId": "12345678",
"address": "Bulevar 1, Beograd",
"email": "racuni@kupac.rs"
}'
Terminal window
curl -X POST "https://api.anybiz.rs/api/pos/invoices" \
-H "Authorization: Bearer ak_your_key" \
-H "Content-Type: application/json" \
-d '{
"externalRef": "ORD-2026-000123",
"type": "invoice",
"state": "draft",
"issuedAt": "2026-11-01T10:00:00Z",
"processingKind": "efaktura",
"buyerTin": "101234567",
"invoiceType": 0,
"transactionTypeNumeric": 0,
"amount": "1200.00",
"payments": [{ "paymentType": 4, "amount": 1200 }],
"items": [
{
"gtin": "SKU-001",
"itemName": "Consulting hour",
"quantity": 10,
"unitPrice": 120,
"totalAmount": 1200,
"tax": "20",
"unit": "h"
}
]
}'

The response carries the invoice id. Keep it; every later call uses it.

Idempotency. externalRef is your own id for the invoice, unique per organization. If a call times out and you repeat it with the same externalRef, the API returns the invoice it already created, with existing: true, instead of making a second one. Always send it.

Field values:

FieldValues
typeinvoice, receipt, credit_note
processingKindbasic (no fiscal or SEF), fiscalization, efaktura
invoiceTypefiscal type code: 0 normal, 1 proforma, 2 copy, 3 training, 4 advance
transactionTypeNumeric0 sale, 1 refund
payments[].paymentType0 other, 1 cash, 2 card, 3 cheque, 4 wire transfer, 5 voucher, 6 mobile money
items[].taxVAT rate as "0", "10" or "20", or a tax label from the organization’s fiscal device
items[].unitkom, kg, g, l, ml, m, m2, m3, h, dan, par, pak
items[].gtinthe product code or GTIN as it should print on the receipt

amount is recomputed from the items when items are present. Serbia allows 0, 10 and 20 percent VAT only.

Terminal window
curl -X POST "https://api.anybiz.rs/api/pos/invoices/{id}/finalize" \
-H "Authorization: Bearer ak_your_key" \
-H "Content-Type: application/json" -d '{}'

Returns { "success": true } or { "success": false, "error": { "code", "message" } }. An invoice needs at least one item to finalize. After this it can no longer be edited, only cancelled.

Before step 4 or 5 you can ask what the invoice is still missing:

Terminal window
curl "https://api.anybiz.rs/api/pos/invoices/{id}/actions" \
-H "Authorization: Bearer ak_your_key"

Each of sendToSef and fiscalize is { "ok": true } or { "ok": false, "missingFields": [...] }.

Terminal window
curl -X POST "https://api.anybiz.rs/api/pos/invoices/{id}/fiscalize" \
-H "Authorization: Bearer ak_your_key" \
-H "Content-Type: application/json" -d '{}'

Returns { "accepted": true, "jobId": "..." }. The SDC type and endpoint come from the organization’s fiscalization settings. Only an SDC the server can reach (V-SDC, or an E-SDC on a routable address) works from the API; a device on a shop LAN is fiscalized from the desktop app.

Terminal window
curl -X POST "https://api.anybiz.rs/api/pos/invoices/{id}/send-sef" \
-H "Authorization: Bearer ak_your_key" \
-H "Content-Type: application/json" -d '{}'

Returns { "accepted": true, "jobId": "..." } when enqueued, or { "success": false, "error": { "code", "message" } } when the invoice cannot be sent at all. Codes you should handle:

CodeMeaning
INVALID_STATEnot finalized yet
INVALID_DIRECTIONa purchase invoice
BUYER_TIN_REQUIREDno buyerTin on the invoice
BUYER_NOT_FOUNDno business partner with that TIN (step 1)
INVALID_BUYER_COMPANY_IDthe partner’s matični broj is not 8 or 13 digits
NO_ITEMSthe invoice has no items
MISSING_PAYEE_FINANCIAL_ACCOUNTthe organization has no bank account (IBAN) under Settings → Organization

A 422 whose message mentions eFaktura configuration means the organization has no SEF base URL or API key under Settings → SEF.

Terminal window
curl "https://api.anybiz.rs/api/pos/jobs/{jobId}" \
-H "Authorization: Bearer ak_your_key"

Returns { "state": "created" | "active" | "completed" | "failed", "result", "error" }, or null once the job has been archived. Poll every few seconds; SEF itself is throttled to three requests per second per organization, so a burst of invoices completes one after another.

For a SEF job, result is { "success": true, "efakturaInvoiceId": 123 } or { "success": false, "error": { "code", "message" } }. The invoice list (GET /pos/invoices) shows sefInvoiceId on each row, and GET /pos/invoices/{id} shows the fiscal fields (fiscalNumber, fiscalQrCode, fiscalStatus) after fiscalization.

StatusMeaning
401missing, revoked or expired key
403the feature is not enabled for the organization, or the action needs a user session
422validation failed; the message names the field or the missing setting
429rate limit; wait Retry-After seconds

Business failures inside a step (finalize, send to SEF, a job) come back as 200 with success: false and an error.code, so check both.

  • One externalRef per invoice in your system, never reused.
  • Retry only on network errors and 5xx; on 429 wait Retry-After.
  • Treat existing: true on create as success and continue with the returned id.
  • Do not cancel a fiscalized invoice from your system without a matching refund receipt; use the app for corrections.
  • Keep the key on your server. Never ship it to a browser.