Skip to main content
The Generate Invoice endpoint computes a full fee breakdown for a courier’s packages within a specified date range, applying your configured weight-tier pricing rules to produce an itemized invoice preview. The response includes warehouse and courier details, a per-tier summary, and a line-item list of every package with its applied fee — giving you everything needed to review charges before committing the invoice through the billing UI.

Endpoint

POST /api/GenerateCourierInvoice.php

Authentication

All requests must include a valid JWT Bearer token in the Authorization header.
Authorization: Bearer <your_jwt_token>

Request Body

courier_id
string
required
UUID of the courier to invoice. All packages belonging to this courier that fall within the date range will be included in the calculation.
start_date
string
required
Start of the billing period in YYYY-MM-DD format (inclusive).
end_date
string
required
End of the billing period in YYYY-MM-DD format (inclusive).

Example Request

{
  "courier_id": "courier-uuid-here",
  "start_date": "2024-01-01",
  "end_date": "2024-01-31"
}

Response

200 — Success

The response body contains four sections: warehouse (billing entity details), courier (the invoiced party), summary (aggregate totals), breakdown (per-tier fee computation), and packages (individual line items).
{
  "status": "success",
  "data": {
    "warehouse": {
      "name": "Shiipp Warehouse",
      "address": "..."
    },
    "courier": {
      "courier_name": "Express Couriers",
      "courier_code": "EXP",
      "...": "..."
    },
    "summary": {
      "total_packages": 47,
      "total_weight": 162.5,
      "total_fees": 348.00
    },
    "breakdown": [
      {
        "range": "0.00 - 5.00 LBS",
        "count": 22,
        "rate": 5.00,
        "subtotal": 110.00
      },
      {
        "range": "5.01 - 15.00 LBS",
        "count": 18,
        "rate": 10.00,
        "subtotal": 180.00
      }
    ],
    "packages": [
      {
        "package_id": "pkg-uuid",
        "tracking_number": "1Z999...",
        "weight": 3.5,
        "applied_fee": 5.00
      }
    ]
  }
}

Response Fields

data.warehouse
object
Details of the warehouse acting as the billing entity on the invoice (name, address, and contact information).
data.courier
object
Profile of the invoiced courier, including courier_name, courier_code, and contact details.
data.summary
object
data.breakdown
array
Per-tier fee summary. Only tiers that matched at least one package are included.
data.packages
array
Individual package line items included in the invoice.

Notes

Packages whose weight falls outside all configured weight tiers receive an applied_fee of 0.00 and are still included in the packages array. Review your tier configuration in the billing settings if you see unexpected zero-fee packages.
The breakdown array only contains entries for tiers that had at least one matching package. Empty tiers are omitted to keep the response concise.
This endpoint returns a preview only. No invoice record is created and no charges are committed. To publish and finalize the invoice, open it in the Shiipp billing UI and use the Publish Invoice action.