Skip to main content

Managing customer invoices

A customer invoice (inv_…) is what you bill your customer (shipper) for a shipment — the accounts-receivable side. This page covers creating invoices, adding line items and documents, and reading them back.
This is the AR (money in) side. For submitting carrier invoices (money out, AP), see Submitting carrier invoices via API. For the relationship between these objects, see Core concepts & data model.

Prerequisites

Create an invoice

POST /api/rest/invoices creates a customer invoice. The invoice is tied to a shipment and a customer:

Fields

POST is not retry-safe for invoices — re-posting an existing (sourceSystem, sourceSystemId) pair returns a 400 Uniqueness violation. Use POST for first sync, PUT for updates. See Idempotency & retries.

Create a shipment with the invoice

You do not need a separate shipment-create call. Nest shipment.data inside an invoiceShipments.data entry:
Send this body to POST /api/rest/invoices. The invoice, new shipment, and their link are inserted in one database transaction. If any insert fails, the transaction rolls back. Background document/workflow processing happens separately after the insert. The two meanings of shipmentId matter:
  • Inside shipment.data, shipmentId is your load/shipment number, such as LOAD-123.
  • Directly on the invoiceShipments.data entry, shipmentId is an existing Upwell shipment ID, such as shi_abc123.
Use one of those forms per link. When embedding shipment.data, omit the link’s shipmentId and invoiceId; the nested insert supplies them. Set shipment fields such as customerId explicitly when wanted; they are not copied automatically from the invoice. Read the new shipment’s Upwell ID from createInvoice.invoiceShipments[].shipment.id and store it. For an existing shipment, use the linking form from the first example. Nested creation is not an upsert: a duplicate external key can fail the entire request. After a timeout, search/read the invoice by its external key before retrying. The shipment’s readyDate describes planned readiness. The invoice’s issueDate describes invoice issuance; they need not match. This nested form is for creation. To attach a shipment to an existing invoice, use the link endpoint; invoice PUT inputs do not accept nested shipment inserts.

Add line items

POST /api/rest/invoice_line_items adds a line item to an existing invoice:
Update with PATCH /api/rest/invoice_line_items/{id}. Delete with DELETE /api/rest/invoice_line_items/{id}.

Attach documents to an invoice

Attach supporting documents (the invoice PDF, BOLs, PODs) to a customer invoice using the same presigned-upload flow as carrier invoices:
1

Request a presigned URL

POST /api/rest/generate-upload-presigned-url with associationType: "INVOICE" and associationId set to the invoice ID.
2

PUT the bytes

Upload the raw file to uploadUrl.
You can also attach documents from the shipment — documents on a shipment are automatically visible on invoices linked to that shipment, so you often don’t need to re-upload. See Working with shipment documents.
Alternatively, POST /api/rest/invoices/{invoiceId}/documents accepts base64-encoded documents directly — convenient for smaller files. For large documents, the presigned-URL flow avoids payload size limits.

Read invoices back

Search by source system

POST /api/rest/invoices/search finds invoices by their external key:
The endpoint accepts a Hasura-style where filter (plus orderBy, limit, offset). The response includes nested invoiceLineItems so you can read the full invoice in one call.

Correct a Transport Pro load’s weight

