ml-connector
FreshBooksSFTP / Flat Files

FreshBooks and SFTP / Flat Files integration

FreshBooks manages your invoicing, bills, and general ledger. SFTP / Flat Files connects you to legacy systems and EDI partners via file transfer. Linking the two keeps invoices, bills, and payments flowing without manual re-entry. Invoices from FreshBooks flow to trading partners as CSV or EDI files, and incoming remittances and GL postings from your partners land back in FreshBooks automatically. ml-connector handles the OAuth 2.0 and SSH key authentication on each side and moves the data on a schedule you control.

How FreshBooks works

FreshBooks exposes invoices, bills, bill vendors, payments, expenses, chart of accounts, items, journal entries, and other accounting entities through a REST API at https://api.freshbooks.com. Authentication uses OAuth 2.0 user delegation (not Client Credentials), with granular scopes per resource. FreshBooks can push webhook notifications to a customer-supplied endpoint when invoices, bills, payments, and other accounting events occur, with event types such as invoice.create, bill.update, payment.delete, and journal_entry changes. Webhook payloads are signed via HMAC-SHA256 and include object ID, account ID, and event metadata. Webhook delivery is not real-time and can range from seconds to several minutes, and if a callback does not return 2xx or times out after 10 seconds, FreshBooks retries and eventually disables the callback.

How SFTP / Flat Files works

SFTP / Flat Files transfers data via SSH File Transfer Protocol (SFTP) over TCP port 22. Each trading partner or destination server provides its own host address, not a shared base URL. Authentication uses SSH keys (recommended) or username and password, both sent over the encrypted SSH channel. Files are organized in standard folders: inbound for files to receive, outbound for files to send, processed for completed transfers, error for rejected files, and acks for EDI acknowledgments (X12 997 or EDIFACT CONTRL). The connector is pull-only and polls the SFTP server on a schedule (typically 5 to 60 minutes) to discover new files. File formats and column layouts are partner-specific, such as CSV, X12 EDI, EDIFACT, XML, or fixed-width, and each trading relationship requires a separate mapping spec.

What moves between them

Invoices and bills created or updated in FreshBooks trigger webhooks that ml-connector receives and converts to CSV or EDI format, then uploads to the SFTP partner's inbound folder on a schedule you set. Conversely, incoming remittance files (payments) and GL journal files from the SFTP server are polled, parsed according to the mapping, and posted back into FreshBooks as payments and journal entries. Vendor and customer reference data is synchronized bidirectionally to keep the two systems aligned. All transfers include EDI acknowledgments where required, and every record carries an audit trail.

How ml-connector handles it

ml-connector authenticates to FreshBooks using the OAuth 2.0 authorization token you provide and subscribes to invoice, bill, and payment webhook events. When events arrive, ml-connector buffers them and converts the JSON records into the file format and layout specified for your SFTP partner (typically CSV, but X12 or EDIFACT if required). On the outbound schedule you set, ml-connector connects to the SFTP server using SSH key authentication or username and password, uploads the formatted files to the inbound folder, and moves any processed files to the processed folder. For inbound files, ml-connector polls the SFTP inbound folder on schedule, downloads new files, parses them according to the column mapping you provide, and creates payments and journal entries in FreshBooks. If a file fails to parse or a FreshBooks call returns an error, the file is moved to the error folder and logged so you can replay it manually. Host key verification is required for production SFTP connections to prevent man-in-the-middle attacks.

A real-world example

A small business runs FreshBooks for invoicing and accounting and ships products to a mid-market distributor that accepts orders and remittances only via SFTP as CSV files. Before the integration, the accounting team exported invoices from FreshBooks manually once a week, formatted them as CSV, and uploaded them to the distributor's SFTP server. The distributor sent back payment files weekly, and the team had to download, parse, and re-enter each payment into FreshBooks by hand. With FreshBooks and SFTP / Flat Files connected, invoices flow automatically as formatted CSV files, and incoming payment files are parsed and posted into FreshBooks as payment records without manual intervention. The accounting team now spends minutes on what once took hours each week.

What you can do

  • Convert FreshBooks invoices and bills to CSV or EDI format and upload them to your SFTP partner's inbound folder on schedule.
  • Receive payment and remittance files from SFTP, parse them according to your column mapping, and post payments into FreshBooks automatically.
  • Authenticate FreshBooks via OAuth 2.0 and SFTP partners via SSH keys or username and password, with full credential encryption.
  • Handle webhook signature verification on FreshBooks events and keep audit logs of every record transferred, with error files moved to a separate folder for manual replay.
  • Sync vendor and customer reference data bidirectionally so both systems stay aligned and payments post to the correct accounts.

Questions

What file formats does the integration support for SFTP?
The connector supports CSV, X12 EDI (850 purchase orders, 810 invoices, 820 payments, 997 acknowledgments), EDIFACT (ORDERS, INVOIC, REMADV, CONTRL), XML, and fixed-width text files. The format and column layout are configured per trading partner based on the mapping spec you provide.
How often does the integration sync files between FreshBooks and SFTP?
Outbound synchronization (FreshBooks to SFTP) runs on a schedule you set, typically 5 to 60 minutes. Inbound polling (SFTP to FreshBooks) also runs on a schedule you choose. FreshBooks webhook events are received in real-time, but file uploads happen only on the outbound schedule you define.
What happens if an incoming SFTP file fails to parse or a FreshBooks post fails?
ml-connector moves files that fail to parse to the error folder and logs the failure. You can then manually correct the file and re-upload it, or replay the original file from the processed folder. If a FreshBooks API call fails, ml-connector retries with exponential backoff before moving the file to error.

Related integrations

Connect FreshBooks and SFTP / Flat Files

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

Get started