Record closings with the API

Mark a Sales Router chat as a sale from your payment system, invoice tool or CRM by sending its Ref code and value to the API.

Updated October 12, 2026

Every chat Sales Router sends can carry a Ref code such as Ref: IB-7F3A09C2D1 at the end of the first WhatsApp message. When the sale is paid, your own system can record the closing with that code, instead of an agent doing it by hand. It needs a Read & write key and Pro or a higher plan.

The request

Send POST /api/v1/closings with a JSON body such as {"referenceToken": "IB-7F3A09C2D1", "value": 250000}.

FieldRequiredNotes
referenceTokenYesThe Ref code. Case doesn’t matter, and text around the code is ignored, so a whole message works too.
valueYesThe sale value as a number, 0 or more. IDR values are whole numbers; other currencies allow their usual decimals.
currencyNoA 3-letter code. If you send it, it must match the team’s closing currency.
replaceNotrue to change the value of a chat that already has a closing.

What you get back

StatusCodeMeaning
201Closing recorded.
200Existing closing replaced (with replace: true).
409already_closedThe chat already has a closing. The current one is in details. Send replace: true to change it.
409currency_mismatchThe team records sales in another currency. Send that currency, or leave currency out.
404reference_not_foundNo routed chat with this Ref in this workspace.
400invalid_referenceThe text doesn’t contain a Ref code (IB- followed by letters and numbers).

About the currency

Each Sales Team records closings in one currency, set under Closing tracking on the team. A value from the API is always stored in that currency. Leaving currency out is the simplest option; sending it is a safety check that catches a team whose currency was changed.

Good to know

  • A recorded or changed closing also fires the Closing recorded webhook event.
  • GET /api/v1/closings lists closings with totals per currency, and works with a Read only key.
  • The Ref only appears when Source reference (Ref) in the WhatsApp message is on for the team.

Examples and every field are in the API reference.

Full tutorialHow to track which WhatsApp chats turn into salesRead the guide

Related articles

Still need help?

Send us a ticket from your dashboard: the headset button at the top right, then Contact support. We reply there and by email.

Contact support