For customers configured for paperwork-based weight checks, your existing sync worker can find draft invoices with a weight exception, read Upwell’s selected correction, and update the load in Transport Pro. Upwell does not update Transport Pro or calculate its rates. Confirm the customer-specific source and aggregation with Upwell before enabling this workflow; Upwell supplies the applicable rule IDs. Use your existing API key with POST https://api.upwell.com/api/rest/invoices/search: In the examples below, replace YOUR_TMS with the literal TRANSPORT_PRO for this workflow.
Replace the rule-ID placeholder with the IDs supplied for your organization. The response’s invoices[].exceptions[] contains all active, nondeleted exceptions, not only the cause used in the search filter. Select the matching cause before reading weightCorrection:
value is the same selected weight used by the exception rule, expressed in pounds. sourceSystemId identifies the linked load; the invoice’s external ID can differ. The selection requires exactly one linked shipment with an external identity. AGREE requires every attached document of the selected type to have a usable, agreeing weight. SUM, available for BOL sources only, sums distinct BOL numbers. Matching copies of one BOL count once; missing numbers, conflicting copies, incomplete parses, unsupported units or ambiguous evidence return UNAVAILABLE with value: null and an explanation. Document IDs include the copies checked. Invalid rule configuration also returns UNAVAILABLE. Only READY is actionable. A missing/null correction (including exceptions created before this field was available), UNAVAILABLE or MATCHED must not cause a write. A matching weight normally resolves the exception, removing it from the active search result.
  1. Page in ascending ID order. After each page, add "id": { "_gt": "LAST_INVOICE_ID" } to where and keep offset: 0. This avoids skipping records when earlier corrections disappear from the queue. Start each later polling pass without the ID cursor.
  2. Re-read the invoice immediately before writing. Confirm the same active cause, READY correction, source documents, weight and linked Transport Pro load. Exception evaluation is asynchronous; exceptionsLastEvaluatedAt is a completion marker, not a lock or a guarantee that no update is pending. evaluatedAt records the stored correction’s evaluation, not a freshness lease.
  3. Make repeated observations safe in your worker. Compare the current TP weight before writing; update weight and rate in TP using the customer’s agreed billing basis. If TP rounds or uses different units, confirm that its returned weight matches the advertised value; Upwell does not invent a tolerance.
  4. Let the normal TP sync return the corrected shipment weight and rate to Upwell. Upwell re-evaluates and resolves the weight exception once the weight matches. Other holds remain independent. Do not close the exception manually to acknowledge the TP write, and do not approve or send an invoice just because this cause cleared.

Find overdue invoices

Invoices returned by GET /api/rest/invoices, GET /api/rest/invoices/{id} and POST /api/rest/invoices/search include daysOverdue: the whole days the invoice is past its dueDate, counted from today’s date in America/Chicago, or 0. It is always 0 for PAID, CANCELLED, WRITE_OFF, DISPUTED and REFUNDED invoices and for invoices without a dueDate. Upwell computes it when you read the invoice, so it is correct whatever the invoice’s status is (for example SENT). To list overdue invoices, filter on computedDaysOverdue:
Use daysOverdue rather than the OVERDUE status. OVERDUE is deprecated: some invoices still carry it and you can still read it, but an invoice past its due date usually keeps another status, such as SENT, so a search for status: OVERDUE misses it.

Filter by invoice delivery

Delivery filtering is available after Upwell has verified and enabled it for your organization. Check GET /api/rest/invoices/delivery-filters/status first, using your normal API credentials. Its deliveryFilterStatus array contains one row with enabled, pendingCount, checkedAt and tenantId. When enabled is true, POST /api/rest/invoices/search accepts positive delivery filters, for example:
The fields are responsibility (who owns delivery), completion (the recorded delivery outcome), and performer (who delivered it). Use _eq for one value or _in for several. These are separate from invoice status and payment status. While classifications are recomputing, positive delivery filters omit those invoices. Display pendingCount so users know results may be incomplete, and refresh results after recomputation. The count is for your whole organization, not just the invoices matching other search conditions; checkedAt identifies when it was observed. A later search can see newer data. Before enablement, delivery-filtered searches return an error (Hasura REST reports a database error/HTTP 500); ordinary invoice search still works. Do not silently retry a failed filtered search without its delivery predicate. Negating the relationship with _not can include invoices still recomputing: use positive predicates when you need only current classifications.

List an invoice’s documents

Update an invoice

PUT /api/rest/invoices/{id} updates by Upwell ID. PUT /api/rest/invoices (without an ID) updates by sourceSystem + sourceSystemId in the body.
For the standard payment-ledger model, do not write balance or a paid status when recording cash. Create or correct the invoice-linked customer payment line item, and Upwell recalculates both fields together.

Reference numbers corrected in the app

When a user adds or corrects a reference on the invoice in the Upwell app, Upwell pins that value, and the reference shows a Manually set badge in the invoice’s Reference numbers section. A pin covers one slot: a standard field (billOfLadingNumber, carrierProNumber, customerPoNumber or customerReferenceNumber, together with the same-named key in referenceNumbers), another flat key in referenceNumbers, or a named entry in referenceNumbers.additionalReferenceNumbers. A later PUT that writes a different value to a pinned slot still succeeds, but Upwell keeps the pinned value in that slot. When the value you send is non-blank, it is recorded as the value the system reported, and the badge changes to Manually set · system reported another value. Clearing a pinned slot (sending null or an empty string, or leaving the key out of a replacement referenceNumbers object) also leaves the pinned value in place, but records nothing and does not change the badge. Slots without a pin update normally. To change a pinned reference, a user edits it on the invoice in the app. Pins apply only while you send referenceNumbers as an object. A PUT that sends a top-level array replaces the references, pinned ones included. A PUT that sends a JSON-encoded string is rebuilt as an object that holds only the pinned references, so the string’s other references are lost. On an invoice that has pinned references, send referenceNumbers as an object.

