Skip to main content
This guide covers two approaches for accessing carrier invoice data through the Trackstar Carrier API: retrieving parsed line item data as JSON, or downloading raw invoice files.

Overview

Carrier integrations (e.g. UPS, FedEx, USPS, DHL) provide invoice data in two formats:
  1. Invoice Line Items — parsed, structured JSON data for each individual charge
  2. Files — raw invoice documents (CSVs, PDFs) for download

Understanding invoice line items

A carrier invoice is a bill for services rendered over a billing period. Each invoice contains many individual charges — each one becomes a separate line item in the Trackstar API. One shipment → many line items. A single FedEx shipment from Chicago to London might appear on an invoice as: All three rows share a tracking_number and invoice_id but have different charge_description and net_cost values. To get the total cost of a shipment, sum net_cost across all line items with the same tracking_number. Invoice shapes vary by carrier. Each carrier delivers invoice data in its own CSV/PDF format. Trackstar normalizes them into the line-item schema, but the raw files are also available via the Files endpoint. See Carrier Sample Files for exact shapes per integration.

Option 1: Invoice Line Items (JSON)

Use the Get Invoice Line Items endpoint to retrieve parsed invoice charges. Each line item contains cost details, transaction dates, and charge descriptions.

Key Fields

Filtering by Date

You can filter line items by transaction date to retrieve charges for a specific period:

Option 2: Raw Invoice Files

Use the Get Files endpoint to download raw invoice documents. This returns presigned download URLs for each file.

Key Fields

Filtering by Date

Use created_date to query a specific date range:
You can also filter by file_type (e.g. csv, pdf) and file_name.
start_time and end_time still work but are deprecated. They map to created_date[gte] and created_date[lte], so switch to created_date when you get the chance.
Download URLs expire after 20 minutes. If you need to access the file after expiration, make another request to get a fresh URL.

Getting One File by ID

The carrier-file.created webhook tells you a new file is ready, but it does not carry a download URL, because a presigned URL would expire before the webhook could be retried. Fetch the file by its id to get a fresh URL:
See Get Carrier File. This is also how you get a new URL for a file you already listed, without paging through the list endpoint again.

Which Approach to Use?