Overview
DHL Express invoices come from DHL’s MyBill portal. Each invoice arrives as up to three files: an express CSV, a customs CSV, and an invoice PDF. The CSVs have a two-level structure:I (invoice) rows carry billing account metadata, and S (shipment) rows are the actual shipments. Charges live in numbered extra-charge (XC) slots: XC1–XC9 in express CSVs and XC1–XC11 in customs CSVs. Each non-zero XC charge on an S row becomes one line item in the Trackstar API.
Files you’ll receive
DHL hands out each invoice’s files as a zip. Trackstar unpacks it, so the Files endpoint returns the individual files, never a zip.- File names come from DHL. At least one file per invoice is named after the invoice number alone (for example
MUC2684030563.csv); the customs CSV carries an extra suffix on the same name. - Files can arrive days after the invoice date. DHL publishes an invoice a few days after the date it is filed under, so Trackstar re-checks the last 30 days on every sync and downloads any invoice it doesn’t have yet.
- Older invoices can appear twice. Invoices first synced before August 2026 may be listed more than once in the Files API. Invoices synced since then are downloaded once. Line items are not duplicated either way.
Shape notes
- Line Type markers. The first column is
Line Type:Ifor invoice-level rows,Sfor shipment rows. OnlySrows become line items in the Trackstar API; billing account is carried forward from the precedingIrow when anSrow leavesBilling Accountblank (always the case in customs CSVs). - Columns are read by name, not position. The sample express CSV has 153 columns, in the same order as a real DHL express file, but don’t rely on a fixed width or order. Customs CSVs are wider, and some rows carry more values than the header has columns. Trackstar keeps those extra values in the line item’s
rawfield underExtra Columns, as a list. - Dates are YYYYMMDD. Invoice and due dates use 8-digit format with no separators, e.g.
20260331for 31 March 2026. Trackstar dates every line item withInvoice Date; theShipment Datecolumn is not used. - Charges come from XC slots. Each slot has seven columns (
Code,Name,Charge,Tax Code,Tax,Discount,Total), split across two places in the file (see Extra charges below). Any slot with a populatedNameand non-zeroChargebecomes a Trackstar line item, valued atXC{n} Charge(notXC{n} Total, so tax and discount are not included). - Only XC charges become line items.
Weight Charge,Other Charges 1/2, and theDiscount 1–3columns stay inrawbut are never separate line items. The line items for a shipment therefore don’t add up to itsTotal amount (excl. VAT). - European number format is tolerated. DHL Express in some regions delivers amounts like
5.476,48(period as thousands separator, comma as decimal). Trackstar handles both formats automatically.
Sample rows
Curated subset showing theLine Type/XC structure. The downloadable express CSV has all 153 columns.
Download
Download full sample express CSV (1 I row + 15 S rows, 153 columns)All sample data is synthetic. Tracking numbers, account numbers, addresses, and reference fields are fabricated and do not correspond to any real shipments or customers.
Fields
Invoice identification
Billing address
Shipment
Origin and destination
Contents and dimensions
Invoice totals
Core charges
Extra charges (XC slots)
Each XC slot has seven columns:Code, Name, Charge, Tax Code, Tax, Discount, Total. In the express CSV they sit in two blocks: the Code, Name, Charge and Total columns for XC1–XC9 come together after Total amount (incl. VAT), and the Tax Code, Tax and Discount columns for XC1–XC9 come at the end of the row. Customs CSVs add XC10 and XC11.
Any slot with a populated Name and non-zero Charge becomes a Trackstar line item. XC slots are dense, not sparse: if only 2 charges apply, they occupy XC1 and XC2, leaving XC3–XC9 empty.
Common XC charge names include:
Fuel SurchargeOversize PieceRemote Area DeliveryAddress CorrectionDuties & Taxes AdvancedPremium 10:30/Premium 9:00Saturday Delivery
Mapping to invoice line items
Each non-zero XC charge on anS row becomes one line item.