{
 "openapi": "3.1.0",
 "info": {
  "title": "Utility Service Orders (CRM)",
  "version": "20261030b",
  "description": "Field work at a premise — start, stop, transfer, meter install or exchange, re-read, disconnect, reconnect, leak, high bill — assigned to a crew member and completed with the read or the new meter."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "util-service-orders": {
    "type": "object",
    "required": [],
    "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
     },
     "order_no": {
      "type": "string",
      "description": "Order no",
      "readOnly": true
     },
     "order_type": {
      "type": "string",
      "description": "Order type",
      "readOnly": true
     },
     "priority": {
      "type": "string",
      "description": "Priority",
      "enum": [
       "low",
       "normal",
       "high",
       "emergency"
      ]
     },
     "status": {
      "type": "string",
      "description": "Status",
      "readOnly": true
     },
     "service_account_id": {
      "type": "string",
      "format": "uuid",
      "description": "Service account id",
      "readOnly": true
     },
     "premise_id": {
      "type": "string",
      "format": "uuid",
      "description": "Premise id",
      "readOnly": true
     },
     "meter_id": {
      "type": "string",
      "format": "uuid",
      "description": "Meter id",
      "readOnly": true
     },
     "agreement_id": {
      "type": "string",
      "format": "uuid",
      "description": "Agreement id",
      "readOnly": true
     },
     "scheduled_date": {
      "type": "string",
      "format": "date",
      "description": "Scheduled"
     },
     "assigned_user_id": {
      "type": "string",
      "format": "uuid",
      "description": "Assigned user id",
      "readOnly": true
     },
     "description": {
      "type": "string",
      "description": "What to do"
     },
     "source": {
      "type": "string",
      "description": "Source",
      "readOnly": true
     },
     "request_id": {
      "type": "string",
      "format": "uuid",
      "description": "Request id",
      "readOnly": true
     },
     "alarm_id": {
      "type": "string",
      "format": "uuid",
      "description": "Alarm id",
      "readOnly": true
     },
     "exception_id": {
      "type": "string",
      "format": "uuid",
      "description": "Exception id",
      "readOnly": true
     },
     "started_at": {
      "type": "string",
      "format": "date-time",
      "description": "Started at",
      "readOnly": true
     },
     "completed_at": {
      "type": "string",
      "format": "date-time",
      "description": "Completed at",
      "readOnly": true
     },
     "completed_by": {
      "type": "string",
      "format": "uuid",
      "description": "Completed by",
      "readOnly": true
     },
     "completion_notes": {
      "type": "string",
      "description": "Completion notes",
      "readOnly": true
     },
     "completion_read": {
      "type": "string",
      "format": "decimal",
      "description": "Completion read",
      "readOnly": true
     },
     "new_meter_id": {
      "type": "string",
      "format": "uuid",
      "description": "New meter id",
      "readOnly": true
     },
     "new_meter_start_read": {
      "type": "string",
      "format": "decimal",
      "description": "New meter start read",
      "readOnly": true
     },
     "cancel_reason": {
      "type": "string",
      "description": "Cancel reason",
      "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
     },
     "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
     }
    }
   }
  }
 },
 "security": [
  {
   "bearer": []
  }
 ],
 "paths": {
  "/api/crm/util-service-orders": {
   "get": {
    "summary": "list util-service-orders",
    "operationId": "list_util_service_orders_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "create util-service-orders",
    "operationId": "create_util_service_orders_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/crm/util-service-orders/{id}": {
   "get": {
    "summary": "get util-service-orders",
    "operationId": "get_util_service_orders_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "change util-service-orders",
    "operationId": "change_util_service_orders_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "delete util-service-orders",
    "operationId": "delete_util_service_orders_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/crm/util-service-orders/{id}/assign": {
   "post": {
    "summary": "Assign",
    "operationId": "action_util_service_orders_0_6",
    "description": "Body keys: assigned_user_id, scheduled_date",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/crm/util-service-orders/{id}/start": {
   "post": {
    "summary": "Start",
    "operationId": "action_util_service_orders_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/crm/util-service-orders/{id}/complete": {
   "post": {
    "summary": "Complete",
    "operationId": "action_util_service_orders_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/crm/util-service-orders/{id}/cancel": {
   "post": {
    "summary": "Cancel",
    "operationId": "action_util_service_orders_0_6",
    "description": "Body keys: reason",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/crm/util-service-orders/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_util_service_orders_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"
     }
    }
   }
  }
 }
}