ml-connector
FreshBooksTradeshift

FreshBooks and Tradeshift integration

FreshBooks is a cloud accounting platform that handles invoices, bills, and payments for small businesses. Tradeshift is a B2B spend-management and AP-automation network that lets you exchange invoices and payments with suppliers electronically. Connecting FreshBooks to Tradeshift means your accounts payable team can send bills and payments directly into the supplier network without re-entering data, and every posted document is tracked with a full audit trail.

How FreshBooks works

FreshBooks exposes invoices, bills, payments, bill vendors, expenses, and chart-of-accounts entries through a REST API authenticated with OAuth 2.0 (user-delegated authorization code grant, not Client Credentials). The API uses JSON request/response and is organized into accounting and time-tracking namespaces. FreshBooks can push events (invoice.create, invoice.update, bill.create, bill.update, payment.create, payment.update, and others) to a customer-supplied webhook endpoint via POST; webhook payloads are signed with HMAC-SHA256. Webhook delivery is not guaranteed real-time and can range from seconds to several minutes. Invoices and payments have read-only status fields, and purchase orders are not supported.

How Tradeshift works

Tradeshift is a B2B network for procurement and spend management. It accepts invoices, purchase orders, credit notes, receipts, and other documents in UBL 2.0/2.2 XML format via REST HTTPS. Authentication uses OAuth 1.0a (two-legged, server-to-server) with a consumer key, consumer secret, token, and token secret, plus an X-Tradeshift-TenantId header on every request. Tradeshift uses polling via GET with a changedAfter timestamp filter rather than webhooks. The platform stores documents identified by documentProfileId but has no native GL account or dimension API; dimensions are embedded in UBL line items as coded text fields.

What moves between them

FreshBooks invoices and bill payments flow one direction: into Tradeshift. When FreshBooks sends an invoice or payment webhook event, ml-connector converts the FreshBooks JSON to Tradeshift UBL 2.2 XML format, maps the FreshBooks chart-of-accounts GL items to Tradeshift line-item code schemes, and posts the document into the Tradeshift network with an idempotency key to prevent duplicates if the webhook is retried. Payment documents reference the original invoice. Reference data such as bill vendors in FreshBooks are synced to Tradeshift company profiles so network routing is correct.

How ml-connector handles it

ml-connector stores FreshBooks OAuth credentials and Tradeshift OAuth 1.0a secrets encrypted in the cell database. When a FreshBooks webhook arrives, it verifies the HMAC-SHA256 signature using the registered webhook secret, then parses the invoice or payment object. The connector uses the FreshBooks chart-of-accounts resource to resolve GL accounts to Tradeshift account codes, constructs a UBL 2.2 invoice or credit note XML document with the mapped line items, and POSTs it to the Tradeshift API. Each post includes an idempotency key (derived from the FreshBooks object ID and account ID) so a webhook retry does not duplicate the document in Tradeshift. If a post fails due to a network error or a 429 rate limit from Tradeshift, ml-connector retries with exponential backoff. The Tradeshift tenant ID is stored per customer and included in every request header. Vendor names and email addresses from FreshBooks bills map to Tradeshift network participant identifiers; if a vendor does not have a Tradeshift network identity, the connector logs a recoverable error and queues the document for manual posting after the vendor is added to the network.

A real-world example

A small B2B service firm uses FreshBooks to manage invoicing and accounting. They have regular suppliers in a Tradeshift network and want to streamline the accounts payable process. Currently, when an invoice is received from a supplier, it is entered into FreshBooks by hand, then exported and re-entered into the Tradeshift portal by the AP team. With FreshBooks and Tradeshift connected via ml-connector, invoices entered into FreshBooks flow automatically into the Tradeshift network tagged with the correct GL account and vendor. The AP team no longer re-keys invoices, and they gain visibility into which suppliers have been notified and when payment is scheduled.

What you can do

  • Send FreshBooks invoices into Tradeshift as UBL 2.2 documents on the company network.
  • Convert FreshBooks chart-of-accounts GL items to Tradeshift line-item codes so accounting codes flow end-to-end.
  • Bridge FreshBooks OAuth 2.0 user-delegated credentials to Tradeshift OAuth 1.0a two-legged requests.
  • Verify FreshBooks webhook signatures with HMAC-SHA256 and post with idempotency keys to prevent duplicate documents in Tradeshift.
  • Map FreshBooks bill vendors to Tradeshift company profiles and handle missing vendor errors with audit logging and retry.

Questions

Does ml-connector send FreshBooks invoices or payments into Tradeshift?
Both. FreshBooks invoices and bill payments (when marked as sent) are converted to UBL 2.2 format and posted into the Tradeshift network. Payment documents are linked to their original invoices so the supplier network sees both the invoice and the payment record together.
How are FreshBooks chart-of-accounts codes mapped to Tradeshift?
FreshBooks GL account codes are resolved via the FreshBooks API and mapped to Tradeshift line-item account codes. The mapping is stored in the connector configuration per customer. If an account code is missing from the Tradeshift mapping, the document is logged as a warning and queued for manual review rather than dropped.
What happens if a FreshBooks webhook is retried or a FreshBooks vendor is not yet in the Tradeshift network?
ml-connector uses an idempotency key based on the FreshBooks object ID to ensure retries do not duplicate documents in Tradeshift. If a vendor is not found in the Tradeshift network, the connector logs a recoverable error with the vendor ID, queues the document for replay, and sends an alert so the AP team can add the vendor and trigger a retry.

Related integrations

Connect FreshBooks and Tradeshift

Free to use. Add your credentials, ping your real systems, and see if we fit.

Get started