{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/popp/json-schema/popp-create-user-request-schema.json",
  "title": "CreateUserRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/popp-users-api-openapi.yml#/components/schemas/CreateUserRequest",
  "type": "object",
  "required": [
    "email",
    "organizations"
  ],
  "properties": {
    "email": {
      "type": "string",
      "format": "email"
    },
    "name": {
      "type": "string"
    },
    "organizationGroupRole": {
      "type": "string",
      "enum": [
        "ORGANIZATION_GROUP_ADMIN",
        "ORGANIZATION_GROUP_MEMBER"
      ]
    },
    "organizations": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "description": "Names one organization either by its Popp id or by your own externalOrganizationId, never both. A hidden organization is not a valid target under either id and returns 404.",
        "oneOf": [
          {
            "title": "By Popp organization id",
            "type": "object",
            "required": [
              "organizationId"
            ],
            "properties": {
              "organizationId": {
                "type": "string",
                "description": "The Popp organization id."
              },
              "role": {
                "type": "string",
                "enum": [
                  "ADMIN",
                  "MEMBER"
                ]
              }
            },
            "additionalProperties": false
          },
          {
            "title": "By your own external id",
            "type": "object",
            "required": [
              "externalOrganizationId"
            ],
            "properties": {
              "externalOrganizationId": {
                "type": "string",
                "description": "Your own id for the organization, as set through PATCH /v1/organizations/{id}."
              },
              "role": {
                "type": "string",
                "enum": [
                  "ADMIN",
                  "MEMBER"
                ]
              }
            },
            "additionalProperties": false
          }
        ]
      }
    },
    "sendInvite": {
      "type": "boolean"
    }
  },
  "additionalProperties": false
}