Demurrage and Detention: AI Tracks Free Days and Drafts Disputes

Coding Liquids tutorial cover featuring Sagnik Bhattacharya for Demurrage and Detention: AI Tracks Free Days and Drafts Disputes.
Coding Liquids tutorial cover featuring Sagnik Bhattacharya for Demurrage and Detention: AI Tracks Free Days and Drafts Disputes.

Put every container's free-day start, free-day count and last free day in one tracker, then have AI flag each one three days before the clock runs out. When a bill still arrives, assemble a dated evidence pack and let AI draft the dispute letter from it. You check every date and amount before sending.

Definitions are everywhere; the part that costs forwarders money is the gap between "we know what demurrage is" and "nobody noticed container 14 on Thursday". The charges are rarely the result of one big mistake. They come from a pile of small ones: an arrival notice read late, a pick-up booked a day too late, an empty returned to the wrong depot, a bill paid without anyone asking whether the carrier's own delays counted.

Follow me on Instagram@sagnikteaches

The two clocks, in one paragraph each

Demurrage is the charge when a loaded container stays inside the port or terminal beyond its free time. Detention is the charge when you hold the carrier's container (usually outside the terminal, at your customer's yard or warehouse) beyond its free time before returning it empty. Free time, counted in days, is set by the carrier's tariff or your contract. Tariffs set a daily rate that often rises in blocks (one published carrier tariff, for example, steps up after day 7 and again after day 14 beyond free time), and some give a single combined free period covering both charges. The exact start of each clock (discharge, availability, gate-out) and whether weekends and holidays count differ by carrier and terminal, so the start rule is the first column in your tracker and never an assumption.

Connect on LinkedInSagnik Bhattacharya

That is all the theory you need here. The rest is bookkeeping, and bookkeeping is where AI helps.

Subscribe on YouTube@sagnikteaches

Build the free-day tracker first

A tracker is one row per container and one column per fact. Build it in Excel or Google Sheets; ask an AI assistant to add the formulas once the columns exist. A workable set of columns for a small forwarder:

ColumnExampleWhere it comes from
Container no.ABCD1234567Booking, bill of lading
Customer / job refJOB-2231Your system
CarrierCarrier ABooking
Demurrage clock startsDischargeCarrier terms
Date clock started2026-10-05Terminal or carrier notice
Free days (demurrage)5Carrier terms
Last free day (demurrage)2026-10-10Formula
Gate-out date2026-10-09Terminal or trucker
Detention free days4Carrier terms
Last free day (detention)2026-10-13Formula
Empty returnedBlank until doneDepot receipt
StatusOK, WARN, OVER, DISPUTEFormula
Source documentLink to booking confirmationYour folder

Two columns carry most of the weight. "Clock starts" stops you counting from the wrong event, and "source document" means a reader can see where the free-day figure came from. Skipping the source link is how teams end up arguing from memory.

Getting the free-day figures in without retyping

Most booking confirmations, arrival notices and tariff extracts arrive as PDFs or emails. Upload one at a time and ask an assistant to extract the fields into a row. Use a prompt that refuses to guess:

From the document below, extract: container number, carrier, vessel,
discharge date, free days for demurrage, free days for detention,
what event starts each clock, whether weekends or holidays count,
and the daily rates after free time. For any field not stated in
the document, write NOT STATED. Do not assume standard terms.
Quote the sentence each figure came from.

The "quote the sentence" line gives you a quick check. An illustrative reply says free days are 5 for demurrage, the source line reads "five (5) calendar days from discharge", and detention is NOT STATED because the booking refers to the carrier's published tariff. That NOT STATED is useful: it tells you to fetch the tariff rather than assume the common figure. Keep the answer in the row, with the quoted sentence in a notes column.

The Complete Excel Course with AI Integration thumbnail

The Complete Excel Course with AI Integration

From formulas and pivot tables to Power Query, DAX, VBA and AI with Copilot, ChatGPT and Claude — hands-on from the first lesson.

By Sagnik Bhattacharya and Virginia Thorn, Primetime Emmy Award winner

Buy now

Formulas that do the counting

Ask the assistant for the formulas, then test them on three rows you can count by hand. For calendar days the last free day is the start date plus the free days minus one when the start day counts as day one, or plus the free days when it does not. This single detail shifts every date by a day, so write down which convention your carrier uses and keep it in a header note. If weekends do not count, use a working-day function instead of simple addition; the ChatGPT Excel guide shows how to describe a formula to an assistant and verify it.

