{
 "openapi": "3.1.0",
 "info": {
  "title": "Revenue Contracts (Accounting)",
  "version": "20261030b",
  "description": "Invoicing and revenue are not the same event, and this is where the difference is held. Allocation is a decision; the schedule is its consequence."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "rev-contracts": {
    "type": "object",
    "required": [
     "name"
    ],
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id",
      "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
     },
     "contract_no": {
      "type": "string",
      "description": "Contract no",
      "readOnly": true
     },
     "name": {
      "type": "string",
      "description": "Name"
     },
     "account_id": {
      "type": "string",
      "format": "uuid",
      "description": "Customer"
     },
     "opportunity_id": {
      "type": "string",
      "format": "uuid",
      "description": "Opportunity"
     },
     "sales_order_id": {
      "type": "string",
      "format": "uuid",
      "description": "Sales order id"
     },
     "project_id": {
      "type": "string",
      "format": "uuid",
      "description": "Project"
     },
     "contract_date": {
      "type": "string",
      "format": "date",
      "description": "Contract date"
     },
     "start_date": {
      "type": "string",
      "format": "date",
      "description": "Start"
     },
     "end_date": {
      "type": "string",
      "format": "date",
      "description": "End"
     },
     "term_months": {
      "type": "integer",
      "description": "Term (months)"
     },
     "currency": {
      "type": "string",
      "description": "Currency"
     },
     "contract_value": {
      "type": "string",
      "format": "decimal",
      "description": "Contract value"
     },
     "variable_consideration": {
      "type": "string",
      "format": "decimal",
      "description": "Variable consideration"
     },
     "constraint_amount": {
      "type": "string",
      "format": "decimal",
      "description": "Constrained amount"
     },
     "refund_liability": {
      "type": "string",
      "format": "decimal",
      "description": "Expected refunds"
     },
     "transaction_price": {
      "type": "string",
      "format": "decimal",
      "description": "Transaction price",
      "readOnly": true
     },
     "has_financing_component": {
      "type": "boolean",
      "description": "Significant financing component"
     },
     "financing_rate_pct": {
      "type": "string",
      "format": "decimal",
      "description": "Financing rate %"
     },
     "commission_amount": {
      "type": "string",
      "format": "decimal",
      "description": "Commission (cost to obtain)"
     },
     "fulfilment_cost": {
      "type": "string",
      "format": "decimal",
      "description": "Fulfilment cost"
     },
     "modifies_contract_id": {
      "type": "string",
      "format": "uuid",
      "description": "Modifies contract id",
      "readOnly": true
     },
     "modification_type": {
      "type": "string",
      "description": "Modification type",
      "readOnly": true
     },
     "version": {
      "type": "integer",
      "description": "Version",
      "readOnly": true
     },
     "status": {
      "type": "string",
      "description": "Status",
      "readOnly": true
     },
     "allocated_at": {
      "type": "string",
      "format": "date-time",
      "description": "Allocated at",
      "readOnly": true
     },
     "allocated_by": {
      "type": "string",
      "format": "uuid",
      "description": "Allocated by",
      "readOnly": true
     },
     "principle_id": {
      "type": "string",
      "format": "uuid",
      "description": "Accounting principle"
     },
     "notes": {
      "type": "string",
      "description": "Notes"
     },
     "created_by": {
      "type": "string",
      "format": "uuid",
      "description": "Created by",
      "readOnly": true
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Created at",
      "readOnly": true
     },
     "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
     },
     "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "Updated at",
      "readOnly": true
     },
     "updated_by": {
      "type": "string",
      "format": "uuid",
      "description": "Updated by",
      "readOnly": true
     },
     "completed_by": {
      "type": "string",
      "format": "uuid",
      "description": "Completed by",
      "readOnly": true
     },
     "completed_at": {
      "type": "string",
      "format": "date-time",
      "description": "Completed at",
      "readOnly": true
     }
    }
   }
  }
 },
 "security": [
  {
   "bearer": []
  }
 ],
 "paths": {
  "/api/accounting/rev-contracts": {
   "get": {
    "summary": "list rev-contracts",
    "operationId": "list_rev_contracts_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "create rev-contracts",
    "operationId": "create_rev_contracts_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/rev-contracts/{id}": {
   "get": {
    "summary": "get rev-contracts",
    "operationId": "get_rev_contracts_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "change rev-contracts",
    "operationId": "change_rev_contracts_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "delete rev-contracts",
    "operationId": "delete_rev_contracts_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/rev-contracts/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_rev_contracts_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"
     }
    }
   }
  },
  "/api/accounting/rev-contracts/{id}/complete": {
   "post": {
    "summary": "Complete",
    "operationId": "action_rev_contracts_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/rev-contracts/{parentId}/obligations": {
   "get": {
    "summary": "Obligations",
    "operationId": "action_rev_contracts_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "Obligations",
    "operationId": "action_rev_contracts_1_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/rev-contracts/{parentId}/obligations/{lineId}": {
   "put": {
    "summary": "Obligations",
    "operationId": "action_rev_contracts_0_7",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "Obligations",
    "operationId": "action_rev_contracts_1_7",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/rev-contracts/{parentId}/billings": {
   "get": {
    "summary": "Billings",
    "operationId": "action_rev_contracts_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "Billings",
    "operationId": "action_rev_contracts_1_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/rev-contracts/{parentId}/billings/{lineId}": {
   "put": {
    "summary": "Billings",
    "operationId": "action_rev_contracts_0_7",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "Billings",
    "operationId": "action_rev_contracts_1_7",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  }
 }
}