{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/storecove/main/json-schema/storecove-legal-entity-create-schema.json",
  "title": "LegalEntityCreate",
  "x-generated": "2026-10-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/storecove-openapi.yml#/components/schemas/LegalEntityCreate",
  "properties": {
    "party_name": {
      "type": "string",
      "title": "Company name",
      "description": "The name of the company.",
      "minLength": 2,
      "maxLength": 64
    },
    "line1": {
      "type": "string",
      "title": "Address line 1",
      "description": "The first address line.",
      "minLength": 2,
      "maxLength": 192
    },
    "line2": {
      "type": "string",
      "title": "Address line 2",
      "description": "The second address line, if applicable",
      "maxLength": 192
    },
    "city": {
      "type": "string",
      "title": "City",
      "description": "The city.",
      "minLength": 2,
      "maxLength": 64
    },
    "zip": {
      "type": "string",
      "title": "Zipcode",
      "description": "The zipcode.",
      "minLength": 2,
      "maxLength": 32
    },
    "county": {
      "type": "string",
      "title": "County",
      "description": "County, if applicable",
      "maxLength": 64
    },
    "country": {
      "$ref": "#/$defs/Country"
    },
    "registration_authority_name": {
      "type": "string",
      "title": "Registration Authority Name",
      "description": "The name of the authority that issued the legal registration identifier. Used for UAE PINT-AE BTAE-11. See <<country_ae>>.",
      "minLength": 1,
      "maxLength": 255
    },
    "passport_issuing_country": {
      "type": "string",
      "title": "Passport Issuing Country",
      "description": "The ISO 3166-1 alpha-2 country code, or Peppol extension 1A, for the authority that issued the passport. Used for UAE PINT-AE BTAE-19. See <<country_ae>>.",
      "pattern": "^(?:[A-Z]{2}|1A)$"
    },
    "tenant_id": {
      "type": "string",
      "title": "Tenant Id",
      "description": "The id of the tenant, to be used in case of single-tenant solutions that share webhook URLs. This property will included in webhook events.",
      "maxLength": 64
    },
    "public": {
      "type": "boolean",
      "title": "Public",
      "description": "Whether or not this LegalEntity is public. Public means it will be entered into the PEPPOL directory at https://directory.peppol.eu/",
      "default": true
    },
    "advertisements": {
      "title": "Advertisements",
      "description": "A list of document groups to advertise.\n++++\n<ul>    <li>        <strong>invoice</strong><br/>        Gives Invoice and where applicable CreditNote under the Billing process.<br/>    </li>    <li>        <strong>invoice_response</strong><br/>        Gives InvoiceResponse under the Invoice Response process.<br/>    </li>    <li>        <strong>selfbilling</strong><br/>        Gives Invoice and where applicable CreditNote under the Selfbilling process.<br/>    </li>    <li>        <strong>order</strong><br/>        Gives Order under the Order Only process.<br/>    </li>    <li>        <strong>ordering</strong><br/>        Gives Order and OrderResponse under the Ordering process.<br/>    </li>    <li>        <strong>advanced_ordering</strong><br/>        Gives Order, AdvancedOrderResponse, OrderChange and OrderCancellation under the Advanced Ordering process.<br/>    </li>    <li>        <strong>advanced_ordering_sg_order_balance</strong><br/>        Gives OrderBalance under the Advanced Ordering SG Order Balance process.<br/>    </li>    <li>        <strong>remittance_advice</strong><br/>        Gives RemittanceAdvice (DBNAlliance only).<br/>    </li>    <li>        <strong>pidx_invoicing_ordering</strong><br/>        Gives PIDX Invoice, InvoiceResponse, OrderChange, OrderCreate and OrderResponse (DBNAlliance only).<br/>    </li></ul>\n++++\n",
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "invoice",
          "invoice_response",
          "selfbilling",
          "order",
          "ordering",
          "advanced_ordering",
          "advanced_ordering_sg_order_balance",
          "remittance_advice",
          "pidx_invoicing_ordering"
        ]
      },
      "default": [
        "invoice"
      ]
    },
    "third_party_username": {
      "type": "string",
      "title": "Username",
      "description": "The username to use to authenticate to a system through which to send the document, or to obtain tax authority approval to send it. This field is currently relevant only for India and mandatory when creating an IN LegalEntity.",
      "minLength": 2,
      "maxLength": 64
    },
    "third_party_password": {
      "type": "string",
      "title": "Password",
      "description": "The password to use to authenticate to a system through which to send the document, or to obtain tax authority approval to send it. This field is currently relevant only for India and mandatory when creating an IN LegalEntity.",
      "minLength": 2,
      "maxLength": 64
    },
    "rea": {
      "allOf": [
        {
          "$ref": "#/$defs/Rea"
        },
        {
          "title": "REA Details",
          "description": "The REA details for the LegalEntity. Only applies to IT LegalEntities."
        }
      ]
    },
    "acts_as_sender": {
      "type": "boolean",
      "title": "Acts As Sender",
      "description": "Whether or not this LegalEntity can act as a sender of documents.",
      "default": true
    },
    "acts_as_receiver": {
      "type": "boolean",
      "title": "Acts As Receiver",
      "description": "Whether or not this LegalEntity can act as a receiver of documents. If not, no identifiers will be provioned on any exchange network.",
      "default": true
    },
    "tax_registered": {
      "type": "boolean",
      "title": "Tax Registered",
      "description": "Whether or not this LegalEntity is tax registered. This influences the validation of the data presented when sending documents.",
      "default": true
    },
    "override_own_credentials": {
      "type": "boolean",
      "title": "Override Own Credentials",
      "description": "If true, Storecove will use default credentials/signing artifacts even if specific ones are configured for this LegalEntity. Defaults to false.",
      "default": false
    }
  },
  "required": [
    "party_name",
    "line1",
    "city",
    "zip",
    "country"
  ],
  "$defs": {
    "Country": {
      "title": "Country",
      "description": "An ISO 3166-1 alpha-2 country code.",
      "type": "string",
      "enum": [
        "AD",
        "AE",
        "AF",
        "AG",
        "AI",
        "AL",
        "AM",
        "AO",
        "AQ",
        "AR",
        "AS",
        "AT",
        "AU",
        "AW",
        "AX",
        "AZ",
        "BA",
        "BB",
        "BD",
        "BE",
        "BF",
        "BG",
        "BH",
        "BI",
        "BJ",
        "BL",
        "BM",
        "BN",
        "BO",
        "BQ",
        "BR",
        "BS",
        "BT",
        "BV",
        "BW",
        "BY",
        "BZ",
        "CA",
        "CC",
        "CD",
        "CF",
        "CG",
        "CH",
        "CI",
        "CK",
        "CL",
        "CM",
        "CN",
        "CO",
        "CR",
        "CU",
        "CV",
        "CW",
        "CX",
        "CY",
        "CZ",
        "DE",
        "DJ",
        "DK",
        "DM",
        "DO",
        "DZ",
        "EC",
        "EE",
        "EG",
        "EH",
        "ER",
        "ES",
        "ET",
        "FI",
        "FJ",
        "FK",
        "FM",
        "FO",
        "FR",
        "GA",
        "GB",
        "GD",
        "GE",
        "GF",
        "GG",
        "GH",
        "GI",
        "GL",
        "GM",
        "GN",
        "GP",
        "GQ",
        "GR",
        "GS",
        "GT",
        "GU",
        "GW",
        "GY",
        "HK",
        "HM",
        "HN",
        "HR",
        "HT",
        "HU",
        "ID",
        "IE",
        "IL",
        "IM",
        "IN",
        "IO",
        "IQ",
        "IR",
        "IS",
        "IT",
        "JE",
        "JM",
        "JO",
        "JP",
        "KE",
        "KG",
        "KH",
        "KI",
        "KM",
        "KN",
        "KP",
        "KR",
        "KW",
        "KY",
        "KZ",
        "LA",
        "LB",
        "LC",
        "LI",
        "LK",
        "LR",
        "LS",
        "LT",
        "LU",
        "LV",
        "LY",
        "MA",
        "MC",
        "MD",
        "ME",
        "MF",
        "MG",
        "MH",
        "MK",
        "ML",
        "MM",
        "MN",
        "MO",
        "MP",
        "MQ",
        "MR",
        "MS",
        "MT",
        "MU",
        "MV",
        "MW",
        "MX",
        "MY",
        "MZ",
        "NA",
        "NC",
        "NE",
        "NF",
        "NG",
        "NI",
        "NL",
        "NO",
        "NP",
        "NR",
        "NU",
        "NZ",
        "OM",
        "PA",
        "PE",
        "PF",
        "PG",
        "PH",
        "PK",
        "PL",
        "PM",
        "PN",
        "PR",
        "PS",
        "PT",
        "PW",
        "PY",
        "QA",
        "RE",
        "RO",
        "RS",
        "RU",
        "RW",
        "SA",
        "SB",
        "SC",
        "SD",
        "SE",
        "SG",
        "SH",
        "SI",
        "SJ",
        "SK",
        "SL",
        "SM",
        "SN",
        "SO",
        "SR",
        "SS",
        "ST",
        "SV",
        "SX",
        "SY",
        "SZ",
        "TC",
        "TD",
        "TF",
        "TG",
        "TH",
        "TJ",
        "TK",
        "TL",
        "TM",
        "TN",
        "TO",
        "TR",
        "TT",
        "TV",
        "TW",
        "TZ",
        "UA",
        "UG",
        "UM",
        "US",
        "UY",
        "UZ",
        "VA",
        "VC",
        "VE",
        "VG",
        "VI",
        "VN",
        "VU",
        "WF",
        "WS",
        "YE",
        "YT",
        "ZA",
        "ZM",
        "ZW",
        "XK",
        "XI"
      ]
    },
    "Rea": {
      "properties": {
        "province": {
          "title": "Province",
          "description": "The provincia of the ufficio that issued the identifier.",
          "type": "string",
          "enum": [
            "AG",
            "AL",
            "AN",
            "AO",
            "AQ",
            "AR",
            "AP",
            "AT",
            "AV",
            "BA",
            "BT",
            "BL",
            "BN",
            "BG",
            "BI",
            "BO",
            "BZ",
            "BS",
            "BR",
            "CA",
            "CL",
            "CB",
            "CI",
            "CE",
            "CT",
            "CZ",
            "CH",
            "CO",
            "CS",
            "CR",
            "KR",
            "CN",
            "EN",
            "FM",
            "FE",
            "FI",
            "FG",
            "FC",
            "FR",
            "GE",
            "GO",
            "GR",
            "IM",
            "IS",
            "SP",
            "LT",
            "LE",
            "LC",
            "LI",
            "LO",
            "LU",
            "MC",
            "MN",
            "MS",
            "MT",
            "VS",
            "ME",
            "MI",
            "MO",
            "MB",
            "NA",
            "NO",
            "NU",
            "OG",
            "OT",
            "OR",
            "PD",
            "PA",
            "PR",
            "PV",
            "PG",
            "PU",
            "PE",
            "PC",
            "PI",
            "PT",
            "PN",
            "PZ",
            "PO",
            "RG",
            "RA",
            "RC",
            "RE",
            "RI",
            "RN",
            "RO",
            "SA",
            "SS",
            "SV",
            "SI",
            "SR",
            "SO",
            "TA",
            "TE",
            "TR",
            "TO",
            "TP",
            "TN",
            "TV",
            "TS",
            "UD",
            "VA",
            "VE",
            "VB",
            "VC",
            "VR",
            "VV",
            "VI",
            "VT"
          ]
        },
        "identifier": {
          "title": "Identifier",
          "description": "The identifier.",
          "type": "string",
          "minLength": 2,
          "maxLength": 20
        },
        "capital": {
          "title": "Capital",
          "description": "The captial for the company.",
          "type": "number",
          "minimum": 1,
          "maximum": 1000000000000,
          "exclusiveMaximum": true
        },
        "partners": {
          "title": "Partners",
          "description": "The number of partners.",
          "type": "string",
          "enum": [
            "SU",
            "SM"
          ]
        },
        "liquidation_status": {
          "title": "Liquidation Status",
          "description": "The liquidation status of the company.",
          "type": "string",
          "enum": [
            "LN",
            "LS"
          ]
        }
      }
    }
  }
}