A status column then turns dates into action. An illustrative rule set: OK when more than 3 days remain, WARN when 3 or fewer, OVER once the last free day has passed, DISPUTE when you have logged a claim. Colour the cells, sort by status each morning, and the tracker works as a to-do list.

Make the tracker tell you before the money is gone

A tracker nobody opens is a filing cabinet. Pick one daily moment, a ten-minute check at the start of the day, and make it automatic. Options from simplest to most automated:

  1. Sort and read. Sort by last free day; read the top ten rows aloud in the morning stand-up.
  2. A daily digest. A scheduled script or an automation tool emails the rows in WARN or OVER to the person on duty.
  3. An AI summary with actions. Paste the WARN and OVER rows into a chat and ask for a ranked list: which container to move first, what the daily charge will be if it waits, and whom to phone.
Here are today's WARN and OVER containers from our tracker.
For each, state: days left or days over, the daily charge that
applies next, and the cheapest action (book trucker today, ask the
customer to unload, request an extension from the carrier).
Rank by money at risk over the next three days. Do not invent
rates: use the ones in the table, and say so if a rate is missing.

An illustrative output ranks container ABCD1234567 first: over by 1 day, two more days at the first-tier rate before the higher tier starts, trucker not yet booked, so book today. The AI has not done anything clever. It has read a table and put the decision where the busy person looks.

A worked example with numbers

An illustrative small forwarder handles 140 containers a month. In a sample month the tracker would show 9 containers going past free time before anyone acted. Say the blended tariff charge is $150 a day for the first three days beyond free time and $240 a day from the fourth. Six containers overran by 3 days, all at the lower tier: 6 x 3 x $150 = $2,700. Three overran by 5 days, so 2 of those days fell in the higher tier: 3 x (3 x $150 + 2 x $240) = 3 x $930 = $2,790. The month's bills total $5,490. Of these, the forwarder estimates that around a third would have been avoided by daily checks (container moved on time) and around a third were caused by delays that were not the forwarder's fault (terminal closed, carrier release late, customs hold). The rest are legitimate.

That is roughly $1,830 of avoidable charges and $1,830 worth challenging. These figures are invented for the example; run your own last three months of invoices through the same arithmetic before you decide how much effort this is worth. If your own number is $400 a month, a spreadsheet and the morning check are plenty. If it is $5,000, a more serious system pays for itself.

Which charges are worth disputing

Not every bill deserves a letter. A rough triage keeps the effort for cases with a chance of success:

SituationDispute?Evidence to look for
Container was not available for pick-up (carrier release not issued, still on the vessel, terminal system fault)YesRelease dates, hold notices, terminal availability screens
Customs or other government holdSometimes: whether the clock pauses depends on the carrier's terms and any rules on your lanesHold and release notices with times
Terminal closed or appointments unavailableYesClosure notices, failed appointment screenshots, trucker emails
Free days differ from the quoted termsYesQuote, booking confirmation, tariff version
Invoice contains missing or wrong details (dates, container, rate)YesThe invoice versus the data you hold
Same period billed twice or overlappingYesTwo invoices side by side
Customer was told to unload and did notRecover from the customer insteadYour own emails to them
You missed the pick-up bookingUsually no; fix the processYour tracker history

The last row matters. Disputing a charge that was your own error wastes the carrier's goodwill and your time. Use those cases as input to the tracker rules instead.

The evidence pack: what to gather and in what order

A dispute is won or lost on dated evidence, not argument. For each disputed invoice, build one folder or one document with the same sections every time.

  1. The invoice, with the receipt date noted in the file name.
  2. The contract terms, meaning the booking confirmation or tariff page showing the free time, and the quote you gave your customer if free days were promised.
  3. The timeline, a table of events with date, time, source and what it proves.
  4. The blocking events: proof the container could not be moved (hold notices, closure notices, no-appointment screenshots).
  5. Your efforts to mitigate: emails to the trucker, the carrier and the terminal showing you tried.
  6. The calculation, your version of the days and amounts against theirs.

Ask AI to build the timeline. Paste the raw emails, notices and status exports and ask it to extract only dated events:

Below are emails and notices about container ABCD1234567.
Build a timeline as a table: date, time, event, source document,
and what it shows about whether the container could be moved.
Only include events with a date in the source. Flag any gap of more
than one day with no evidence. Do not infer events.

