{
 "openapi": "3.1.0",
 "info": {
  "title": "Purchase Orders (Supply Chain)",
  "version": "20261030b",
  "description": "Read and maintain purchase orders records (scm.purchase_orders)."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "purchase-orders": {
    "type": "object",
    "required": [
     "supplier_id"
    ],
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id",
      "readOnly": true
     },
     "org_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org id",
      "readOnly": true
     },
     "po_no": {
      "type": "string",
      "description": "Po no",
      "readOnly": true
     },
     "supplier_id": {
      "type": "string",
      "format": "uuid",
      "description": "Supplier id"
     },
     "requisition_id": {
      "type": "string",
      "format": "uuid",
      "description": "Requisition id",
      "readOnly": true
     },
     "order_date": {
      "type": "string",
      "format": "date",
      "description": "Order date"
     },
     "promised_date": {
      "type": "string",
      "format": "date",
      "description": "Promised date"
     },
     "currency": {
      "type": "string",
      "description": "Currency"
     },
     "status": {
      "type": "string",
      "description": "Status"
     },
     "total": {
      "type": "string",
      "format": "decimal",
      "description": "Total"
     },
     "buyer_id": {
      "type": "string",
      "format": "uuid",
      "description": "Buyer id"
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Created at",
      "readOnly": true
     },
     "org_unit_id": {
      "type": "string",
      "format": "uuid",
      "description": "Organizational unit",
      "readOnly": true
     },
     "cost_center_id": {
      "type": "string",
      "format": "uuid",
      "description": "Cost center id",
      "readOnly": true
     },
     "profit_center_id": {
      "type": "string",
      "format": "uuid",
      "description": "Profit center id",
      "readOnly": true
     },
     "location_id": {
      "type": "string",
      "format": "uuid",
      "description": "Location",
      "readOnly": true
     },
     "warehouse_id": {
      "type": "string",
      "format": "uuid",
      "description": "Receive into warehouse",
      "readOnly": true
     },
     "cancelled_at": {
      "type": "string",
      "format": "date-time",
      "description": "Cancelled at",
      "readOnly": true
     },
     "cancelled_by": {
      "type": "string",
      "format": "uuid",
      "description": "Cancelled by",
      "readOnly": true
     },
     "cancel_reason": {
      "type": "string",
      "description": "Cancel reason",
      "readOnly": true
     },
     "reversed_by_id": {
      "type": "string",
      "format": "uuid",
      "description": "Reversed by id",
      "readOnly": true
     },
     "reverses_id": {
      "type": "string",
      "format": "uuid",
      "description": "Reverses id",
      "readOnly": true
     },
     "is_subcontract": {
      "type": "boolean",
      "description": "Is subcontract",
      "readOnly": true
     },
     "production_order_id": {
      "type": "string",
      "format": "uuid",
      "description": "Production order id",
      "readOnly": true
     },
     "production_operation_id": {
      "type": "string",
      "format": "uuid",
      "description": "Production operation id",
      "readOnly": true
     },
     "sales_order_id": {
      "type": "string",
      "format": "uuid",
      "description": "Sales order id",
      "readOnly": true
     },
     "config_id": {
      "type": "string",
      "format": "uuid",
      "description": "Config id",
      "readOnly": true
     },
     "exchange_rate": {
      "type": "string",
      "format": "decimal",
      "description": "Exchange rate"
     },
     "base_total": {
      "type": "string",
      "format": "decimal",
      "description": "Base total",
      "readOnly": true
     },
     "approval_status": {
      "type": "string",
      "description": "Approval status",
      "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
     },
     "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
     },
     "supplier_ack_status": {
      "type": "string",
      "description": "Supplier ack status",
      "readOnly": true
     },
     "supplier_ack_at": {
      "type": "string",
      "format": "date-time",
      "description": "Supplier ack at",
      "readOnly": true
     },
     "is_drop_ship": {
      "type": "boolean",
      "description": "Is drop ship",
      "readOnly": true
     },
     "ship_to_account_id": {
      "type": "string",
      "format": "uuid",
      "description": "Ship to account id",
      "readOnly": true
     },
     "ship_to_name": {
      "type": "string",
      "description": "Ship to name",
      "readOnly": true
     },
     "ship_to_address": {
      "type": "string",
      "description": "Ship to address",
      "readOnly": true
     },
     "project_id": {
      "type": "string",
      "format": "uuid",
      "description": "Project id",
      "readOnly": true
     },
     "po_type_id": {
      "type": "string",
      "format": "uuid",
      "description": "Po type id"
     },
     "payment_terms_id": {
      "type": "string",
      "format": "uuid",
      "description": "Payment terms"
     },
     "charges_total": {
      "type": "string",
      "format": "decimal",
      "description": "Charges total",
      "readOnly": true
     },
     "accrued_charges_total": {
      "type": "string",
      "format": "decimal",
      "description": "Accrued charges total",
      "readOnly": true
     }
    }
   }
  }
 },
 "security": [
  {
   "bearer": []
  }
 ],
 "paths": {
  "/api/scm/purchase-orders": {
   "get": {
    "summary": "list purchase-orders",
    "operationId": "list_purchase_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 purchase-orders",
    "operationId": "create_purchase_orders_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/purchase-orders/{id}": {
   "get": {
    "summary": "get purchase-orders",
    "operationId": "get_purchase_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 purchase-orders",
    "operationId": "change_purchase_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 purchase-orders",
    "operationId": "delete_purchase_orders_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/purchase-orders/{id}/subcontract-components": {
   "get": {
    "summary": "Subcontract components",
    "operationId": "action_purchase_orders_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "Subcontract components",
    "operationId": "action_purchase_orders_1_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/purchase-orders/new-defaults": {
   "get": {
    "summary": "New defaults",
    "operationId": "action_purchase_orders_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/purchase-orders/price-for": {
   "get": {
    "summary": "Price for",
    "operationId": "action_purchase_orders_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/purchase-orders/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_purchase_orders_0_6",
    "description": "Body keys: overrides",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/purchase-orders/{id}/approvals": {
   "get": {
    "summary": "Approvals",
    "operationId": "action_purchase_orders_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/purchase-orders/{id}/approval-preview": {
   "get": {
    "summary": "Approval preview",
    "operationId": "action_purchase_orders_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/purchase-orders/{id}/submit-for-approval": {
   "post": {
    "summary": "Submit for approval",
    "operationId": "action_purchase_orders_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/purchase-orders/{id}/open": {
   "post": {
    "summary": "Open",
    "operationId": "action_purchase_orders_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/purchase-orders/{parentId}/lines": {
   "get": {
    "summary": "Lines",
    "operationId": "action_purchase_orders_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "Lines",
    "operationId": "action_purchase_orders_1_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/purchase-orders/{parentId}/lines/{lineId}": {
   "put": {
    "summary": "Lines",
    "operationId": "action_purchase_orders_0_7",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "Lines",
    "operationId": "action_purchase_orders_1_7",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/purchase-orders/{id}/lines": {
   "get": {
    "summary": "Lines",
    "operationId": "action_purchase_orders_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/purchase-orders/create-with-lines": {
   "post": {
    "summary": "Create with lines",
    "operationId": "action_purchase_orders_0_5",
    "description": "Body keys: orgUnitId, org_unit_id, documentNo, exchangeRate, poTypeId, po_type_id, supplierId*, promisedDate, currency, costCenterId, profitCenterId, locationId, warehouseId; lines*: [{ quantity, unitPrice, itemId, uom, currency, exchangeRate, costCenterId, base }]",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/purchase-orders/{id}/receive": {
   "post": {
    "summary": "Receive",
    "operationId": "action_purchase_orders_0_6",
    "description": "Body keys: lines, exchangeRate",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  }
 }
}