Skip to main content

Apply Financial Line Backfill

POST 

/api/faire/instances/:integrationInstance/financial-line-overrides/backfill

Re-key past Faire-imported FinancialLine rows to the override types that are already persisted on the integration instance. No request body — the overrides are read off integration_settings.financial_line_type_overrides, which is set via the Update Faire Instance endpoint.

Authorization

Any valid API token can call this endpoint — no specific scope required. Manage tokens.

Branches covered: commission, payout_fee, payout_protection_fee, damaged_and_missing_items (all cost), covered_shipping (revenue).

Behavior per row:

  • Updates financial_line_type_id to the override's ID.
  • Copies the override's nominal_code_id onto the row (so accounting export reflects the new mapping).
  • Does not change line amount, currency, or any other monetary field.
  • Branches with no override configured (or set to null) are skipped entirely — those past rows keep their existing default Faire types.

Typical flow:

  1. User changes overrides in the Faire settings UI.
  2. UI calls PUT /api/faire/instances/{id} with the new financial_line_type_overrides (this also passes the classification guard).
  3. UI calls POST .../financial-line-overrides/preview-backfill to show the count to the user.
  4. If the user confirms, UI calls this endpoint to apply the change to historical rows.

Response: Returns a { commission, payout_fee, payout_protection_fee, damaged_and_missing_items, covered_shipping, total } object where each number is the count of rows actually updated (i.e., rows whose existing type differed from the override). total is the sum across branches.

Request

Responses

OK

Response Headers
    Content-Type