An illustrative result would list: 5 Oct discharge; 6 Oct terminal screen shows a carrier hold (release not issued, although freight was paid on 4 Oct); 8 Oct carrier release received; 9 Oct last free day per the invoice; 14 Oct gate-out. It then flags the gap between the 6th and 8th as covered by the hold evidence, which is exactly the argument: two of the five free days passed while the carrier's own hold stopped the container moving. The invoice charges 10 to 14 October, five days at $150, so $750; with the two days restored, the last free day becomes 11 October and the charge falls to $450. Read the timeline against the documents yourself. If a date in the AI table does not match its source, fix it before anything leaves the building.

Drafting the dispute letter

Keep the letter short, factual and numbered. A reader at the carrier should be able to open one page, find the invoice number, see the claim and see the evidence list. Give the AI the timeline, the calculation and the tone you want.

Draft a dispute letter to the carrier's billing team.
Facts: invoice [number] dated [date], container [number], amount $[x].
Our position: [two of the five free days fell during a carrier hold
shown on the terminal screen; we claim those days back].
Timeline and evidence are attached as items 1 to 6.
Requested outcome: revised invoice for $[y], or a written explanation
of how the free time was counted.
Tone: firm, polite, no threats, no legal claims. One page.
Use only the facts above. Number the points.

An illustrative draft starts with the invoice reference, states "we dispute $300 of the $750 charged", lists three numbered points with dates, and closes with the requested outcome and a reply date. Read the numbers twice. Then delete anything that reads as an accusation. A letter that says "the terminal failed to" will be handled differently from one that says "the evidence at item 3 shows the container was on hold between 6 and 8 October".

Before and after

Weak first draftBetter version
We believe these charges are unfair and ask you to waive them in full.We dispute $300 of invoice 8841. The container was under a carrier hold from 6 to 8 October (item 3), so two of the five free days could not be used.
Your terminal was closed and we could not collect.The terminal's notice of 9 October (item 4) shows gate closure from 06:00 to 18:00; our trucker's booking attempt at 07:12 is at item 5.
Please respond quickly.Please reply by [date] with a revised invoice or an explanation of how the free time was counted.

The pattern in the right-hand column is the same each time: figure, date, item number. The AI can apply it across a batch of disputes if you hand it the same structure. If you do this often, saving the prompt as a template in a project or saved-instructions area keeps the structure fixed.

Check what AI gets wrong with dates and money

Dispute letters fail on small errors. These are the ones to look for:

  • Off-by-one day counts. Whether day one is the discharge day or the day after changes every figure. Recompute at least one invoice by hand each time.
  • Time zones. A notice stamped late in the evening in one zone is the next day in another. Quote the stamp as written.
  • Mixed currencies. If the invoice is in one currency and your calculation in another, label each. For general checks on figures, see why AI is bad at maths.
  • Invented context. An assistant may add "per standard terms" or a regulation you never mentioned. Strip anything not in your evidence pack.
  • A wrong tier. Applying the first-tier rate to days that belong in the second tier. Show the tier table inside the prompt.

Some markets regulate what a carrier's invoice must contain and how quickly a billed party can challenge it. Where such rules exist they can be specific: one published regime requires the invoice to show the free time allowed, its start and end dates, the container availability date and the exact dates charged, sets a deadline for issuing the invoice, and gives the billed party a minimum window to request a refund or waiver. If you ship through such a market, ask a qualified adviser which rules apply to you, add any required invoice fields to the line-by-line check below, and put the deadlines into the tracker as a column ("dispute by"), filled in the day the invoice arrives.

Reading a carrier invoice line by line with AI

Before any dispute, check the invoice itself. Export or paste the invoice lines and your tracker row into a chat and ask for a line-by-line comparison. This catches the errors that need no argument, only a corrected bill.

Compare this carrier invoice with our tracker row.
Report each mismatch in: container number, start date of the clock,
free days applied, number of chargeable days, rate per day, tier
boundaries and total. Recalculate the total from our row and show
the working. Do not assume the invoice is right or wrong.

An illustrative case. The invoice for one container shows 7 chargeable days at $150, total $1,050. The tracker row shows a 5-day free period from a discharge date of 2 October, last free day 6 October, full gate-out on 10 October, so 4 chargeable days at $150, total $600. The assistant lists the mismatch: the invoice starts the clock on 29 September, the vessel's earlier arrival date, three days before the discharge shown in your terminal notice. The claim is $450, needs no negotiation about fairness, and can go out as a short correction request with the notice attached. This category, a wrong start date, is usually the easiest to argue and the cheapest to find, because it needs only two documents.

