{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/4chems-com/json-schema/4chems-com-self-service-tenant-create-in-schema.json",
  "title": "SelfServiceTenantCreateIn",
  "description": "Request body for POST /v1/onboarding/tenants (UC-052).\n\nThe domain is derived from the caller's verified token email claim\n(NFR-006 pt 4) — it is not a request parameter.\nattestation must be true; the endpoint raises 422 if false (NFR-006 §8a).",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/4chems-com-onboarding-api-openapi.yml#/components/schemas/SelfServiceTenantCreateIn",
  "properties": {
    "legal_entity": {
      "$ref": "#/$defs/LegalEntityIn"
    },
    "attestation": {
      "type": "boolean",
      "title": "Attestation"
    },
    "bot_signals": {
      "anyOf": [
        {
          "$ref": "#/$defs/BotSignalsIn"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "type": "object",
  "required": [
    "legal_entity",
    "attestation"
  ],
  "$defs": {
    "BotSignalsIn": {
      "properties": {
        "honeypot": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Honeypot"
        },
        "submit_timing_ms": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Submit Timing Ms"
        }
      },
      "type": "object",
      "title": "BotSignalsIn",
      "description": "Advisory bot-detection signals from the onboarding wizard (UC-052).\n\nRecorded and fed to scoring; never used as a hard gate."
    },
    "LegalEntityIn": {
      "properties": {
        "country": {
          "type": "string",
          "pattern": "^[A-Z]{2}$",
          "title": "Country"
        },
        "legal_entity_type": {
          "type": "string",
          "pattern": "^[A-Z]{2,3}_[A-Z0-9][A-Z0-9_]*$",
          "title": "Legal Entity Type"
        },
        "other_label": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 80,
              "minLength": 2
            },
            {
              "type": "null"
            }
          ],
          "title": "Other Label"
        },
        "name": {
          "type": "string",
          "maxLength": 200,
          "minLength": 1,
          "title": "Name"
        }
      },
      "type": "object",
      "required": [
        "country",
        "legal_entity_type",
        "name"
      ],
      "title": "LegalEntityIn",
      "description": "Composite legal-entity input validated against the country catalog.\n\nRules:\n- *country* must be a supported market (validated at field level via SupportedCountry,\n  caught in the model validator against the loaded catalog).\n- *legal_entity_type* must appear in that country's catalog file.\n- When *legal_entity_type* is ``<CC>_OTHER``, *other_label* is required (2-80 chars).\n- For any other type, *other_label* must be absent."
    }
  }
}