{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/safetyculture/json-schema/safetyculture-s12-users-v1-init-create-or-update-users-job-request-schema.json",
  "title": "s12.users.v1.InitCreateOrUpdateUsersJobRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/safetyculture-bulk-user-operations-api-openapi.yml#/components/schemas/s12.users.v1.InitCreateOrUpdateUsersJobRequest",
  "type": "object",
  "properties": {
    "job_id": {
      "type": "string",
      "description": "ID of the job to add users to, if this is the first request this is optional."
    },
    "users": {
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "#/$defs/s12.users.v1.CreateOrUpdateRequestUser"
      }
    }
  },
  "$defs": {
    "s12.common.Language": {
      "type": "string",
      "enum": [
        "LANGUAGE_UNSPECIFIED",
        "LANGUAGE_EN_US",
        "LANGUAGE_EN_GB",
        "LANGUAGE_DE_DE",
        "LANGUAGE_ES_ES",
        "LANGUAGE_FR_FR",
        "LANGUAGE_PT_BR",
        "LANGUAGE_NL_NL"
      ],
      "default": "LANGUAGE_UNSPECIFIED",
      "description": "- LANGUAGE_UNSPECIFIED: Language unspecified\n - LANGUAGE_EN_US: Language en-US\n - LANGUAGE_EN_GB: Language en-GB\n - LANGUAGE_DE_DE: Language de-DE\n - LANGUAGE_ES_ES: Language es-ES\n - LANGUAGE_FR_FR: Language fr-FR\n - LANGUAGE_PT_BR: Language pt-BR\n - LANGUAGE_NL_NL: Language nl-NL",
      "title": "Language represents the languages offered in SafetyCulture"
    },
    "s12.common.PasswordSettings": {
      "type": "object",
      "properties": {
        "require_password_reset": {
          "type": "boolean"
        }
      },
      "title": "Parameters to force password reset for a user"
    },
    "s12.common.SubscriptionSeatTypes": {
      "type": "string",
      "enum": [
        "SUBSCRIPTION_SEAT_TYPE_UNSPECIFIED",
        "SUBSCRIPTION_SEAT_TYPE_PREMIUM",
        "SUBSCRIPTION_SEAT_TYPE_COLLABORATOR",
        "SUBSCRIPTION_SEAT_TYPE_LITE",
        "SUBSCRIPTION_SEAT_TYPE_SERVICE_USER",
        "SUBSCRIPTION_SEAT_TYPE_SUPPORT"
      ],
      "default": "SUBSCRIPTION_SEAT_TYPE_UNSPECIFIED",
      "title": "SubscriptionSeatTypes is a list of potential subscription seat types"
    },
    "s12.common.UserActiveStatus": {
      "type": "string",
      "enum": [
        "USER_ACTIVE_STATUS_UNSPECIFIED",
        "USER_ACTIVE_STATUS_ACTIVE",
        "USER_ACTIVE_STATUS_DEACTIVATED"
      ],
      "default": "USER_ACTIVE_STATUS_UNSPECIFIED",
      "description": "- USER_ACTIVE_STATUS_UNSPECIFIED: Status is unknown or not specified\n - USER_ACTIVE_STATUS_ACTIVE: User is active\n - USER_ACTIVE_STATUS_DEACTIVATED: User has been deactivated",
      "title": "UserActiveStatus enumerates possible states of 'status' a user may be in"
    },
    "s12.users.v1.CreateOrUpdateRequestUser": {
      "type": "object",
      "properties": {
        "user": {
          "$ref": "#/$defs/s12.users.v1.CreateOrUpdateUser"
        }
      },
      "required": [
        "user"
      ]
    },
    "s12.users.v1.CreateOrUpdateUser": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Optional. At least one of `user_id` or `username` is REQUIRED. ID of the user for updates."
        },
        "username": {
          "type": "string",
          "description": "Either `user_id` or `username` is required. Represents the user's email address or username."
        },
        "first_name": {
          "type": "string",
          "description": "User's first name."
        },
        "last_name": {
          "type": "string",
          "description": "User's last name."
        },
        "password": {
          "type": "string",
          "description": "Password for the user. This field is used only during user creation."
        },
        "seat_type": {
          "description": "User's seat type: full, lite, or guest.",
          "allOf": [
            {
              "$ref": "#/$defs/s12.common.SubscriptionSeatTypes"
            }
          ]
        },
        "timezone": {
          "type": "string",
          "description": "Timezone, must be a valid timezone in the IANA time zone database."
        },
        "status": {
          "description": "User's activation status.",
          "allOf": [
            {
              "$ref": "#/$defs/s12.common.UserActiveStatus"
            }
          ]
        },
        "language": {
          "description": "Language preference for the user. Follows the ISO-639 code. For example, `en-US`.",
          "allOf": [
            {
              "$ref": "#/$defs/s12.common.Language"
            }
          ]
        },
        "permission_set": {
          "description": "The permission set assigned to the user. Must be a valid name or ID.",
          "allOf": [
            {
              "$ref": "#/$defs/s12.users.v1.CreateOrUpdateUser.Reference"
            }
          ]
        },
        "groups": {
          "description": "Groups the user is assigned to.",
          "allOf": [
            {
              "$ref": "#/$defs/s12.users.v1.CreateOrUpdateUser.Memberships"
            }
          ]
        },
        "sites": {
          "description": "Sites the user is assigned to.",
          "allOf": [
            {
              "$ref": "#/$defs/s12.users.v1.CreateOrUpdateUser.Memberships"
            }
          ]
        },
        "companies": {
          "description": "Contractor companies the user is assigned to.",
          "allOf": [
            {
              "$ref": "#/$defs/s12.users.v1.CreateOrUpdateUser.Memberships"
            }
          ]
        },
        "attributes": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/$defs/s12.users.v1.CreateOrUpdateUser.Attribute"
          },
          "description": "User field attributes."
        },
        "email_settings": {
          "description": "Controls whether a welcome email is sent to newly created users. By default, an email is sent if this field is not set. Overrides any request-level `EmailSettings` with this user-specific setting.",
          "allOf": [
            {
              "$ref": "#/$defs/s12.users.v1.EmailSettings"
            }
          ]
        },
        "password_settings": {
          "description": "Optional. Password settings for the user.",
          "allOf": [
            {
              "$ref": "#/$defs/s12.common.PasswordSettings"
            }
          ]
        }
      }
    },
    "s12.users.v1.CreateOrUpdateUser.Attribute": {
      "type": "object",
      "properties": {
        "reference": {
          "description": "Attribute reference. Must be a valid Name or ID for the user field.",
          "allOf": [
            {
              "$ref": "#/$defs/s12.users.v1.CreateOrUpdateUser.Reference"
            }
          ]
        },
        "values": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/$defs/s12.users.v1.CreateOrUpdateUser.Attribute.Value"
          }
        }
      }
    },
    "s12.users.v1.CreateOrUpdateUser.Attribute.Value": {
      "type": "object",
      "properties": {
        "valid": {
          "type": "boolean",
          "description": "Indicates whether the value is valid and will be applied to the user."
        },
        "string_value": {
          "type": "string",
          "description": "The string value of a field."
        },
        "timestamp_value": {
          "type": "string",
          "format": "date-time",
          "description": "The timestamp value of a field."
        },
        "uuid_value": {
          "description": "The UUID value of a field.",
          "allOf": [
            {
              "$ref": "#/$defs/s12.users.v1.CreateOrUpdateUser.Reference"
            }
          ]
        }
      }
    },
    "s12.users.v1.CreateOrUpdateUser.Memberships": {
      "type": "object",
      "properties": {
        "remove": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/$defs/s12.users.v1.CreateOrUpdateUser.Reference"
          },
          "description": "References from which the user will be removed. ONLY supports \"*\" to remove from all existing references."
        },
        "add": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/$defs/s12.users.v1.CreateOrUpdateUser.Reference"
          },
          "description": "References to assign the user to. Each must be a valid, case-sensitive name or ID for the resource."
        }
      }
    },
    "s12.users.v1.CreateOrUpdateUser.Reference": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "The ID of the resource."
        },
        "name": {
          "type": "string",
          "description": "The name of the resource."
        },
        "valid": {
          "type": "boolean",
          "description": "Read-only. Indicates whether the reference is valid and will be applied to the user."
        },
        "hierarchy": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "map of the hierarchy of the reference, such as a group or site.\nThe target resource is the last element in the hierarchy."
        }
      },
      "description": "A reference to another resource, such as a group, site, or permission set.\nAt least one of `id` or `name` is required.\nIf both are provided, the `id` is used and `name` is ignored.\nIf only `name` is provided, it resolves the corresponding `id`."
    },
    "s12.users.v1.EmailSettings": {
      "type": "object",
      "properties": {
        "send_email": {
          "type": "boolean",
          "description": "Send a welcome email to newly created users."
        }
      }
    }
  }
}