Run the same comparison across a month of invoices. A pasted table of 40 lines is within reach of an assistant, but double-check the totals with a sum in your spreadsheet. Keep a column for "invoice start date versus tracker start date": a repeated gap from one carrier or terminal is a pattern worth raising in a single conversation instead of forty letters.

Prevention is cheaper than dispute

The best letter is the one you never need to write. Three changes cut the number of bills that reach disputes at all. First, quote free days to customers in writing, and where a customer routinely needs longer to unload, ask about extra free days at booking (some carriers sell additional detention days with the booking) and price them into the quote. Turning customer emails into draft quotes shows where to put that line so it is not forgotten. Second, send the customer a reminder from the tracker: "Container ABCD1234567 is on its fourth free day; please confirm pick-up." Third, keep the shipping documents right the first time, because mismatched paperwork is a common cause of holds; cross-checking commercial invoices and packing lists covers that step.

An illustrative customer reminder drafted by AI from a tracker row:

Hi [first name], container ABCD1234567 for job JOB-2231 has two free
days left (last free day 10 October). Daily charges start after that.
Please confirm when your driver will collect, or tell us if you need
us to arrange it. If something is blocking collection, reply and we
will raise it with the carrier today.

That message costs nothing to send and creates a dated record that you warned the customer, which matters if you later recharge them.

Recharging your customer without losing the account

A forwarder sits between the carrier and the customer. If the charge was caused by the customer's delay, you recharge it, ideally under a term you have already put in the quote. Draft the recharge note from the same evidence pack, showing days, rate and the carrier's invoice, and offer to pass on any credit you win. If the charge was the carrier's fault and you dispute it successfully, credit the customer the same day. Customers remember who protected their money. If you handle recharges often, a margin-by-lane spreadsheet shows which customers and lanes quietly eat your profit through storage and equipment charges.

A four-week setup plan

  1. Week 1: build the tracker with ten live containers. Fill the first rows by hand and check the formulas.
  2. Week 2: use the extraction prompt on every new booking and arrival notice. Record how often you needed to correct it.
  3. Week 3: start the daily check and the customer reminder. Count the containers that went OVER.
  4. Week 4: take the last three months of carrier invoices, run the triage table, and build one evidence pack and one dispute letter with the prompts above. Keep the best as your template.

After a month you will know three numbers: charges avoided by early warning, charges recovered by dispute, and the minutes the whole process takes per container. If the first two together are a fraction of a day's pay, scale back; if they are several times it, build on what works. For anyone working out where else AI belongs in a forwarding office, my AI implementation consultation covers that kind of mapping, and the contact page is the place to start.

Questions forwarders ask about disputing these charges

Can AI work out the free days from a booking confirmation?

It can read the free-day figures and start trigger from the document and put them in your tracker, but treat the result as a draft. Free time is set by the carrier's tariff or contract, and the booking may point to terms it does not print. Check the first extraction against the source every time.

How soon must I dispute a demurrage or detention invoice?

As soon as you receive it. Time limits come from the carrier's terms and, in some markets, from rules on invoice content and dispute windows. Log the invoice date on arrival, and ask an adviser which limits apply to your lanes.

What evidence usually wins a dispute?

Timestamps showing when the container could actually be picked up or returned: gate-out and gate-in records, notices that cargo was available, terminal closures, appointment failures and the carrier's own emails. A dated trail beats a strongly worded letter.

Should the dispute letter be written by AI alone?

No. Let AI assemble the timeline and draft the letter from your evidence, then read every date and amount against the source documents before sending. A wrong date in a dispute gives the carrier an easy reason to refuse it.

Is a spreadsheet enough for tracking?

For up to a few hundred containers a month, yes. Beyond that, or when several people update statuses, a shared tracking tool or your forwarding system's own alerts are safer. The rules in this tutorial transfer to either.

Further reads

Sources: Maersk's demurrage and detention explainer (definitions, free time, extra detention days at booking; archived copy of August 2026) and a published Maersk demurrage and detention tariff (tiered daily rates, combined free time), and published demurrage and detention billing rules (invoice contents, issuing deadline, dispute window), all read November 2026. Free-time terms and dispute windows for your own lanes come from each carrier's tariff or contract.

Want fewer demurrage bills reaching your desk at all?

On a 1:1 call we can go through how containers move through your office today, where the free days get lost, and which tracking and dispute steps AI can take over.

Book a 1:1 call with me