{
 "openapi": "3.1.0",
 "info": {
  "title": "Customer · Financial (CRM)",
  "version": "20261030b",
  "description": "Terms, payment method, how invoices are grouped and what happens when they do not pay — at account level, or overridden per site."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "customer-financials": {
    "type": "object",
    "required": [
     "account_id"
    ],
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id",
      "readOnly": true
     },
     "org_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org id",
      "readOnly": true
     },
     "account_id": {
      "type": "string",
      "format": "uuid",
      "description": "Account"
     },
     "site_id": {
      "type": "string",
      "format": "uuid",
      "description": "Site (empty = the whole account)"
     },
     "org_unit_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org unit id"
     },
     "currency": {
      "type": "string",
      "description": "Currency"
     },
     "payment_terms_id": {
      "type": "string",
      "format": "uuid",
      "description": "Payment terms"
     },
     "payment_method": {
      "type": "string",
      "description": "Payment method",
      "enum": [
       "check",
       "ach",
       "wire",
       "card",
       "direct_debit",
       "cash",
       "bill_of_exchange"
      ]
     },
     "bank_name": {
      "type": "string",
      "description": "Bank name"
     },
     "bank_account_last4": {
      "type": "string",
      "description": "Bank account last4"
     },
     "mandate_reference": {
      "type": "string",
      "description": "Mandate reference"
     },
     "mandate_signed_on": {
      "type": "string",
      "format": "date",
      "description": "Mandate signed on"
     },
     "invoice_grouping": {
      "type": "string",
      "description": "Invoices grouped",
      "enum": [
       "per_order",
       "per_delivery",
       "per_site",
       "consolidated_monthly",
       "per_po"
      ]
     },
     "statement_cycle": {
      "type": "string",
      "description": "Statement cycle",
      "enum": [
       "none",
       "weekly",
       "monthly",
       "quarterly"
      ]
     },
     "dunning_profile": {
      "type": "string",
      "description": "Dunning profile"
     },
     "is_dunning_exempt": {
      "type": "boolean",
      "description": "Exempt from dunning"
     },
     "late_fee_pct": {
      "type": "string",
      "format": "decimal",
      "description": "Late fee %"
     },
     "standard_discount_pct": {
      "type": "string",
      "format": "decimal",
      "description": "Standard discount %"
     },
     "early_settlement_discount_pct": {
      "type": "string",
      "format": "decimal",
      "description": "Early settlement discount %"
     },
     "rebate_scheme": {
      "type": "string",
      "description": "Rebate scheme"
     },
     "withholding_tax_pct": {
      "type": "string",
      "format": "decimal",
      "description": "Withholding tax %"
     },
     "tax_registration_no": {
      "type": "string",
      "description": "Tax registration no"
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Created at",
      "readOnly": true
     },
     "effective_from": {
      "type": "string",
      "format": "date",
      "description": "In force from"
     },
     "effective_to": {
      "type": "string",
      "format": "date",
      "description": "Until"
     },
     "xf_text_1": {
      "type": "string",
      "description": "Xf text 1",
      "readOnly": true
     },
     "xf_text_2": {
      "type": "string",
      "description": "Xf text 2",
      "readOnly": true
     },
     "xf_text_3": {
      "type": "string",
      "description": "Xf text 3",
      "readOnly": true
     },
     "xf_text_4": {
      "type": "string",
      "description": "Xf text 4",
      "readOnly": true
     },
     "xf_text_5": {
      "type": "string",
      "description": "Xf text 5",
      "readOnly": true
     },
     "xf_num_1": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 1",
      "readOnly": true
     },
     "xf_num_2": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 2",
      "readOnly": true
     },
     "xf_num_3": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 3",
      "readOnly": true
     },
     "xf_date_1": {
      "type": "string",
      "format": "date",
      "description": "Xf date 1",
      "readOnly": true
     },
     "xf_date_2": {
      "type": "string",
      "format": "date",
      "description": "Xf date 2",
      "readOnly": true
     },
     "created_by": {
      "type": "string",
      "format": "uuid",
      "description": "Created by",
      "readOnly": true
     },
     "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "Updated at",
      "readOnly": true
     },
     "updated_by": {
      "type": "string",
      "format": "uuid",
      "description": "Updated by",
      "readOnly": true
     }
    }
   }
  }
 },
 "security": [
  {
   "bearer": []
  }
 ],
 "paths": {
  "/api/crm/customer-financials": {
   "get": {
    "summary": "list customer-financials",
    "operationId": "list_customer_financials_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "create customer-financials",
    "operationId": "create_customer_financials_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/crm/customer-financials/{id}": {
   "get": {
    "summary": "get customer-financials",
    "operationId": "get_customer_financials_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "change customer-financials",
    "operationId": "change_customer_financials_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "delete customer-financials",
    "operationId": "delete_customer_financials_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/crm/customer-financials/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_customer_financials_0_6",
    "description": "Body keys: overrides, preview, withLines",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  }
 }
}