{
 "openapi": "3.1.0",
 "info": {
  "title": "Supplier · Buying Context (Supply Chain)",
  "version": "20261030b",
  "description": "What each business unit is allowed to do with this supplier, and until when the approval lasts."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "supplier-orgs": {
    "type": "object",
    "required": [
     "supplier_id",
     "org_unit_id"
    ],
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id",
      "readOnly": true
     },
     "org_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org id",
      "readOnly": true
     },
     "supplier_id": {
      "type": "string",
      "format": "uuid",
      "description": "Supplier"
     },
     "org_unit_id": {
      "type": "string",
      "format": "uuid",
      "description": "Business unit"
     },
     "local_supplier_no": {
      "type": "string",
      "description": "Local supplier no"
     },
     "currency": {
      "type": "string",
      "description": "Currency"
     },
     "payment_terms_id": {
      "type": "string",
      "format": "uuid",
      "description": "Payment terms"
     },
     "buyer_id": {
      "type": "string",
      "format": "uuid",
      "description": "Buyer id"
     },
     "is_approved": {
      "type": "boolean",
      "description": "Is approved"
     },
     "approval_status": {
      "type": "string",
      "description": "Approval status",
      "enum": [
       "prospective",
       "pending",
       "approved",
       "conditional",
       "suspended",
       "debarred"
      ]
     },
     "approved_by": {
      "type": "string",
      "format": "uuid",
      "description": "Approved by"
     },
     "approved_on": {
      "type": "string",
      "format": "date",
      "description": "Approved on"
     },
     "approval_expires_on": {
      "type": "string",
      "format": "date",
      "description": "Approval expires"
     },
     "spend_limit": {
      "type": "string",
      "format": "decimal",
      "description": "Spend limit"
     },
     "requires_contract": {
      "type": "boolean",
      "description": "Requires a contract"
     },
     "contract_id": {
      "type": "string",
      "format": "uuid",
      "description": "Contract id"
     },
     "is_preferred": {
      "type": "boolean",
      "description": "Preferred supplier"
     },
     "is_single_source": {
      "type": "boolean",
      "description": "Single source"
     },
     "expense_account_no": {
      "type": "string",
      "description": "Expense account no"
     },
     "payable_account_no": {
      "type": "string",
      "description": "Payable account 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/scm/supplier-orgs": {
   "get": {
    "summary": "list supplier-orgs",
    "operationId": "list_supplier_orgs_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "create supplier-orgs",
    "operationId": "create_supplier_orgs_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/supplier-orgs/{id}": {
   "get": {
    "summary": "get supplier-orgs",
    "operationId": "get_supplier_orgs_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "change supplier-orgs",
    "operationId": "change_supplier_orgs_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "delete supplier-orgs",
    "operationId": "delete_supplier_orgs_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/supplier-orgs/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_supplier_orgs_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"
     }
    }
   }
  }
 }
}