{
 "openapi": "3.1.0",
 "info": {
  "title": "Accounts (CRM)",
  "version": "20261030b",
  "description": "Open a customer for its sites, selling context, financial terms, credit profile and account relationships — ship-to, bill-to and payer are frequently three different places."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "accounts": {
    "type": "object",
    "required": [
     "account_no",
     "name",
     "currency"
    ],
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id",
      "readOnly": true
     },
     "org_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org id",
      "readOnly": true
     },
     "account_no": {
      "type": "string",
      "description": "Account number"
     },
     "name": {
      "type": "string",
      "description": "Name"
     },
     "account_type": {
      "type": "string",
      "description": "Type",
      "enum": [
       "prospect",
       "customer",
       "partner",
       "distributor"
      ]
     },
     "parent_id": {
      "type": "string",
      "format": "uuid",
      "description": "Parent id"
     },
     "industry": {
      "type": "string",
      "description": "Industry"
     },
     "country": {
      "type": "string",
      "description": "Country"
     },
     "currency": {
      "type": "string",
      "description": "Currency"
     },
     "credit_limit": {
      "type": "string",
      "format": "decimal",
      "description": "Credit limit"
     },
     "owner_id": {
      "type": "string",
      "format": "uuid",
      "description": "Owner id",
      "readOnly": true
     },
     "is_active": {
      "type": "boolean",
      "description": "Is active"
     },
     "org_unit_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org unit id",
      "readOnly": true
     },
     "location_id": {
      "type": "string",
      "format": "uuid",
      "description": "Location id",
      "readOnly": true
     },
     "warehouse_id": {
      "type": "string",
      "format": "uuid",
      "description": "Warehouse 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_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
     },
     "website": {
      "type": "string",
      "description": "Website"
     },
     "phone": {
      "type": "string",
      "description": "Main telephone"
     },
     "email": {
      "type": "string",
      "description": "General e-mail"
     },
     "legal_name": {
      "type": "string",
      "description": "Legal name"
     },
     "address_line1": {
      "type": "string",
      "description": "Address line1"
     },
     "city": {
      "type": "string",
      "description": "City"
     },
     "region": {
      "type": "string",
      "description": "Region"
     },
     "postal_code": {
      "type": "string",
      "description": "Postal code"
     },
     "employee_count": {
      "type": "integer",
      "description": "Employees"
     },
     "founded_year": {
      "type": "integer",
      "description": "Founded (year)"
     },
     "description": {
      "type": "string",
      "description": "About the company"
     },
     "name_ar": {
      "type": "string",
      "description": "Name in Arabic"
     },
     "cr_number": {
      "type": "string",
      "description": "Cr number"
     },
     "building_no": {
      "type": "string",
      "description": "Building number"
     },
     "district": {
      "type": "string",
      "description": "District"
     },
     "additional_no": {
      "type": "string",
      "description": "Additional number"
     },
     "gstin": {
      "type": "string",
      "description": "Gstin"
     },
     "pan": {
      "type": "string",
      "description": "PAN"
     },
     "state_code": {
      "type": "string",
      "description": "GST state (place of supply)",
      "enum": [
       "01 Jammu and Kashmir",
       "02 Himachal Pradesh",
       "03 Punjab",
       "04 Chandigarh",
       "05 Uttarakhand",
       "06 Haryana",
       "07 Delhi",
       "08 Rajasthan",
       "09 Uttar Pradesh",
       "10 Bihar",
       "11 Sikkim",
       "12 Arunachal Pradesh",
       "13 Nagaland",
       "14 Manipur",
       "15 Mizoram",
       "16 Tripura",
       "17 Meghalaya",
       "18 Assam",
       "19 West Bengal",
       "20 Jharkhand",
       "21 Odisha",
       "22 Chhattisgarh",
       "23 Madhya Pradesh",
       "24 Gujarat",
       "26 Dadra and Nagar Haveli and Daman and Diu",
       "27 Maharashtra",
       "29 Karnataka",
       "30 Goa",
       "31 Lakshadweep",
       "32 Kerala",
       "33 Tamil Nadu",
       "34 Puducherry",
       "35 Andaman and Nicobar Islands",
       "36 Telangana",
       "37 Andhra Pradesh",
       "38 Ladakh",
       "97 Other Territory"
      ]
     },
     "gst_registration_type": {
      "type": "string",
      "description": "GST registration",
      "enum": [
       "regular",
       "composition",
       "unregistered",
       "sez_unit",
       "sez_developer",
       "overseas",
       "uin"
      ]
     },
     "pincode": {
      "type": "string",
      "description": "Pincode"
     },
     "buyer_id_scheme": {
      "type": "string",
      "description": "Buyer ID type (no VAT number)",
      "enum": [
       "TIN - tax identification number",
       "CRN - commercial registration",
       "MOM - MOMRAH license",
       "MLS - MHRSD license",
       "700 - 700 number",
       "SAG - MISA license",
       "NAT - national ID",
       "GCC - GCC ID",
       "IQA - Iqama number",
       "PAS - passport",
       "OTH - other"
      ]
     },
     "buyer_id_number": {
      "type": "string",
      "description": "Buyer ID number"
     },
     "merged_into_id": {
      "type": "string",
      "format": "uuid",
      "description": "Merged into id",
      "readOnly": true
     },
     "onboarding_status": {
      "type": "string",
      "description": "Onboarding status",
      "readOnly": true
     },
     "onboarding_updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "Onboarding updated at",
      "readOnly": true
     }
    }
   }
  }
 },
 "security": [
  {
   "bearer": []
  }
 ],
 "paths": {
  "/api/crm/accounts": {
   "get": {
    "summary": "list accounts",
    "operationId": "list_accounts_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "create accounts",
    "operationId": "create_accounts_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/crm/accounts/{id}": {
   "get": {
    "summary": "get accounts",
    "operationId": "get_accounts_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "change accounts",
    "operationId": "change_accounts_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "delete accounts",
    "operationId": "delete_accounts_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "patch": {
    "summary": "Patch accounts",
    "operationId": "action_accounts_3_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/crm/accounts/{id}/profile": {
   "get": {
    "summary": "Profile",
    "operationId": "action_accounts_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/crm/accounts/{id}/sites": {
   "get": {
    "summary": "Sites",
    "operationId": "action_accounts_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/crm/accounts/{id}/payment-methods": {
   "get": {
    "summary": "Payment methods",
    "operationId": "action_accounts_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/crm/accounts/{id}/payment-setup": {
   "post": {
    "summary": "Payment setup",
    "operationId": "action_accounts_0_6",
    "description": "Body keys: email, contactName",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/crm/accounts/{id}/onboarding-active": {
   "post": {
    "summary": "Onboarding active",
    "operationId": "action_accounts_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/crm/accounts/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_accounts_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/crm/accounts/{parentId}/contacts": {
   "get": {
    "summary": "Contacts",
    "operationId": "action_accounts_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "Contacts",
    "operationId": "action_accounts_1_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/crm/accounts/{parentId}/contacts/{lineId}": {
   "put": {
    "summary": "Contacts",
    "operationId": "action_accounts_0_7",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "Contacts",
    "operationId": "action_accounts_1_7",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  }
 }
}