{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/mongodb/main/json-schema/mongodb-org-user-response-schema.json",
  "title": "OrgUserResponse",
  "x-generated": "2026-10-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/mongodb-mongodb-cloud-users-api-openapi.yml#/components/schemas/OrgUserResponse",
  "oneOf": [
    {
      "$ref": "#/$defs/OrgPendingUserResponse"
    },
    {
      "$ref": "#/$defs/OrgActiveUserResponse"
    }
  ],
  "properties": {
    "id": {
      "description": "Unique 24-hexadecimal digit string that identifies the MongoDB Cloud user.",
      "pattern": "^([a-f0-9]{24})$",
      "readOnly": true,
      "type": "string"
    },
    "orgMembershipStatus": {
      "description": "String enum that indicates whether the MongoDB Cloud user has a pending invitation to join the organization or they are already active in the organization.",
      "enum": [
        "PENDING",
        "ACTIVE"
      ],
      "readOnly": true,
      "type": "string"
    },
    "roles": {
      "$ref": "#/$defs/OrgUserRolesResponse"
    },
    "teamIds": {
      "description": "List of unique 24-hexadecimal digit strings that identifies the teams to which this MongoDB Cloud user belongs.",
      "items": {
        "pattern": "^([a-f0-9]{24})$",
        "type": "string"
      },
      "readOnly": true,
      "type": "array",
      "uniqueItems": true
    },
    "username": {
      "description": "Email address that represents the username of the MongoDB Cloud user.",
      "format": "email",
      "readOnly": true,
      "type": "string"
    }
  },
  "required": [
    "id",
    "orgMembershipStatus",
    "roles",
    "username"
  ],
  "type": "object",
  "$defs": {
    "GroupRoleAssignment": {
      "properties": {
        "groupId": {
          "description": "Unique 24-hexadecimal digit string that identifies the project to which these roles belong.",
          "pattern": "^([a-f0-9]{24})$",
          "type": "string"
        },
        "groupRoles": {
          "description": "One or more project-level roles assigned to the MongoDB Cloud user.",
          "items": {
            "type": "string"
          },
          "type": "array",
          "uniqueItems": true
        }
      },
      "type": "object"
    },
    "OrgActiveUserResponse": {
      "allOf": [
        {
          "$ref": "#/$defs/OrgUserResponse"
        },
        {
          "properties": {
            "country": {
              "description": "Two-character alphabetical string that identifies the MongoDB Cloud user's geographic location. This parameter uses the ISO 3166-1a2 code format.",
              "pattern": "^([A-Z]{2})$",
              "readOnly": true,
              "type": "string"
            },
            "createdAt": {
              "description": "Date and time when MongoDB Cloud created the current account. This value is in the ISO 8601 timestamp format in UTC.",
              "format": "date-time",
              "readOnly": true,
              "type": "string"
            },
            "firstName": {
              "description": "First or given name that belongs to the MongoDB Cloud user.",
              "readOnly": true,
              "type": "string"
            },
            "lastAuth": {
              "description": "Date and time when the current account last authenticated. This value is in the ISO 8601 timestamp format in UTC.",
              "format": "date-time",
              "readOnly": true,
              "type": "string"
            },
            "lastName": {
              "description": "Last name, family name, or surname that belongs to the MongoDB Cloud user.",
              "readOnly": true,
              "type": "string"
            },
            "mobileNumber": {
              "description": "Mobile phone number that belongs to the MongoDB Cloud user.",
              "pattern": "(?:(?:\\\\+?1\\\\s*(?:[.-]\\\\s*)?)?(?:(\\\\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\\\\s*)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\\\\s*(?:[.-]\\\\s*)?)([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\\\\s*(?:[.-]\\\\s*)?([0-9]{4})$",
              "readOnly": true,
              "type": "string"
            }
          },
          "type": "object"
        }
      ],
      "required": [
        "createdAt",
        "firstName",
        "id",
        "lastName",
        "orgMembershipStatus",
        "roles",
        "username"
      ],
      "type": "object"
    },
    "OrgPendingUserResponse": {
      "allOf": [
        {
          "$ref": "#/$defs/OrgUserResponse"
        },
        {
          "properties": {
            "invitationCreatedAt": {
              "description": "Date and time when MongoDB Cloud sent the invitation. MongoDB Cloud represents this timestamp in ISO 8601 format in UTC.",
              "format": "date-time",
              "readOnly": true,
              "type": "string"
            },
            "invitationExpiresAt": {
              "description": "Date and time when the invitation from MongoDB Cloud expires. MongoDB Cloud represents this timestamp in ISO 8601 format in UTC.",
              "format": "date-time",
              "readOnly": true,
              "type": "string"
            },
            "inviterUsername": {
              "description": "Username of the MongoDB Cloud user who sent the invitation to join the organization.",
              "format": "email",
              "readOnly": true,
              "type": "string"
            }
          },
          "type": "object"
        }
      ],
      "required": [
        "id",
        "invitationCreatedAt",
        "invitationExpiresAt",
        "inviterUsername",
        "orgMembershipStatus",
        "roles",
        "username"
      ],
      "type": "object"
    },
    "OrgUserResponse": {
      "oneOf": [
        {
          "$ref": "#/$defs/OrgPendingUserResponse"
        },
        {
          "$ref": "#/$defs/OrgActiveUserResponse"
        }
      ],
      "properties": {
        "id": {
          "description": "Unique 24-hexadecimal digit string that identifies the MongoDB Cloud user.",
          "pattern": "^([a-f0-9]{24})$",
          "readOnly": true,
          "type": "string"
        },
        "orgMembershipStatus": {
          "description": "String enum that indicates whether the MongoDB Cloud user has a pending invitation to join the organization or they are already active in the organization.",
          "enum": [
            "PENDING",
            "ACTIVE"
          ],
          "readOnly": true,
          "type": "string"
        },
        "roles": {
          "$ref": "#/$defs/OrgUserRolesResponse"
        },
        "teamIds": {
          "description": "List of unique 24-hexadecimal digit strings that identifies the teams to which this MongoDB Cloud user belongs.",
          "items": {
            "pattern": "^([a-f0-9]{24})$",
            "type": "string"
          },
          "readOnly": true,
          "type": "array",
          "uniqueItems": true
        },
        "username": {
          "description": "Email address that represents the username of the MongoDB Cloud user.",
          "format": "email",
          "readOnly": true,
          "type": "string"
        }
      },
      "required": [
        "id",
        "orgMembershipStatus",
        "roles",
        "username"
      ],
      "type": "object"
    },
    "OrgUserRolesResponse": {
      "description": "Organization- and project-level roles assigned to one MongoDB Cloud user within one organization.",
      "properties": {
        "groupRoleAssignments": {
          "description": "List of project-level role assignments assigned to the MongoDB Cloud user.",
          "items": {
            "$ref": "#/$defs/GroupRoleAssignment"
          },
          "type": "array"
        },
        "orgRoles": {
          "description": "One or more organization-level roles assigned to the MongoDB Cloud user.",
          "items": {
            "description": "Organization-level role.",
            "enum": [
              "ORG_OWNER",
              "ORG_GROUP_CREATOR",
              "ORG_BILLING_ADMIN",
              "ORG_BILLING_READ_ONLY",
              "ORG_STREAM_PROCESSING_ADMIN",
              "ORG_READ_ONLY",
              "ORG_MEMBER"
            ],
            "type": "string"
          },
          "type": "array",
          "uniqueItems": true
        }
      },
      "readOnly": true,
      "type": "object"
    }
  }
}