BOL number from the attached bill of lading

Upwell sets referenceNumbers.documentBolNumber to the trimmed bill of lading number parsed from the latest Bill of Lading document attached to the invoice. Upwell takes the most recently attached file, then the newest Bill of Lading document in it, then that document’s newest parse. A document that has not been parsed yet is skipped. When the selected parse has no number, Upwell removes the key instead of falling back to an older Bill of Lading. Upwell recalculates the key when a document is attached, detached, reclassified or reparsed. Older invoices can be missing the key. Upwell owns this key. While referenceNumbers is an object, a PUT that adds, changes or removes documentBolNumber still succeeds, but Upwell restores the parsed value, even over a pinned reference. A PUT that replaces referenceNumbers with a top-level array removes the key, because an array has no place to hold it. Upwell adds it back the next time referenceNumbers is stored as an object. The key does not change billOfLadingNumber or any other reference. Users cannot edit it on the invoice in the app either. To change it, correct the Bill of Lading document.

Adding or removing a shipment

invoiceShipments at create time (shown above) only covers the shipments you know about when the invoice is first created. To link or unlink a shipment from an existing invoice, use the standalone endpoints instead of trying to re-send invoiceShipments on a PUT:
Linking or unlinking a shipment triggers a background re-sync of that shipment’s documents onto (or off of) the invoice — the same “documents on a shipment are automatically visible on invoices linked to that shipment” behavior described above, kept in sync as the shipment list changes.

Invoice lifecycle

Invoices move through these statuses: Upwell’s automatic email and portal delivery picks up CREATED invoices, not OPEN ones. If you create an invoice as OPEN, or switch an unsent invoice to OPEN, Upwell doesn’t send it by email or portal. In the app, the Switch Status dialog and the invoice status editor warn before an unsent email or portal invoice is switched to Open. The switch still goes ahead if you confirm.
When a customer payment is applied through a linked line item, Upwell updates the invoice’s balance, payment status, and paid date automatically. If your source system cannot send complete payment applications, coordinate an authoritative-balance model with Upwell before sending balance snapshots.
For statements, the default All outstanding filter excludes CREATED, PAID, and CANCELLED. Use an open or delivery lifecycle status when an invoice is ready to appear, or intentionally select All outstanding including created for a workflow where draft invoices are statement-ready.

Invoices that automatic delivery skips

Upwell’s automatic email and portal delivery skips a customer invoice in either of these cases:
  • The total is $0. totalAmount is exactly 0. Negative totals, such as credit memos, are still delivered.
  • A linked load was canceled before delivery. A linked shipment’s status is canceled, cancelled, or voided (case-insensitive, surrounding whitespace ignored), and that shipment has no deliveredAt. A load your TMS marks canceled after delivery is still billed.
A canceled load does not block an invoice that carries a nonzero TONU (truck ordered, not used) or cancellation fee line item. Upwell recognizes these fees by accessorial code or line item description. An exact $0 total still blocks, even with a TONU line item. The invoice keeps its CREATED status, and approval alone does not release it. It stays in GET /api/rest/invoices/queues/ready-to-send, which has no field for the block reason. In the app, the invoice table and its CSV export show $0 total or Load canceled in the Auto-send block column. An operator can still send the invoice explicitly from the app. To let automatic delivery pick it up, correct the cause: update the invoice total or line items, or set the shipment’s status and deliveredAt with PUT /api/rest/shipments.

Webhook events

Subscribe to invoice events in the Upwell dashboard to get notified of status changes: An update.invoice.status.APPROVED trigger also exists but is support-enabled only. The webhook event catalog is the source of truth for trigger strings and dispatch rules; see Outbound webhooks for the delivery model, retries, and payload format.

What’s next

Customer payments

Record remittances applied to these invoices.

Statements & reminders

Automated follow-up on outstanding invoices.

Receivables management

The AR dashboard and reconciliation workflow.

Shipment documents

Attach supporting docs to shipments (shared with linked invoices).