{
 "openapi": "3.1.0",
 "info": {
  "title": "Customer Addresses (CRM)",
  "version": "20261030b",
  "description": "One customer, several places: where it orders from, where the invoice goes, where the goods go and which warehouse takes them in. Purposes are independent ticks because one address is very often both ship-to and bill-to."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "customer-sites": {
    "type": "object",
    "required": [
     "account_id",
     "site_no",
     "name"
    ],
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id",
      "readOnly": true
     },
     "org_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org id",
      "readOnly": true
     },
     "account_id": {
      "type": "string",
      "format": "uuid",
      "description": "Account"
     },
     "site_no": {
      "type": "string",
      "description": "Site number"
     },
     "name": {
      "type": "string",
      "description": "Name"
     },
     "address_id": {
      "type": "string",
      "format": "uuid",
      "description": "Or choose from the address book"
     },
     "is_sold_to": {
      "type": "boolean",
      "description": "Ordering address (sold-to)"
     },
     "is_ship_to": {
      "type": "boolean",
      "description": "Shipping address (ship-to)"
     },
     "is_bill_to": {
      "type": "boolean",
      "description": "Invoicing address (bill-to)"
     },
     "is_payer": {
      "type": "boolean",
      "description": "Sends the money"
     },
     "is_install_at": {
      "type": "boolean",
      "description": "Equipment lives here"
     },
     "is_service_at": {
      "type": "boolean",
      "description": "Serviced here"
     },
     "is_primary": {
      "type": "boolean",
      "description": "Default for its purposes"
     },
     "selling_org_unit_id": {
      "type": "string",
      "format": "uuid",
      "description": "Sold by which business unit"
     },
     "ship_via": {
      "type": "string",
      "description": "Ship via"
     },
     "freight_terms": {
      "type": "string",
      "description": "Freight terms",
      "enum": [
       "prepaid",
       "collect",
       "prepaid_and_add",
       "third_party",
       "ex_works"
      ]
     },
     "incoterm": {
      "type": "string",
      "description": "Incoterm"
     },
     "delivery_lead_days": {
      "type": "integer",
      "description": "Delivery lead days"
     },
     "delivery_window": {
      "type": "string",
      "description": "Receiving notes"
     },
     "delivery_instructions": {
      "type": "string",
      "description": "Delivery instructions"
     },
     "requires_appointment": {
      "type": "boolean",
      "description": "Delivery needs an appointment"
     },
     "source_warehouse_id": {
      "type": "string",
      "format": "uuid",
      "description": "Normally served from"
     },
     "invoice_delivery": {
      "type": "string",
      "description": "Invoice sent by",
      "enum": [
       "email",
       "post",
       "edi",
       "portal",
       "none"
      ]
     },
     "invoice_email": {
      "type": "string",
      "description": "Invoice email"
     },
     "requires_po_number": {
      "type": "boolean",
      "description": "Their PO number is required"
     },
     "customer_reference": {
      "type": "string",
      "description": "Customer reference"
     },
     "tax_registration_no": {
      "type": "string",
      "description": "Tax registration"
     },
     "tax_jurisdiction": {
      "type": "string",
      "description": "Tax jurisdiction"
     },
     "is_tax_exempt": {
      "type": "boolean",
      "description": "Tax exempt"
     },
     "tax_exemption_no": {
      "type": "string",
      "description": "Exemption number"
     },
     "tax_exemption_expires": {
      "type": "string",
      "format": "date",
      "description": "Exemption expires"
     },
     "contact_id": {
      "type": "string",
      "format": "uuid",
      "description": "Contact id"
     },
     "phone": {
      "type": "string",
      "description": "Phone"
     },
     "email": {
      "type": "string",
      "description": "Email"
     },
     "status": {
      "type": "string",
      "description": "Status",
      "enum": [
       "active",
       "on_hold",
       "closed",
       "pending"
      ]
     },
     "notes": {
      "type": "string",
      "description": "Notes"
     },
     "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"
     },
     "org_unit_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org unit id",
      "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
     }
    }
   }
  }
 },
 "security": [
  {
   "bearer": []
  }
 ],
 "paths": {
  "/api/crm/customer-sites": {
   "get": {
    "summary": "list customer-sites",
    "operationId": "list_customer_sites_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "create customer-sites",
    "operationId": "create_customer_sites_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/crm/customer-sites/{id}": {
   "get": {
    "summary": "get customer-sites",
    "operationId": "get_customer_sites_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "change customer-sites",
    "operationId": "change_customer_sites_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "delete customer-sites",
    "operationId": "delete_customer_sites_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/crm/customer-sites/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_customer_sites_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"
     }
    }
   }
  }
 }
}