{
 "openapi": "3.1.0",
 "info": {
  "title": "Expense Lines (Accounting)",
  "version": "20261030b",
  "description": "A line that needed a receipt and has none is the commonest reason a claim is queried, so the board says so on the face of it."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "expense-lines": {
    "type": "object",
    "required": [
     "report_id",
     "line_no",
     "expense_date",
     "expense_type",
     "amount"
    ],
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id",
      "readOnly": true
     },
     "report_id": {
      "type": "string",
      "format": "uuid",
      "description": "Claim"
     },
     "line_no": {
      "type": "integer",
      "description": "Line"
     },
     "expense_date": {
      "type": "string",
      "format": "date",
      "description": "Date"
     },
     "expense_type": {
      "type": "string",
      "description": "Category"
     },
     "description": {
      "type": "string",
      "description": "Description"
     },
     "merchant": {
      "type": "string",
      "description": "Merchant"
     },
     "amount": {
      "type": "string",
      "format": "decimal",
      "description": "Amount"
     },
     "currency": {
      "type": "string",
      "description": "Currency"
     },
     "exchange_rate": {
      "type": "string",
      "format": "decimal",
      "description": "Exchange rate"
     },
     "base_amount": {
      "type": "string",
      "format": "decimal",
      "description": "Base amount",
      "readOnly": true
     },
     "is_billable": {
      "type": "boolean",
      "description": "Billable"
     },
     "is_company_paid": {
      "type": "boolean",
      "description": "Is company paid",
      "readOnly": true
     },
     "card_id": {
      "type": "string",
      "format": "uuid",
      "description": "Card id",
      "readOnly": true
     },
     "has_receipt": {
      "type": "boolean",
      "description": "Receipt attached"
     },
     "receipt_ref": {
      "type": "string",
      "description": "Receipt reference"
     },
     "gl_account_id": {
      "type": "string",
      "format": "uuid",
      "description": "Account"
     },
     "cost_center_id": {
      "type": "string",
      "format": "uuid",
      "description": "Cost center"
     },
     "policy_id": {
      "type": "string",
      "format": "uuid",
      "description": "Policy id",
      "readOnly": true
     },
     "violation": {
      "type": "string",
      "description": "Violation",
      "readOnly": true
     },
     "violation_severity": {
      "type": "string",
      "description": "Violation severity",
      "readOnly": true
     },
     "org_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org id",
      "readOnly": true
     },
     "org_unit_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org unit id",
      "readOnly": true
     },
     "expense_type_id": {
      "type": "string",
      "format": "uuid",
      "description": "Expense type"
     },
     "city": {
      "type": "string",
      "description": "City"
     },
     "country": {
      "type": "string",
      "description": "Country"
     },
     "tax_amount": {
      "type": "string",
      "format": "decimal",
      "description": "Tax"
     },
     "tax_code_id": {
      "type": "string",
      "format": "uuid",
      "description": "Tax code"
     },
     "reclaimable_tax": {
      "type": "string",
      "format": "decimal",
      "description": "Recoverable tax"
     },
     "quantity": {
      "type": "string",
      "format": "decimal",
      "description": "Quantity"
     },
     "rate": {
      "type": "string",
      "format": "decimal",
      "description": "Rate"
     },
     "distance": {
      "type": "string",
      "format": "decimal",
      "description": "Distance"
     },
     "distance_unit": {
      "type": "string",
      "description": "Distance unit",
      "enum": [
       "km",
       "mile"
      ]
     },
     "nights": {
      "type": "integer",
      "description": "Nights"
     },
     "attendees": {
      "type": "integer",
      "description": "Attendees"
     },
     "attendee_names": {
      "type": "string",
      "description": "Attendee names"
     },
     "project_id": {
      "type": "string",
      "format": "uuid",
      "description": "Project"
     },
     "wbs_element_id": {
      "type": "string",
      "format": "uuid",
      "description": "Work breakdown element"
     },
     "account_id": {
      "type": "string",
      "format": "uuid",
      "description": "Customer"
     },
     "is_billed": {
      "type": "boolean",
      "description": "Is billed",
      "readOnly": true
     },
     "is_personal": {
      "type": "boolean",
      "description": "Personal — not claimed"
     },
     "is_taxable_benefit": {
      "type": "boolean",
      "description": "Is taxable benefit",
      "readOnly": true
     },
     "payment_method": {
      "type": "string",
      "description": "Paid by",
      "enum": [
       "personal",
       "corporate_card",
       "company_paid",
       "cash_advance",
       "central_billing"
      ]
     },
     "card_transaction_id": {
      "type": "string",
      "format": "uuid",
      "description": "Card charge"
     },
     "booking_id": {
      "type": "string",
      "format": "uuid",
      "description": "Booking"
     },
     "receipt_id": {
      "type": "string",
      "format": "uuid",
      "description": "Receipt"
     },
     "approved_amount": {
      "type": "string",
      "format": "decimal",
      "description": "Approved amount",
      "readOnly": true
     },
     "adjustment_reason": {
      "type": "string",
      "description": "Adjustment reason",
      "readOnly": true
     },
     "status": {
      "type": "string",
      "description": "Status",
      "readOnly": true
     },
     "policy_violations": {
      "type": "object",
      "description": "Policy violations",
      "readOnly": true
     },
     "justification": {
      "type": "string",
      "description": "Justification"
     },
     "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_at": {
      "type": "string",
      "format": "date-time",
      "description": "Created at",
      "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
     },
     "fund_id": {
      "type": "string",
      "format": "uuid",
      "description": "Fund id",
      "readOnly": true
     },
     "grant_id": {
      "type": "string",
      "format": "uuid",
      "description": "Grant id",
      "readOnly": true
     },
     "program_id": {
      "type": "string",
      "format": "uuid",
      "description": "Program id",
      "readOnly": true
     },
     "function_id": {
      "type": "string",
      "format": "uuid",
      "description": "Function id",
      "readOnly": true
     },
     "derivation_trace": {
      "type": "object",
      "description": "Derivation trace",
      "readOnly": true
     }
    }
   }
  }
 },
 "security": [
  {
   "bearer": []
  }
 ],
 "paths": {
  "/api/accounting/expense-lines": {
   "get": {
    "summary": "list expense-lines",
    "operationId": "list_expense_lines_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "create expense-lines",
    "operationId": "create_expense_lines_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/expense-lines/{id}": {
   "get": {
    "summary": "get expense-lines",
    "operationId": "get_expense_lines_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "change expense-lines",
    "operationId": "change_expense_lines_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "delete expense-lines",
    "operationId": "delete_expense_lines_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/expense-lines/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_expense_lines_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"
     }
    }
   }
  }
 }
}