FreshBooks integration · key: freshbooks
FreshBooks API integration and webhooks
AccountingKit integrates with FreshBooks through OAuth 2.0 with locked single-use refresh-token rotation and /users/me business discovery, normalizing organizations, clients, invoices, payments, and tax rates while verifying X-FreshBooks-Hmac-SHA256 webhooks and running day-overlap incremental sync.
Capability summary
| Authentication | FreshBooks OAuth 2.0 with serialized single-use refresh-token rotation and /users/me accounting-business filtering. |
|---|---|
| Webhooks | Callback verifier handshake plus constant-time X-FreshBooks-Hmac-SHA256 verification and live invoice/payment reconciliation. |
| Attachments | Not exposed in v1. |
| Financial reports | Profit and Loss reports return provider_unsupported in v1. |
| Provider actions | Unpaid invoice soft-delete cancellation (vis_state: 1); FreshBooks REST API has no public binary PDF download endpoint. |
| Synchronization | Full sync, day-overlap incremental sync (updated_min minus 1 day), and hourly invoice reconciliation. |
Key capabilities
Serialized single-use refresh-token rotation
FreshBooks invalidates the old refresh token on every refresh. AccountingKit holds a per-connection database lock and persists each replacement token atomically.
Exact X-FreshBooks-Hmac-SHA256 verification
Canonicalizes form-urlencoded webhook bodies to match FreshBooks’ Python json.dumps signature rule, rejects ambiguous duplicate keys, and handles callback.verify handshakes.
Day-overlap incremental sync
Because FreshBooks search[updated_min] accepts YYYY-MM-DD dates without timestamps, AccountingKit applies a 1-day overlap and deduplicates on provider_updated_at.
Automatic due-date offset calculation
Pass standard ISO issue_date and due_date values and AccountingKit computes FreshBooks’ due_offset_days automatically without modifying vis_state during updates.
Supported resources and operations
| Normalized resource | FreshBooks object | Read | Write | Notes |
|---|---|---|---|---|
| Organizations | /users/me | Yes | Read-only | Filters out client-only memberships lacking an account_id. |
| Contacts | users/clients | Yes | Yes | FreshBooks clients normalized to canonical contacts. |
| Invoices | invoices/invoices | Yes | Yes | Computes due_offset_days automatically; cancel sets vis_state: 1. |
| Payments | payments/payments | Yes | Yes | Supports provider_options.freshbooks.payment_type and invoice allocations. |
| Tax rates | taxes/taxes | Yes | Read-only | Exact decimal percentage strings preserved. |
Example API request
Every write requires an Idempotency-Key header and returns a normalized response shape shared across all six providers. Read the full FreshBooks technical guide for setup steps and field mappings, or validate payloads with our remote MCP server.
curl --request POST "https://api.accountingkit.dev/v1/connections/$CONNECTION_ID/invoices" \
--header "Authorization: Bearer $ACCOUNTINGKIT_API_KEY" \
--header "Idempotency-Key: invoice-order-10042" \
--header "Content-Type: application/json" \
--data '{
"external_reference": "order_10042",
"contact_id": "12345",
"issue_date": "2026-11-27",
"due_date": "2026-12-27",
"status": "authorised",
"line_items": [{"description": "Advisory retainer", "quantity": 1, "unit_amount": 1500}]
}'Operational details and known limits
Operational behavior
- FreshBooks silently caps per_page at 100; AccountingKit pages through results transparently.
- Client-only FreshBooks memberships without an account_id are filtered out during OAuth discovery so only real businesses connect.
- Pass status: "authorised" to mark a new invoice as sent (action_mark_as_sent: true); omit it to keep a draft.
Not supported in this release
- Chart of accounts, purchase orders, quotes, credit notes, overpayments, prepayments, branding themes, and Profit and Loss reports return provider_unsupported.
- invoice.download_pdf, invoice.get_online_url, and organization.get_deep_link return 400 because FreshBooks REST exposes no public binary PDF download or share-link endpoint.
- Invoices with applied payments cannot be cancelled and return 409.
Common questions
How does AccountingKit handle FreshBooks single-use refresh tokens?
AccountingKit serializes token refreshes behind a per-connection lock, persists each new refresh token atomically before returning it, and rejects any refresh response that omits a replacement token.
Can AccountingKit verify FreshBooks webhooks automatically?
Yes. AccountingKit handles FreshBooks callback.verify challenges and verifies X-FreshBooks-Hmac-SHA256 signatures in constant time before enqueueing live invoice or payment reconciliation.
