{
  "openapi": "3.0.0",
  "info": {
    "title": "Organization Users API",
    "version": "1",
    "description": "Find users in your current organization and read your own license access."
  },
  "servers": [
    {
      "url": "https://backend.snapaddy.com/user"
    }
  ],
  "paths": {
    "/user-management/find-users": {
      "get": {
        "operationId": "UserManagementController_findUsers",
        "summary": "Find organization users",
        "description": "Search people in the current organization. Use include to select related data, such as profile or membership information. Requires an organization administrator account.",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Amount of items that should be fetched at once.\n    - Default: 50.\n    - Maximum:  1000. ",
            "schema": {
              "minimum": 1,
              "maximum": 1000,
              "default": 50,
              "type": "number"
            }
          },
          {
            "name": "offset",
            "required": false,
            "in": "query",
            "description": "Amount of items that should be skipped, defaults to 0.",
            "schema": {
              "minimum": 0,
              "default": 0,
              "type": "number"
            }
          },
          {
            "name": "searchText",
            "required": false,
            "in": "query",
            "description": "The search text to filter by. If provided, the search will be performed on username, email and full name.",
            "schema": {
              "nullable": false,
              "type": "string"
            }
          },
          {
            "name": "roleIds",
            "required": false,
            "in": "query",
            "description": "The role ids to filter by. If set with at least one value, only users with ALL of the specified roles will be returned. If \"none\" is provided, only users without any role will be returned.",
            "schema": {
              "minItems": 1,
              "nullable": false,
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "groupIds",
            "required": false,
            "in": "query",
            "description": "The group ids to filter by. If set with at least one value, only users belonging to ALL specified groups will be returned. If \"none\" is provided, only users without any group will be returned.",
            "schema": {
              "minItems": 1,
              "nullable": false,
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "licenseIds",
            "required": false,
            "in": "query",
            "description": "The organization subscription type ids of the licenses to filter by. If set with at least one value, only users with ALL of the matching licenses will be returned. If \"none\" is provided, only users without any license will be returned.",
            "schema": {
              "minItems": 1,
              "nullable": false,
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "userStatus",
            "required": false,
            "in": "query",
            "schema": {
              "nullable": false,
              "type": "string",
              "enum": [
                "confirmed",
                "pending"
              ]
            }
          },
          {
            "name": "usersTypeInclude",
            "required": false,
            "in": "query",
            "description": "The user types to include in the result. If not provided, all user types will be included.",
            "schema": {
              "nullable": false,
              "default": [
                "regular",
                "guest",
                "terminal"
              ],
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "terminal",
                  "regular",
                  "guest"
                ]
              }
            }
          },
          {
            "name": "include",
            "required": false,
            "in": "query",
            "schema": {
              "nullable": false,
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "roles",
                  "licenses",
                  "groups",
                  "scim"
                ]
              }
            }
          },
          {
            "name": "sortBy",
            "required": false,
            "in": "query",
            "schema": {
              "default": "username",
              "type": "string",
              "enum": [
                "username",
                "registered",
                "name"
              ]
            }
          },
          {
            "name": "sortOrder",
            "required": false,
            "in": "query",
            "schema": {
              "default": "ASC",
              "type": "string",
              "enum": [
                "ASC",
                "DESC"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of matching organization users, including the optional data requested with include.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FoundUsersResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "If some of the query parameters are invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorArrayDto"
                }
              }
            }
          },
          "403": {
            "description": "The account is not an organization administrator.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorArrayDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "x-api-key": []
          }
        ]
      }
    },
    "/user-management/find-users/ids": {
      "get": {
        "operationId": "UserManagementController_findUserIds",
        "summary": "Find matching organization user IDs",
        "description": "Get the matching user IDs when you only need identifiers for another operation. Requires an organization administrator account.",
        "parameters": [
          {
            "name": "searchText",
            "required": false,
            "in": "query",
            "description": "The search text to filter by. If provided, the search will be performed on username, email and full name.",
            "schema": {
              "nullable": false,
              "type": "string"
            }
          },
          {
            "name": "roleIds",
            "required": false,
            "in": "query",
            "description": "The role ids to filter by. If set with at least one value, only users with ALL of the specified roles will be returned. If \"none\" is provided, only users without any role will be returned.",
            "schema": {
              "minItems": 1,
              "nullable": false,
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "groupIds",
            "required": false,
            "in": "query",
            "description": "The group ids to filter by. If set with at least one value, only users belonging to ALL specified groups will be returned. If \"none\" is provided, only users without any group will be returned.",
            "schema": {
              "minItems": 1,
              "nullable": false,
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "licenseIds",
            "required": false,
            "in": "query",
            "description": "The organization subscription type ids of the licenses to filter by. If set with at least one value, only users with ALL of the matching licenses will be returned. If \"none\" is provided, only users without any license will be returned.",
            "schema": {
              "minItems": 1,
              "nullable": false,
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "userStatus",
            "required": false,
            "in": "query",
            "schema": {
              "nullable": false,
              "type": "string",
              "enum": [
                "confirmed",
                "pending"
              ]
            }
          },
          {
            "name": "usersTypeInclude",
            "required": false,
            "in": "query",
            "description": "The user types to include in the result. If not provided, all user types will be included.",
            "schema": {
              "nullable": false,
              "default": [
                "regular",
                "guest",
                "terminal"
              ],
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "terminal",
                  "regular",
                  "guest"
                ]
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retrieves the ids of all users in the requesting user's current organization that match the provided filter criteria.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FindUserIdsResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "If some of the query parameters are invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorArrayDto"
                }
              }
            }
          },
          "403": {
            "description": "The account is not an organization administrator.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorArrayDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "x-api-key": []
          }
        ]
      }
    },
    "/v1/me/license-permissions-per-organization": {
      "get": {
        "operationId": "UserMeController_getUserLicensePermissionsPerOrganization",
        "summary": "Get your license access",
        "description": "Read your license access grouped by organization. These come from subscriptions and activated modules. Role assignments are tracked separately.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "License access of the user grouped by organization.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/GetUserLicensePermissionsPerOrganizationResponseDto"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "x-api-key": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "FoundUsersResponseDto": {
        "type": "object",
        "properties": {
          "total": {
            "type": "number",
            "nullable": false,
            "description": "The total number of users that match the query."
          },
          "users": {
            "nullable": false,
            "description": "The list of users that match the query.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FoundUserResponseDto"
            }
          }
        },
        "required": [
          "total",
          "users"
        ],
        "title": "Found Users Response"
      },
      "FoundUserResponseDto": {
        "type": "object",
        "properties": {
          "userId": {
            "type": "string",
            "nullable": false,
            "description": "Member ID to use in requests such as assigning a VisitReport meeting host."
          },
          "organizationId": {
            "type": "string",
            "nullable": false,
            "description": "Organization identifier returned for this account."
          },
          "username": {
            "type": "string",
            "nullable": false,
            "description": "Login name associated with the account."
          },
          "registered": {
            "type": "string",
            "nullable": false,
            "format": "date-time",
            "description": "When the account was registered."
          },
          "confirmed": {
            "type": "boolean",
            "nullable": false,
            "description": "Whether the account has been confirmed."
          },
          "accountLocked": {
            "type": "boolean",
            "nullable": false,
            "description": "Whether the account is locked."
          },
          "isNonLoginUser": {
            "type": "boolean",
            "nullable": false,
            "description": "Whether this user record is for someone who cannot sign in."
          },
          "isTerminalUser": {
            "type": "boolean",
            "nullable": false,
            "description": "Whether the account is a terminal user."
          },
          "profile": {
            "allOf": [
              {
                "$ref": "#/components/schemas/FoundUserProfileResponseDto"
              }
            ],
            "description": "Personal details returned when profile information is requested."
          },
          "crmUsername": {
            "type": "string",
            "nullable": true,
            "default": null,
            "description": "Username in the connected CRM."
          },
          "crmUserId": {
            "type": "string",
            "nullable": true,
            "description": "Identifier of this member in the connected CRM."
          },
          "isProfileEditable": {
            "type": "boolean",
            "nullable": false,
            "description": "Whether this profile is editable in the organization context."
          },
          "memberships": {
            "nullable": false,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FoundMembershipResponseDto"
            },
            "description": "Organization memberships included in the search result."
          },
          "licenses": {
            "description": "In order to include the licenses in response, the \"include\" parameter must be set to \"license\".",
            "nullable": false,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FoundLicenseResponseDto"
            }
          },
          "roles": {
            "description": "In order to include the roles in response, the \"include\" parameter must be set to \"roles\".",
            "nullable": false,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FoundRoleResponseDto"
            }
          },
          "groups": {
            "description": "In order to include the groups in response, the \"include\" parameter must be set to \"groups\".",
            "nullable": false,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FoundGroupResponseDto"
            }
          },
          "scimUpdatedAt": {
            "type": "string",
            "nullable": false,
            "format": "date-time",
            "description": "When provisioning data for this user was last updated through SCIM."
          }
        },
        "required": [
          "userId",
          "organizationId",
          "username",
          "registered",
          "confirmed",
          "accountLocked",
          "isNonLoginUser",
          "isTerminalUser",
          "profile",
          "crmUsername",
          "crmUserId",
          "isProfileEditable",
          "memberships"
        ],
        "title": "Found User Response"
      },
      "FoundUserProfileResponseDto": {
        "type": "object",
        "properties": {
          "firstName": {
            "type": "string",
            "nullable": false,
            "description": "Given name in the user profile."
          },
          "lastName": {
            "type": "string",
            "nullable": false,
            "description": "Family name in the user profile."
          },
          "locale": {
            "type": "string",
            "nullable": false,
            "description": "Preferred locale."
          },
          "gender": {
            "type": "number",
            "nullable": false,
            "description": "Gender code stored in the profile."
          },
          "phone": {
            "type": "string",
            "nullable": false,
            "description": "Profile phone number."
          },
          "timezone": {
            "type": "string",
            "nullable": false,
            "description": "Preferred time zone."
          },
          "avatar": {
            "type": "object",
            "properties": {
              "sm": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "nullable": false
                  },
                  "url": {
                    "type": "string",
                    "nullable": false
                  }
                }
              },
              "lg": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "nullable": false
                  },
                  "url": {
                    "type": "string",
                    "nullable": false
                  }
                }
              }
            },
            "nullable": false,
            "description": "Small and large profile images, with their storage keys and URLs."
          }
        },
        "title": "Found User Profile Response"
      },
      "FoundMembershipResponseDto": {
        "type": "object",
        "properties": {
          "organizationId": {
            "type": "string",
            "nullable": false,
            "description": "Organization this membership belongs to."
          },
          "userId": {
            "type": "string",
            "nullable": false,
            "description": "Member account ID."
          },
          "invitedByUserId": {
            "type": "string",
            "nullable": true,
            "description": "Account that invited this member, when recorded."
          },
          "confirmed": {
            "type": "boolean",
            "nullable": false,
            "description": "Whether the membership has been confirmed."
          },
          "confirmedAt": {
            "type": "string",
            "nullable": false,
            "format": "date-time",
            "description": "When the membership was confirmed."
          },
          "createdAt": {
            "type": "string",
            "nullable": false,
            "format": "date-time",
            "description": "When the membership was created."
          }
        },
        "required": [
          "organizationId",
          "userId",
          "invitedByUserId",
          "confirmed",
          "confirmedAt",
          "createdAt"
        ],
        "title": "Found Membership Response"
      },
      "FoundLicenseResponseDto": {
        "type": "object",
        "properties": {
          "userLicenseId": {
            "type": "string",
            "nullable": false,
            "description": "ID of this individual license assignment."
          },
          "subscriptionTypeId": {
            "type": "string",
            "nullable": false,
            "description": "Type of subscription assigned."
          },
          "userId": {
            "type": "string",
            "nullable": false,
            "description": "Account receiving the license."
          },
          "organizationSubscriptionTypeId": {
            "type": "string",
            "nullable": false,
            "description": "Organization subscription type supplying the license."
          },
          "assignedAt": {
            "type": "string",
            "nullable": false,
            "format": "date-time",
            "description": "When the license was assigned."
          },
          "assignedBy": {
            "type": "string",
            "nullable": true,
            "description": "Who assigned the license, when recorded."
          },
          "assignedUntil": {
            "type": "string",
            "nullable": false,
            "format": "date-time",
            "description": "Scheduled end of the assignment, when set."
          },
          "unassignedAt": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "When the assignment was removed, when applicable."
          },
          "unassignedBy": {
            "type": "string",
            "nullable": true,
            "description": "Who removed the assignment, when recorded."
          }
        },
        "required": [
          "userLicenseId",
          "subscriptionTypeId",
          "userId",
          "organizationSubscriptionTypeId",
          "assignedAt",
          "assignedBy",
          "assignedUntil",
          "unassignedAt",
          "unassignedBy"
        ],
        "title": "Found License Response"
      },
      "FoundRoleResponseDto": {
        "type": "object",
        "properties": {
          "roleId": {
            "type": "string",
            "nullable": false,
            "description": "Assigned role ID."
          },
          "roleName": {
            "type": "string",
            "nullable": false,
            "description": "Name of the assigned role."
          },
          "product": {
            "type": "string",
            "enum": [
              "BUSINESSCARDS",
              "DATAENRICHMENT",
              "DATAAGENTS",
              "VISITREPORT",
              "LEADRESEARCH"
            ],
            "nullable": true,
            "description": "Product the role applies to."
          }
        },
        "required": [
          "roleId",
          "roleName",
          "product"
        ],
        "title": "Found Role Response"
      },
      "FoundGroupResponseDto": {
        "type": "object",
        "properties": {
          "groupId": {
            "type": "string",
            "nullable": false,
            "description": "ID to use when filtering by group."
          },
          "organizationId": {
            "type": "string",
            "nullable": false,
            "description": "Organization that owns the group."
          },
          "name": {
            "type": "string",
            "nullable": false,
            "description": "Group name."
          }
        },
        "required": [
          "groupId",
          "organizationId",
          "name"
        ],
        "title": "Found Group Response"
      },
      "ErrorArrayDto": {
        "type": "object",
        "properties": {
          "errors": {
            "type": "array",
            "description": "Holds one or more errors that occurred.",
            "items": {
              "$ref": "#/components/schemas/ErrorDto"
            }
          }
        },
        "required": [
          "errors"
        ],
        "title": "Error Array"
      },
      "ErrorDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "A short, technical ID of the occurred error"
          },
          "message": {
            "type": "string",
            "description": "A longer, more detailed error cause explanation"
          }
        },
        "required": [
          "id",
          "message"
        ],
        "title": "Error"
      },
      "FindUserIdsResponseDto": {
        "type": "object",
        "properties": {
          "userIds": {
            "nullable": false,
            "description": "All user ids that match the provided filter criteria.",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "userIds"
        ],
        "title": "Find User Ids Response"
      },
      "GetUserLicensePermissionsPerOrganizationResponseDto": {
        "type": "object",
        "properties": {
          "organizationId": {
            "type": "string",
            "nullable": false,
            "description": "The encoded organization ID."
          },
          "organizationName": {
            "type": "string",
            "nullable": false,
            "description": "The name of the organization."
          },
          "permissions": {
            "nullable": false,
            "description": "List of all license access the user has in the organization.",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "organizationId",
          "organizationName",
          "permissions"
        ],
        "title": "License access by organization"
      }
    },
    "securitySchemes": {
      "x-api-key": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "Use a [personal API token](/authentication/#personal-api-token)."
      }
    }
  }
}
