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.
What a key can call
Section titled “What a key can call”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.
Prerequisites
Section titled “Prerequisites”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.
Authentication
Section titled “Authentication”Send the key with every request:
Authorization: Bearer ak_your_keyor
X-API-Key: ak_your_keyThe 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.
Issuing an invoice
Section titled “Issuing an invoice”- Make sure the buyer exists as a business partner.
- Create the invoice as a draft, with an
externalRef. - Finalize it.
- Fiscalize it (optional, for fiscal receipts).
- Send it to SEF (optional, for eFaktura).
- 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.
1. Business partner
Section titled “1. Business partner”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:
curl "https://api.anybiz.rs/api/settings/business-partners?search=101234567" \ -H "Authorization: Bearer ak_your_key"Create it when missing:
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" }'2. Create the invoice
Section titled “2. Create the invoice”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:
| Field | Values |
|---|---|
type | invoice, receipt, credit_note |
processingKind | basic (no fiscal or SEF), fiscalization, efaktura |
invoiceType | fiscal type code: 0 normal, 1 proforma, 2 copy, 3 training, 4 advance |
transactionTypeNumeric | 0 sale, 1 refund |
payments[].paymentType | 0 other, 1 cash, 2 card, 3 cheque, 4 wire transfer, 5 voucher, 6 mobile money |
items[].tax | VAT rate as "0", "10" or "20", or a tax label from the organization’s fiscal device |
items[].unit | kom, kg, g, l, ml, m, m2, m3, h, dan, par, pak |
items[].gtin | the 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.
3. Finalize
Section titled “3. Finalize”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:
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": [...] }.
4. Fiscalize (optional)
Section titled “4. Fiscalize (optional)”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.
5. Send to SEF (optional)
Section titled “5. Send to SEF (optional)”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:
| Code | Meaning |
|---|---|
INVALID_STATE | not finalized yet |
INVALID_DIRECTION | a purchase invoice |
BUYER_TIN_REQUIRED | no buyerTin on the invoice |
BUYER_NOT_FOUND | no business partner with that TIN (step 1) |
INVALID_BUYER_COMPANY_ID | the partner’s matični broj is not 8 or 13 digits |
NO_ITEMS | the invoice has no items |
MISSING_PAYEE_FINANCIAL_ACCOUNT | the 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.
6. Poll the job
Section titled “6. Poll the job”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.
Errors
Section titled “Errors”| Status | Meaning |
|---|---|
401 | missing, revoked or expired key |
403 | the feature is not enabled for the organization, or the action needs a user session |
422 | validation failed; the message names the field or the missing setting |
429 | rate 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.
Checklist for going live
Section titled “Checklist for going live”- One
externalRefper invoice in your system, never reused. - Retry only on network errors and
5xx; on429waitRetry-After. - Treat
existing: trueon create as success and continue with the returnedid. - 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.