{
  "openapi": "3.1.0",
  "info": {
    "description": "Users API",
    "title": "Users",
    "version": "1.0"
  },
  "externalDocs": {
    "description": "Trackunit Developer Hub",
    "url": "https://dev.trackunit.com/v3.0/"
  },
  "servers": [
    {
      "url": "https://iris.trackunit.com/api/organization/v1",
      "description": "Production"
    }
  ],
  "security": [
    {
      "authorizationBearer": []
    }
  ],
  "paths": {
    "/roles": {
      "get": {
        "description": "Sort properties: id, name",
        "operationId": "getRoles",
        "parameters": [
          {
            "description": "Zero-based page index (0..N)",
            "example": 0,
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 0,
              "minimum": 0
            }
          },
          {
            "description": "The size of the page to be returned",
            "example": 20,
            "in": "query",
            "name": "size",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20,
              "minimum": 1
            }
          },
          {
            "description": "Sort order: `property` (ascending by default), `+property` (ascending), `-property` (descending).",
            "in": "query",
            "name": "sort",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedRole"
                }
              }
            },
            "description": "A list of available roles."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConstraintViolationError"
                }
              }
            },
            "description": "Bad request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Invalid or missing bearer token in Authorization header"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "User not allowed to make this request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Resource not found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Get Roles",
        "tags": ["Roles"]
      }
    },
    "/users": {
      "get": {
        "description": "Sort properties: id, name, username, email",
        "operationId": "getUsers",
        "parameters": [
          {
            "description": "Zero-based page index (0..N)",
            "example": 0,
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 0,
              "minimum": 0
            }
          },
          {
            "description": "The size of the page to be returned",
            "example": 20,
            "in": "query",
            "name": "size",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20,
              "minimum": 1
            }
          },
          {
            "description": "Sort order: `property` (ascending by default), `+property` (ascending), `-property` (descending).",
            "in": "query",
            "name": "sort",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "allowEmptyValue": true,
            "description": "Search in name, email and phone. Substring match ignoring case in either field will result in a match.",
            "in": "query",
            "name": "search",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedUser"
                }
              }
            },
            "description": "A list of available users."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConstraintViolationError"
                }
              }
            },
            "description": "Bad request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Invalid or missing bearer token in Authorization header"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "User not allowed to make this request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Resource not found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Get Users"
      },
      "post": {
        "operationId": "createUser",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateUserRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/User"
                }
              }
            },
            "description": "User was successfully created."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConstraintViolationError"
                }
              }
            },
            "description": "Bad request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Invalid or missing bearer token in Authorization header"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "User not allowed to make this request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Resource not found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Create User"
      }
    },
    "/users/activations/{identifier}": {
      "post": {
        "deprecated": true,
        "description": "Activate a user and set the username/password. The activation identifier is received per email as part of the user creation flow. Also the identifier is part of the create user api response.\nDeprecation notice: This endpoint will no longer be available. The user will be required to activate the account by following the link in the email. If a specific username is required it can be set as part of the create user request.\n",
        "operationId": "activateUser",
        "parameters": [
          {
            "description": "The activation identifier for the user",
            "in": "path",
            "name": "identifier",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ActivateUserRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "User was successfully activated."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConstraintViolationError"
                }
              }
            },
            "description": "Bad request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Invalid or missing bearer token in Authorization header"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "User not allowed to make this request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Resource not found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Activate User",
        "tags": ["Flows"]
      }
    },
    "/users/export": {
      "get": {
        "description": "Export all users as an Excel file.",
        "operationId": "exportUsers",
        "responses": {
          "200": {
            "content": {
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "type": "string",
                  "format": "binary",
                  "contentMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
                }
              }
            },
            "description": "Excel file with all users."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConstraintViolationError"
                }
              }
            },
            "description": "Bad request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Invalid or missing bearer token in Authorization header"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "User not allowed to make this request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Resource not found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Export users"
      }
    },
    "/users/password-reset-requests/{username}": {
      "post": {
        "description": "Request password reset for specified user (username). An email will be sent to the user's email address with instructions on how to set a new password.",
        "operationId": "requestPasswordReset",
        "parameters": [
          {
            "description": "The username to reset password for",
            "in": "path",
            "name": "username",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Reset password request was successful."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConstraintViolationError"
                }
              }
            },
            "description": "Bad request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Invalid or missing bearer token in Authorization header"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "User not allowed to make this request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Resource not found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Request Password Reset",
        "tags": ["Flows"]
      }
    },
    "/users/passwords/{identifier}": {
      "post": {
        "description": "Set new password for user knowing the reset password identifier. The identifier is received per email as part of the request password reset flow.",
        "operationId": "setPassword",
        "parameters": [
          {
            "description": "The identifier to set password for",
            "in": "path",
            "name": "identifier",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetUserPasswordRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Set password request was successful."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConstraintViolationError"
                }
              }
            },
            "description": "Bad request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Invalid or missing bearer token in Authorization header"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "User not allowed to make this request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Resource not found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Reset Password",
        "tags": ["Flows"]
      }
    },
    "/users/query": {
      "post": {
        "description": "Get a list of users knowing their identifiers.",
        "operationId": "queryUsers",
        "parameters": [
          {
            "allowEmptyValue": true,
            "description": "Zero-based page index (0..N)",
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "type": "string",
              "minimum": 0
            }
          },
          {
            "allowEmptyValue": true,
            "description": "The size of the page to be returned",
            "in": "query",
            "name": "size",
            "required": false,
            "schema": {
              "type": "string",
              "minimum": 1
            }
          },
          {
            "allowEmptyValue": true,
            "description": "Sort order: `property` (ascending by default), `+property` (ascending), `-property` (descending). Sort properties: id, name, username, email",
            "in": "query",
            "name": "sort",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QueryUsersRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedUser"
                }
              }
            },
            "description": "A list of users."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConstraintViolationError"
                }
              }
            },
            "description": "Bad request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Invalid or missing bearer token in Authorization header"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "User not allowed to make this request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Resource not found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Query Users by Identifiers",
        "tags": ["Queries"]
      }
    },
    "/users/{userId}": {
      "delete": {
        "operationId": "deleteUser",
        "parameters": [
          {
            "description": "ID of the user",
            "in": "path",
            "name": "userId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "User was successfully deleted."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConstraintViolationError"
                }
              }
            },
            "description": "Bad request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Invalid or missing bearer token in Authorization header"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "User not allowed to make this request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Resource not found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Delete User"
      },
      "get": {
        "operationId": "getUser",
        "parameters": [
          {
            "description": "ID of the user",
            "in": "path",
            "name": "userId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/User"
                }
              }
            },
            "description": "A specific user by its user ID."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConstraintViolationError"
                }
              }
            },
            "description": "Bad request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Invalid or missing bearer token in Authorization header"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "User not allowed to make this request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Resource not found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Get User"
      },
      "patch": {
        "operationId": "patchUser",
        "parameters": [
          {
            "description": "ID of the user",
            "in": "path",
            "name": "userId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchUserRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/User"
                }
              }
            },
            "description": "User was successfully updated."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConstraintViolationError"
                }
              }
            },
            "description": "Bad request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Invalid or missing bearer token in Authorization header"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "User not allowed to make this request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Resource not found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Update User"
      }
    }
  },
  "components": {
    "schemas": {
      "ActivateUserRequest": {
        "type": "object",
        "properties": {
          "password": {
            "type": "string",
            "description": "The password of the user",
            "example": "Password123",
            "maxLength": 100,
            "minLength": 0
          },
          "username": {
            "type": "string",
            "description": "The username of the user",
            "example": "ThomAndersen",
            "maxLength": 100,
            "minLength": 0
          }
        },
        "required": ["password", "username"]
      },
      "ConstraintViolationError": {
        "type": "object",
        "properties": {
          "code": {
            "type": ["string", "null"],
            "description": "Alphanumeric code (snake case) describing use case specific error"
          },
          "message": {
            "type": "string",
            "description": "Detailed description of error"
          },
          "properties": {
            "type": ["object", "null"],
            "additionalProperties": {},
            "description": "Additional properties to be included in the error response"
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "description": "HTTP status code"
          },
          "violations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Violation"
            }
          }
        }
      },
      "CreateUserRequest": {
        "type": "object",
        "properties": {
          "companyName": {
            "type": "string",
            "description": "Company name",
            "maxLength": 50,
            "minLength": 0
          },
          "email": {
            "type": "string",
            "description": "Email address of the user",
            "example": "email@domain.com",
            "maxLength": 254,
            "minLength": 0,
            "pattern": "^[a-zA-Z0-9À-ÿ_.+-]+@[a-zA-Z0-9À-ÿ-]+\\.[a-zA-Z0-9-.]+$"
          },
          "employeeNumber": {
            "type": "string",
            "description": "Employee number/IPAF id",
            "maxLength": 50,
            "minLength": 0
          },
          "federated": {
            "type": "boolean",
            "default": false,
            "description": "The user has a federated identity and authenticates with an external IdP.\nThe user is activated upon creation and will not receive an activation email."
          },
          "mobilePhone": {
            "$ref": "#/components/schemas/Phone",
            "description": "Mobile phone number"
          },
          "name": {
            "type": "string",
            "description": "The name of the user",
            "example": "Thom Andersen",
            "maxLength": 100,
            "minLength": 0
          },
          "roleId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of user role to assign user"
          },
          "username": {
            "type": "string",
            "description": "The username of the user",
            "maxLength": 50,
            "minLength": 1
          }
        },
        "required": ["email", "name"]
      },
      "DefaultError": {
        "type": "object",
        "properties": {
          "code": {
            "type": ["string", "null"],
            "description": "Alphanumeric code (snake case) describing use case specific error"
          },
          "message": {
            "type": "string",
            "description": "Detailed description of error"
          },
          "properties": {
            "type": ["object", "null"],
            "additionalProperties": {},
            "description": "Additional properties to be included in the error response"
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "description": "HTTP status code"
          }
        }
      },
      "PaginatedRole": {
        "type": "object",
        "properties": {
          "content": {
            "type": "array",
            "description": "The page content as a list.",
            "items": {
              "$ref": "#/components/schemas/Role"
            }
          },
          "number": {
            "type": "integer",
            "format": "int32",
            "description": "The number of the current page."
          },
          "numberOfElements": {
            "type": "integer",
            "format": "int32",
            "description": "The number of elements currently on this page."
          },
          "size": {
            "type": "integer",
            "format": "int32",
            "description": "The size of the page."
          },
          "totalElements": {
            "type": "integer",
            "format": "int64",
            "description": "The total number of elements."
          },
          "totalPages": {
            "type": "integer",
            "format": "int32",
            "description": "The number of total pages."
          }
        }
      },
      "PaginatedUser": {
        "type": "object",
        "properties": {
          "content": {
            "type": "array",
            "description": "The page content as a list.",
            "items": {
              "$ref": "#/components/schemas/User"
            }
          },
          "number": {
            "type": "integer",
            "format": "int32",
            "description": "The number of the current page."
          },
          "numberOfElements": {
            "type": "integer",
            "format": "int32",
            "description": "The number of elements currently on this page."
          },
          "size": {
            "type": "integer",
            "format": "int32",
            "description": "The size of the page."
          },
          "totalElements": {
            "type": "integer",
            "format": "int64",
            "description": "The total number of elements."
          },
          "totalPages": {
            "type": "integer",
            "format": "int32",
            "description": "The number of total pages."
          }
        }
      },
      "PatchUserRequest": {
        "type": "object",
        "properties": {
          "companyName": {
            "type": "string",
            "description": "Company name",
            "maxLength": 50,
            "minLength": 0
          },
          "email": {
            "type": "string",
            "description": "Email address of the user",
            "example": "email@domain.com",
            "maxLength": 254,
            "minLength": 1,
            "pattern": "^[a-zA-Z0-9À-ÿ_.+-]+@[a-zA-Z0-9À-ÿ-]+\\.[a-zA-Z0-9-.]+$"
          },
          "employeeNumber": {
            "type": "string",
            "description": "Employee number/IPAF id",
            "maxLength": 50,
            "minLength": 0
          },
          "mobilePhone": {
            "$ref": "#/components/schemas/Phone",
            "description": "Mobile phone number"
          },
          "name": {
            "type": "string",
            "description": "The name of the user",
            "example": "Thom Andersen",
            "maxLength": 100,
            "minLength": 1
          },
          "roleId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of user role to assign user"
          }
        }
      },
      "Phone": {
        "type": "object",
        "properties": {
          "countryCode": {
            "type": "string",
            "description": "Country code without any call prefix (plus sign or leading zeros)",
            "example": 45,
            "minLength": 1,
            "pattern": "^[1-9][0-9]{0,3}$"
          },
          "number": {
            "type": "string",
            "description": "Subscriber number",
            "example": 12345678,
            "minLength": 1,
            "pattern": "^[0-9]{1,14}$"
          }
        },
        "required": ["countryCode", "number"]
      },
      "QueryUsersRequest": {
        "type": "object",
        "properties": {
          "userIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        }
      },
      "Role": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "The id of the role",
            "example": "A1E8906E-A793-4118-AB86-43DF4E9F3A87"
          },
          "name": {
            "type": "string",
            "description": "The name of the role",
            "example": "user"
          }
        }
      },
      "SetUserPasswordRequest": {
        "type": "object",
        "properties": {
          "password": {
            "type": "string",
            "description": "The password of the user",
            "example": "Password123",
            "maxLength": 100,
            "minLength": 0
          }
        },
        "required": ["password"]
      },
      "UpdateUserGroupsRequest": {
        "type": "object",
        "properties": {
          "groupIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        },
        "required": ["groupIds"]
      },
      "User": {
        "type": "object",
        "properties": {
          "activationId": {
            "type": "string",
            "format": "uuid",
            "deprecated": true,
            "description": "The identifier to be used when activating the user.\nDeprecation notice: This token will no longer be returned and will only be available in the link sent to the user's email.\n",
            "example": "8F5FA1AB-8E48-4963-A483-5D0EA7AC7983"
          },
          "companyName": {
            "type": "string",
            "description": "Company name"
          },
          "email": {
            "type": "string",
            "description": "Email address of the user",
            "example": "email@domain.com"
          },
          "employeeNumber": {
            "type": "string",
            "description": "Employee number/IPAF id"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "The id of the user",
            "example": "9849654A-66C2-40A7-AB51-628F3BEF16AA"
          },
          "lastLogin": {
            "type": "string",
            "format": "date-time",
            "description": "The last time (UTC) the user logged in"
          },
          "mobilePhone": {
            "$ref": "#/components/schemas/Phone",
            "description": "Mobile phone number"
          },
          "name": {
            "type": "string",
            "description": "The name of the user",
            "example": "Thom Andersen"
          },
          "role": {
            "$ref": "#/components/schemas/Role",
            "description": "The role of the user"
          },
          "username": {
            "type": "string",
            "description": "The username of the user",
            "example": "thomAndersen"
          }
        }
      },
      "Violation": {
        "type": "object",
        "properties": {
          "field": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      }
    },
    "securitySchemes": {
      "authorizationBearer": {
        "bearerFormat": "JWT",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  }
}
