Skip to main content

Retrieving Document Items

How do I get invoice line items if the API doesn't list them on the issued invoice?

Written by Lenka Haringerová

By default, listing invoices, orders, or stock documents returns only headers. Items and other linked records are added to the output separately.


The relations parameter

The simplest approach is to list the sub-records in the relations parameter:

GET /c/{firma}/faktura-vydana.xml                          … jen hlavičky
GET /c/{firma}/faktura-vydana.xml?relations=polozkyDokladu … i s položkami

Which sub-records can be attached to a given record type is shown at the address /relations. The parameter takes the value from the url element:

GET /c/{firma}/faktura-vydana/relations.xml

ℹ️ For documents, items are named polozkyDokladu — the same applies to invoices, orders, bank documents, and stock documents. The older notations polozkyFaktury and polozkyObchDokladu only work for the record type they belong to.


When items appear even without relations

Items can end up in the response in three ways:

Situation

Result

A document addressed directly by its identifier — /faktura-vydana/123.xml

Items are included in the output automatically.

A listing or filter — /faktura-vydana/(kod eq '…').xml

Only headers, until you add relations.

A relation listed in detail=custom:…

Items are included in the output even without the relations parameter.

💡 If you don't want to pull entire items from the database, list the required fields directly: ?detail=custom:kod,polozkyDokladu(nazev,mnozMj). The response is smaller and Flexi assembles it faster — for more details, see the article Issues with returning fields.


Related

Did this answer your question?