In the import file format, the line starting with API (or APIF for the fixed format) signifies the invoice record. What follows are the APD (or APDF for the fixed format) lines for the distributions. You can have as many APD/APDF lines needed for the invoice.
If there are taxes related to a distribution, the lines starting with APTX (or APTXF for the fixed format) signifies the tax distributions. The APTX/APTXF lines will follow the APD/APDF line to which it applies.
The sum of the amounts on the APD/APDF lines need to match the amount on the API/APIF line. In other words, the sum of the distributions need to match the amount of the invoice.
When a new API/APIF line starts, this indicates that it is a new invoice record.
For more information regarding importing invoices and the file format, refer to the following knowledgebase articles: