Tezga API endpoints
12 endpoints in 4 groups, generated from the OpenAPI description (version 1.6.0). For the full contract of each endpoint, open the OpenAPI JSON in Swagger UI or Postman. Field names, enum values and error messages are in Serbian; the guide explains them.
Invoices
Issuing, cancellation and refund.
POST /api/integrations/orderIssue an invoice (or a pro forma)
Idempotent by externalId: a repeated request returns the existing document (status “postojalo”), never a second invoice. When the PFR rejects, the document is issued and the response is 202 with ok:false.
- Request
- JSON body, 1 parameter(s)
- Responses
- 200, 202, 400, 401, 402, 409, 413, 422, 429
- Authentication
- API key (X-Tezga-Api-Key)
POST /api/integrations/refundCancellation or refund
A fiscalised invoice is not changed: a NEW document is created that refers to the original. When the PFR rejects, 202; for a cancellation or full refund a repeated request sends the same refund, and do not repeat a refund by line items (Tezga retries fiscalisation by itself).
- Request
- JSON body
- Responses
- 200, 202, 402, 404, 409, 422
- Authentication
- API key (X-Tezga-Api-Key)
POST /api/integrations/advanceAdvance invoice and closing an advance
Without “zatvori”: an advance is created and АВАНС ПРОДАЈА is issued for the amount actually received, with the payment date. With “zatvori”: true, АВАНС РЕФУНДАЦИЈА and then ПРОМЕТ ПРОДАЈА for the full amount are created; if the refund does not pass the PFR, the final invoice is NOT issued. Idempotent by externalId.
- Request
- JSON body
- Responses
- 200, 202, 402, 404, 409, 422
- Authentication
- API key (X-Tezga-Api-Key)
POST /api/integrations/copyInvoice copy (КОПИЈА)
A new document that mirrors the original and refers to it. It goes to the PFR ONLY if the original was fiscalised; the naPfr field in the response says so. Without the Idempotency-Key header every call creates a new copy; with the same key a repeated call returns the same one (status “postojalo”).
- Request
- JSON body, 1 parameter(s)
- Responses
- 200, 202, 402, 404, 409, 422
- Authentication
- API key (X-Tezga-Api-Key)
Goods
Kalkulacija (goods receipt) and nivelacija (price change).
POST /api/integrations/kalkulacijaKalkulacija (goods receipt)
Receive goods and release prices to the register with no manual work: the engine writes selling prices, increases stock and writes a KEP row, all in one transaction. Products are matched BY CODE from the catalogue, and the price is CALCULATED (purchase price + margin, or selling price). Idempotent by externalId. “Roba” feature (Biznis plan).
- Request
- JSON body
- Responses
- 200, 400, 402, 409, 413, 422, 429
- Authentication
- API key (X-Tezga-Api-Key)
POST /api/integrations/nivelacijaNivelacija (price change)
Change a product's selling price and write the difference to the KEP (increase = debit, decrease = credit). Products are matched BY CODE; the request carries only the new price, and the engine reads the old price and the quantity on hand from the catalogue at the moment of posting. Idempotent by externalId. “Roba” feature (Biznis plan).
- Request
- JSON body
- Responses
- 200, 400, 402, 409, 413, 422, 429
- Authentication
- API key (X-Tezga-Api-Key)
Catalogue
Writing products and customers from an ERP.
POST /api/integrations/productsWrite products (1 to 500)
A product is looked up by code, and a product without a code by name; one that is found is changed, a new one is created, nothing is deleted. A field you do not send stays as it is. Stock levels are NOT accepted (the fields stanje, zaliha, zalihe, kolicina, pratiZalihu, minStanje return an item error): stock changes only through the stock ledger. One bad item does not break the others. Repeating the same request is safe (status bez_izmene).
- Request
- JSON body
- Responses
- 200, 400, 401, 402, 403, 413, 422, 429
- Authentication
- API key (X-Tezga-Api-Key)
POST /api/integrations/customersWrite customers (1 to 500)
A customer is looked up by PIB, then by email, then by name; an entry with a PIB is matched by email and name only to a customer without a PIB. One that is found is updated (name and the fields you send), a new one is created, nothing is deleted; an empty field does not overwrite stored data. One bad item does not break the others.
- Request
- JSON body
- Responses
- 200, 400, 401, 402, 403, 413, 422, 429
- Authentication
- API key (X-Tezga-Api-Key)
Reading
Document status and account settings.
GET /api/integrations/documentsDocument status by order number
Same as documents/{id}, but by your externalId (and provider). Read only.
- Request
- 2 parameter(s)
- Responses
- 200, 400, 402, 404
- Authentication
- API key (X-Tezga-Api-Key)
GET /api/integrations/documents/{id}Document status
Same shape as the issuing response; used for checking after a 202.
- Request
- 1 parameter(s)
- Responses
- 200, 402, 404
- Authentication
- API key (X-Tezga-Api-Key)
GET /api/integrations/tax-labelsThe account's tax rates and labels
For a flat-rate taxpayer all line items go as exempt (0%), whatever rate is sent. The okruzenje field says whether a request would create a real invoice: call it at startup and stop a test that targets production.
- Request
- no body
- Responses
- 200, 402
- Authentication
- API key (X-Tezga-Api-Key)
GET /api/integrations/transactionsThe company's bank transactions
Incoming and outgoing payments from statements; used for matching collections. It works without an active subscription, but not without a plan that includes the API.
- Request
- 3 parameter(s)
- Responses
- 200, 402
- Authentication
- API key (X-Tezga-Api-Key)
How to start
- Open an account on the Posao or Biznis plan (the API is included in both; lower plans return 402).
- In Settings → Integrations create a key (it starts with
tzg_, 48 hexadecimal characters). - The key goes in the
X-Tezga-Api-Keyheader. Never call the API from the browser (client-side JavaScript). - First test:
GET /api/integrations/tax-labelsreturns the tax labels and confirms that the key works. - First order:
POST /api/integrations/order?provider=customwith a uniqueexternalId; a repeated request returns the same invoice.
Need help with an integration? Write to podrska@tezgafiskal.com.
