{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/when-i-work/json-schema/when-i-work-components-schemas-user-schema.json",
  "title": "components-schemas-User",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/when-i-work-accounts-api-openapi.yml#/components/schemas/components-schemas-User",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer",
      "readOnly": true,
      "description": "Unique identifier for the user"
    },
    "login_id": {
      "type": "integer",
      "readOnly": true,
      "description": "Unique identifier for the person/login belonging to the user."
    },
    "account_id": {
      "type": "integer",
      "readOnly": true,
      "description": "ID of the account for this user."
    },
    "role": {
      "type": "integer",
      "enum": [
        1,
        2,
        3,
        5
      ],
      "description": "The user's role:\n * `1` - Admin\n * `2` - Manager\n * `3` - Employee (Default)\n * `5` - Supervisor\n"
    },
    "email": {
      "type": "string",
      "description": "The email address of the user."
    },
    "first_name": {
      "type": "string",
      "description": "The first name of the user."
    },
    "middle_name": {
      "type": "string",
      "description": "The middle name of the user."
    },
    "last_name": {
      "type": "string",
      "description": "The last name of the user."
    },
    "phone_number": {
      "type": "string",
      "description": "The phone number of the user"
    },
    "employee_code": {
      "type": "string",
      "description": "The user's employee code. This code can be used to clock in instead of the user's email address, or it can be used to help map users in When I Work to other services.\n"
    },
    "activated": {
      "type": "boolean",
      "readOnly": true,
      "description": "Indicates of a manager has activated (accepted a pending user) this user."
    },
    "notes": {
      "type": "string",
      "description": "Notes about this user. (Only viewable by supervisors and managers)."
    },
    "hours_max": {
      "type": "number",
      "format": "float",
      "description": "The max hours that this user can work."
    },
    "hourly_rate": {
      "type": "number",
      "format": "float",
      "description": "The hourly rate for this user. (Only viewable by managers and supervisors that can do payroll)."
    },
    "position_rates": {
      "type": "object",
      "description": "A mapping of position IDs to the user's hourly rate for that position. The rates here are applied on\ntop of the user's base hourly rate (see hourly_rate). A user with an hourly rate of 15 and a position rate \nof 1 for position 1001 would result in an hourly rate of 16 for position 1001. (Only viewable by managers \nand supervisors that can do payroll).\n"
    },
    "type": {
      "type": "integer",
      "description": "Use the `employment_type` property instead.\nA bitwise flag representing additional wage options:\n * `1` - Hourly employee\n * `2` - Salaried employee\n * `5` - Exempt from overtime.\n",
      "deprecated": true
    },
    "employment_type": {
      "type": "string",
      "enum": [
        "hourly",
        "hourly_exempt",
        "salaried *",
        "salaried_exempt *",
        "shareholder *"
      ],
      "description": "Employment type of the user. *These options are only available to payroll customers"
    },
    "last_login": {
      "type": "string",
      "format": "date-time",
      "readOnly": true,
      "description": "The date and time when this user last logged in."
    },
    "positions": {
      "type": "array",
      "items": {
        "type": "integer"
      },
      "description": "An array of positions assigned to this user."
    },
    "locations": {
      "type": "array",
      "items": {
        "type": "integer"
      },
      "description": "An array of locations (schedules) assigned to this user."
    },
    "is_deleted": {
      "type": "boolean",
      "readOnly": true,
      "description": "Whether the user has been deleted."
    },
    "is_hidden": {
      "type": "boolean",
      "description": "Whether the user has been hidden from the scheduler."
    },
    "is_payroll": {
      "type": "boolean",
      "description": "Whether the user has access to payroll. (Only available for managers and supervisors)."
    },
    "is_private": {
      "type": "boolean",
      "description": "Whether the user has privacy enabled, which will hide their contact details from other employees (excluding supervisors and managers)."
    },
    "is_trusted": {
      "type": "boolean",
      "description": "Whether the user can edit their own timesheet."
    },
    "created_at": {
      "readOnly": true,
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "readOnly": true,
      "type": "string",
      "format": "date-time"
    },
    "start_date": {
      "type": "string",
      "format": "date",
      "description": "yyyy-mm-dd formatted date for when the user started their employment"
    }
  }
}