HubstaffDeveloper Portal

Smart notification rules

Configure automated notification triggers

Get smart notification rule

GET/v2/insights/smart_notification_rules/{rule_id}

Returns the smart notification rule with the given ID.

Parameters

NameInTypeDescription
rule_idrequired
pathinteger (int32)
smart notification rule ID

Responses

200A smart notification rule
object
  • smart_notification_ruleobject
    object

    SmartNotificationRule model

    • idinteger required

      Smart notification rule ID

    • namestring required

      Smart notification rule name

    • enabledboolean required

      Indicates whether the smart notification rule is enabled

    • frequencystring required

      Determines how often the conditions for notifications are checked

    • metric_typestring required

      Metric type to be monitored

    • conditionstring required

      Comparison condition for triggering the notification

    • condition_valuenumber required

      Rule threshold value (in seconds if metric type is work_time or time_spent_in_tool)

    • time_unitstring

      Duration of time over which the rule is evaluated. It specifies the length of the observation period

    • targetobject required

      Who will be monitored by the rule

      object

      Who will be monitored by the rule

    • recipientsobject required

      Who will receive the notifications when the rule conditions are met

      object

      Who will receive the notifications when the rule conditions are met

    • deliver_byarray required

      List of delivery methods for sending notifications. By default, `insights` is always included

      array<string>

      List of delivery methods for sending notifications. By default, `insights` is always included

      items
      string
    • created_atstring required

      When the record was created

    • updated_atstring required

      When the record was last updated

Example response
json
{
  "smart_notification_rule": {
    "id": 0,
    "name": "string",
    "enabled": false,
    "frequency": "hourly",
    "metric_type": "work_time",
    "condition": "above",
    "condition_value": 0,
    "time_unit": "per_hour",
    "target": {},
    "recipients": {},
    "deliver_by": [
      "email"
    ],
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-15T10:30:00Z"
  }
}
400Invalid parameters
object

Hubstaff_Public_V2_Entities_Error model

  • codestring required

    Legacy string error code for backward compatibility

  • error_codeinteger

    Numeric error code for i18n/programmatic handling. Ranges: 10000-10999 (Auth), 11000-11999 (Validation), 12000-12999 (Resource), 13000-13999 (Rate Limit), 14000-14999 (Time Entry/Activity), 15000-15999 (System). See GET /v2/error_codes for full reference.

  • errorstring required

    Human-readable error message

  • detailsarray

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    array<string>

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    items
    string
Example response
json
{
  "code": "string",
  "error_code": 0,
  "error": "string",
  "details": [
    "string"
  ]
}
401Unauthorized
object

Hubstaff_Public_V2_Entities_Error model

  • codestring required

    Legacy string error code for backward compatibility

  • error_codeinteger

    Numeric error code for i18n/programmatic handling. Ranges: 10000-10999 (Auth), 11000-11999 (Validation), 12000-12999 (Resource), 13000-13999 (Rate Limit), 14000-14999 (Time Entry/Activity), 15000-15999 (System). See GET /v2/error_codes for full reference.

  • errorstring required

    Human-readable error message

  • detailsarray

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    array<string>

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    items
    string
Example response
json
{
  "code": "string",
  "error_code": 0,
  "error": "string",
  "details": [
    "string"
  ]
}
403API access is only for organizations on an active plan
object

Hubstaff_Public_V2_Entities_Error model

  • codestring required

    Legacy string error code for backward compatibility

  • error_codeinteger

    Numeric error code for i18n/programmatic handling. Ranges: 10000-10999 (Auth), 11000-11999 (Validation), 12000-12999 (Resource), 13000-13999 (Rate Limit), 14000-14999 (Time Entry/Activity), 15000-15999 (System). See GET /v2/error_codes for full reference.

  • errorstring required

    Human-readable error message

  • detailsarray

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    array<string>

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    items
    string
Example response
json
{
  "code": "string",
  "error_code": 0,
  "error": "string",
  "details": [
    "string"
  ]
}
404Could not find record
object

Hubstaff_Public_V2_Entities_Error model

  • codestring required

    Legacy string error code for backward compatibility

  • error_codeinteger

    Numeric error code for i18n/programmatic handling. Ranges: 10000-10999 (Auth), 11000-11999 (Validation), 12000-12999 (Resource), 13000-13999 (Rate Limit), 14000-14999 (Time Entry/Activity), 15000-15999 (System). See GET /v2/error_codes for full reference.

  • errorstring required

    Human-readable error message

  • detailsarray

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    array<string>

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    items
    string
Example response
json
{
  "code": "string",
  "error_code": 0,
  "error": "string",
  "details": [
    "string"
  ]
}
429Rate limit exceeded
object

Hubstaff_Public_V2_Entities_Error model

  • codestring required

    Legacy string error code for backward compatibility

  • error_codeinteger

    Numeric error code for i18n/programmatic handling. Ranges: 10000-10999 (Auth), 11000-11999 (Validation), 12000-12999 (Resource), 13000-13999 (Rate Limit), 14000-14999 (Time Entry/Activity), 15000-15999 (System). See GET /v2/error_codes for full reference.

  • errorstring required

    Human-readable error message

  • detailsarray

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    array<string>

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    items
    string
Example response
json
{
  "code": "string",
  "error_code": 0,
  "error": "string",
  "details": [
    "string"
  ]
}

Update smart notification rule

PUT/v2/insights/smart_notification_rules/{rule_id}

Updates a smart notification rule.

Returns the updated smart notification rule.

Only pass in the fields you want to change.

Parameters

NameInTypeDescription
rule_idrequired
pathinteger (int32)
smart notification rule ID

Request body

object

Update smart notification rule

  • namestring

    Rule name

  • frequencystring

    Determines how often the conditions for notifications are checked

  • metric_typestring

    Metric type to be monitored

  • conditionstring

    Rule condition

  • condition_valuenumber

    Rule threshold value (in seconds if metric type is work_timeor time_spent_in_tool)

  • targetobject
    object
    • all_membersboolean

      Monitor all members

    • team_idsarray

      Monitor specific teams

      array<integer>

      Monitor specific teams

      items
      integer(int32)
    • user_idsarray

      Monitor specific users

      array<integer>

      Monitor specific users

      items
      integer(int32)
  • recipientsobject

    Who will receive the notifications

    object

    Who will receive the notifications

    • rolesarray

      The recipient roles (e.g., ["owner"])

      array<string>

      The recipient roles (e.g., ["owner"])

      items
      string
    • user_idsarray

      The recipient members

      array<integer>

      The recipient members

      items
      integer(int32)
  • deliver_byarray

    List of delivery methods for sending notifications

    array<string>

    List of delivery methods for sending notifications

    items
    string
  • time_unitstring

    Duration of time over which the rule is evaluated

Responses

200A smart notification rule
object
  • smart_notification_ruleobject
    object

    SmartNotificationRule model

    • idinteger required

      Smart notification rule ID

    • namestring required

      Smart notification rule name

    • enabledboolean required

      Indicates whether the smart notification rule is enabled

    • frequencystring required

      Determines how often the conditions for notifications are checked

    • metric_typestring required

      Metric type to be monitored

    • conditionstring required

      Comparison condition for triggering the notification

    • condition_valuenumber required

      Rule threshold value (in seconds if metric type is work_time or time_spent_in_tool)

    • time_unitstring

      Duration of time over which the rule is evaluated. It specifies the length of the observation period

    • targetobject required

      Who will be monitored by the rule

      object

      Who will be monitored by the rule

    • recipientsobject required

      Who will receive the notifications when the rule conditions are met

      object

      Who will receive the notifications when the rule conditions are met

    • deliver_byarray required

      List of delivery methods for sending notifications. By default, `insights` is always included

      array<string>

      List of delivery methods for sending notifications. By default, `insights` is always included

      items
      string
    • created_atstring required

      When the record was created

    • updated_atstring required

      When the record was last updated

Example response
json
{
  "smart_notification_rule": {
    "id": 0,
    "name": "string",
    "enabled": false,
    "frequency": "hourly",
    "metric_type": "work_time",
    "condition": "above",
    "condition_value": 0,
    "time_unit": "per_hour",
    "target": {},
    "recipients": {},
    "deliver_by": [
      "email"
    ],
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-15T10:30:00Z"
  }
}
400Invalid parameters
object

Hubstaff_Public_V2_Entities_Error model

  • codestring required

    Legacy string error code for backward compatibility

  • error_codeinteger

    Numeric error code for i18n/programmatic handling. Ranges: 10000-10999 (Auth), 11000-11999 (Validation), 12000-12999 (Resource), 13000-13999 (Rate Limit), 14000-14999 (Time Entry/Activity), 15000-15999 (System). See GET /v2/error_codes for full reference.

  • errorstring required

    Human-readable error message

  • detailsarray

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    array<string>

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    items
    string
Example response
json
{
  "code": "string",
  "error_code": 0,
  "error": "string",
  "details": [
    "string"
  ]
}
401Unauthorized
object

Hubstaff_Public_V2_Entities_Error model

  • codestring required

    Legacy string error code for backward compatibility

  • error_codeinteger

    Numeric error code for i18n/programmatic handling. Ranges: 10000-10999 (Auth), 11000-11999 (Validation), 12000-12999 (Resource), 13000-13999 (Rate Limit), 14000-14999 (Time Entry/Activity), 15000-15999 (System). See GET /v2/error_codes for full reference.

  • errorstring required

    Human-readable error message

  • detailsarray

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    array<string>

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    items
    string
Example response
json
{
  "code": "string",
  "error_code": 0,
  "error": "string",
  "details": [
    "string"
  ]
}
403API access is only for organizations on an active plan
object

Hubstaff_Public_V2_Entities_Error model

  • codestring required

    Legacy string error code for backward compatibility

  • error_codeinteger

    Numeric error code for i18n/programmatic handling. Ranges: 10000-10999 (Auth), 11000-11999 (Validation), 12000-12999 (Resource), 13000-13999 (Rate Limit), 14000-14999 (Time Entry/Activity), 15000-15999 (System). See GET /v2/error_codes for full reference.

  • errorstring required

    Human-readable error message

  • detailsarray

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    array<string>

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    items
    string
Example response
json
{
  "code": "string",
  "error_code": 0,
  "error": "string",
  "details": [
    "string"
  ]
}
404Could not find record
object

Hubstaff_Public_V2_Entities_Error model

  • codestring required

    Legacy string error code for backward compatibility

  • error_codeinteger

    Numeric error code for i18n/programmatic handling. Ranges: 10000-10999 (Auth), 11000-11999 (Validation), 12000-12999 (Resource), 13000-13999 (Rate Limit), 14000-14999 (Time Entry/Activity), 15000-15999 (System). See GET /v2/error_codes for full reference.

  • errorstring required

    Human-readable error message

  • detailsarray

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    array<string>

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    items
    string
Example response
json
{
  "code": "string",
  "error_code": 0,
  "error": "string",
  "details": [
    "string"
  ]
}
429Rate limit exceeded
object

Hubstaff_Public_V2_Entities_Error model

  • codestring required

    Legacy string error code for backward compatibility

  • error_codeinteger

    Numeric error code for i18n/programmatic handling. Ranges: 10000-10999 (Auth), 11000-11999 (Validation), 12000-12999 (Resource), 13000-13999 (Rate Limit), 14000-14999 (Time Entry/Activity), 15000-15999 (System). See GET /v2/error_codes for full reference.

  • errorstring required

    Human-readable error message

  • detailsarray

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    array<string>

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    items
    string
Example response
json
{
  "code": "string",
  "error_code": 0,
  "error": "string",
  "details": [
    "string"
  ]
}

Delete smart notification rule

DELETE/v2/insights/smart_notification_rules/{rule_id}

Deletes a smart notification rule.

Parameters

NameInTypeDescription
rule_idrequired
pathinteger (int32)
smart notification rule ID

Responses

204Deleted successfully
400Invalid parameters
object

Hubstaff_Public_V2_Entities_Error model

  • codestring required

    Legacy string error code for backward compatibility

  • error_codeinteger

    Numeric error code for i18n/programmatic handling. Ranges: 10000-10999 (Auth), 11000-11999 (Validation), 12000-12999 (Resource), 13000-13999 (Rate Limit), 14000-14999 (Time Entry/Activity), 15000-15999 (System). See GET /v2/error_codes for full reference.

  • errorstring required

    Human-readable error message

  • detailsarray

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    array<string>

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    items
    string
Example response
json
{
  "code": "string",
  "error_code": 0,
  "error": "string",
  "details": [
    "string"
  ]
}
401Unauthorized
object

Hubstaff_Public_V2_Entities_Error model

  • codestring required

    Legacy string error code for backward compatibility

  • error_codeinteger

    Numeric error code for i18n/programmatic handling. Ranges: 10000-10999 (Auth), 11000-11999 (Validation), 12000-12999 (Resource), 13000-13999 (Rate Limit), 14000-14999 (Time Entry/Activity), 15000-15999 (System). See GET /v2/error_codes for full reference.

  • errorstring required

    Human-readable error message

  • detailsarray

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    array<string>

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    items
    string
Example response
json
{
  "code": "string",
  "error_code": 0,
  "error": "string",
  "details": [
    "string"
  ]
}
403API access is only for organizations on an active plan
object

Hubstaff_Public_V2_Entities_Error model

  • codestring required

    Legacy string error code for backward compatibility

  • error_codeinteger

    Numeric error code for i18n/programmatic handling. Ranges: 10000-10999 (Auth), 11000-11999 (Validation), 12000-12999 (Resource), 13000-13999 (Rate Limit), 14000-14999 (Time Entry/Activity), 15000-15999 (System). See GET /v2/error_codes for full reference.

  • errorstring required

    Human-readable error message

  • detailsarray

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    array<string>

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    items
    string
Example response
json
{
  "code": "string",
  "error_code": 0,
  "error": "string",
  "details": [
    "string"
  ]
}
404Could not find record
object

Hubstaff_Public_V2_Entities_Error model

  • codestring required

    Legacy string error code for backward compatibility

  • error_codeinteger

    Numeric error code for i18n/programmatic handling. Ranges: 10000-10999 (Auth), 11000-11999 (Validation), 12000-12999 (Resource), 13000-13999 (Rate Limit), 14000-14999 (Time Entry/Activity), 15000-15999 (System). See GET /v2/error_codes for full reference.

  • errorstring required

    Human-readable error message

  • detailsarray

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    array<string>

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    items
    string
Example response
json
{
  "code": "string",
  "error_code": 0,
  "error": "string",
  "details": [
    "string"
  ]
}
429Rate limit exceeded
object

Hubstaff_Public_V2_Entities_Error model

  • codestring required

    Legacy string error code for backward compatibility

  • error_codeinteger

    Numeric error code for i18n/programmatic handling. Ranges: 10000-10999 (Auth), 11000-11999 (Validation), 12000-12999 (Resource), 13000-13999 (Rate Limit), 14000-14999 (Time Entry/Activity), 15000-15999 (System). See GET /v2/error_codes for full reference.

  • errorstring required

    Human-readable error message

  • detailsarray

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    array<string>

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    items
    string
Example response
json
{
  "code": "string",
  "error_code": 0,
  "error": "string",
  "details": [
    "string"
  ]
}

Toggle smart notification rule

PATCH/v2/insights/smart_notification_rules/{rule_id}/toggle_status

Sets the status of a smart notification rule to either enabled or disabled. The ‘enabled’ parameter determines the new status of the rule.

Parameters

NameInTypeDescription
rule_idrequired
pathinteger (int32)
smart notification rule ID

Request body

object

Toggle smart notification rule

  • enabledboolean required

    Specifies the new status of the smart notification rule (true for enabled, false for disabled)

Responses

200A smart notification rule
object
  • smart_notification_ruleobject
    object

    SmartNotificationRule model

    • idinteger required

      Smart notification rule ID

    • namestring required

      Smart notification rule name

    • enabledboolean required

      Indicates whether the smart notification rule is enabled

    • frequencystring required

      Determines how often the conditions for notifications are checked

    • metric_typestring required

      Metric type to be monitored

    • conditionstring required

      Comparison condition for triggering the notification

    • condition_valuenumber required

      Rule threshold value (in seconds if metric type is work_time or time_spent_in_tool)

    • time_unitstring

      Duration of time over which the rule is evaluated. It specifies the length of the observation period

    • targetobject required

      Who will be monitored by the rule

      object

      Who will be monitored by the rule

    • recipientsobject required

      Who will receive the notifications when the rule conditions are met

      object

      Who will receive the notifications when the rule conditions are met

    • deliver_byarray required

      List of delivery methods for sending notifications. By default, `insights` is always included

      array<string>

      List of delivery methods for sending notifications. By default, `insights` is always included

      items
      string
    • created_atstring required

      When the record was created

    • updated_atstring required

      When the record was last updated

Example response
json
{
  "smart_notification_rule": {
    "id": 0,
    "name": "string",
    "enabled": false,
    "frequency": "hourly",
    "metric_type": "work_time",
    "condition": "above",
    "condition_value": 0,
    "time_unit": "per_hour",
    "target": {},
    "recipients": {},
    "deliver_by": [
      "email"
    ],
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-15T10:30:00Z"
  }
}
400Invalid parameters
object

Hubstaff_Public_V2_Entities_Error model

  • codestring required

    Legacy string error code for backward compatibility

  • error_codeinteger

    Numeric error code for i18n/programmatic handling. Ranges: 10000-10999 (Auth), 11000-11999 (Validation), 12000-12999 (Resource), 13000-13999 (Rate Limit), 14000-14999 (Time Entry/Activity), 15000-15999 (System). See GET /v2/error_codes for full reference.

  • errorstring required

    Human-readable error message

  • detailsarray

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    array<string>

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    items
    string
Example response
json
{
  "code": "string",
  "error_code": 0,
  "error": "string",
  "details": [
    "string"
  ]
}
401Unauthorized
object

Hubstaff_Public_V2_Entities_Error model

  • codestring required

    Legacy string error code for backward compatibility

  • error_codeinteger

    Numeric error code for i18n/programmatic handling. Ranges: 10000-10999 (Auth), 11000-11999 (Validation), 12000-12999 (Resource), 13000-13999 (Rate Limit), 14000-14999 (Time Entry/Activity), 15000-15999 (System). See GET /v2/error_codes for full reference.

  • errorstring required

    Human-readable error message

  • detailsarray

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    array<string>

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    items
    string
Example response
json
{
  "code": "string",
  "error_code": 0,
  "error": "string",
  "details": [
    "string"
  ]
}
403API access is only for organizations on an active plan
object

Hubstaff_Public_V2_Entities_Error model

  • codestring required

    Legacy string error code for backward compatibility

  • error_codeinteger

    Numeric error code for i18n/programmatic handling. Ranges: 10000-10999 (Auth), 11000-11999 (Validation), 12000-12999 (Resource), 13000-13999 (Rate Limit), 14000-14999 (Time Entry/Activity), 15000-15999 (System). See GET /v2/error_codes for full reference.

  • errorstring required

    Human-readable error message

  • detailsarray

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    array<string>

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    items
    string
Example response
json
{
  "code": "string",
  "error_code": 0,
  "error": "string",
  "details": [
    "string"
  ]
}
404Could not find record
object

Hubstaff_Public_V2_Entities_Error model

  • codestring required

    Legacy string error code for backward compatibility

  • error_codeinteger

    Numeric error code for i18n/programmatic handling. Ranges: 10000-10999 (Auth), 11000-11999 (Validation), 12000-12999 (Resource), 13000-13999 (Rate Limit), 14000-14999 (Time Entry/Activity), 15000-15999 (System). See GET /v2/error_codes for full reference.

  • errorstring required

    Human-readable error message

  • detailsarray

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    array<string>

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    items
    string
Example response
json
{
  "code": "string",
  "error_code": 0,
  "error": "string",
  "details": [
    "string"
  ]
}
429Rate limit exceeded
object

Hubstaff_Public_V2_Entities_Error model

  • codestring required

    Legacy string error code for backward compatibility

  • error_codeinteger

    Numeric error code for i18n/programmatic handling. Ranges: 10000-10999 (Auth), 11000-11999 (Validation), 12000-12999 (Resource), 13000-13999 (Rate Limit), 14000-14999 (Time Entry/Activity), 15000-15999 (System). See GET /v2/error_codes for full reference.

  • errorstring required

    Human-readable error message

  • detailsarray

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    array<string>

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    items
    string
Example response
json
{
  "code": "string",
  "error_code": 0,
  "error": "string",
  "details": [
    "string"
  ]
}

List smart notification rules

GET/v2/organizations/{organization_id}/insights/smart_notification_rules

Returns a collection of smart notification rules for the given organization.

Parameters

NameInTypeDescription
organization_idrequired
pathinteger (int32)
page_start_id
queryinteger (int32)
The page start ID.
page_limit
queryinteger (int32)
The default page size

Responses

200A list of smart notification rules
object
  • smart_notification_rulesarray
    array<object>
    items
    object

    SmartNotificationRule model

    • idinteger required

      Smart notification rule ID

    • namestring required

      Smart notification rule name

    • enabledboolean required

      Indicates whether the smart notification rule is enabled

    • frequencystring required

      Determines how often the conditions for notifications are checked

    • metric_typestring required

      Metric type to be monitored

    • conditionstring required

      Comparison condition for triggering the notification

    • condition_valuenumber required

      Rule threshold value (in seconds if metric type is work_time or time_spent_in_tool)

    • time_unitstring

      Duration of time over which the rule is evaluated. It specifies the length of the observation period

    • targetobject required

      Who will be monitored by the rule

      object

      Who will be monitored by the rule

    • recipientsobject required

      Who will receive the notifications when the rule conditions are met

      object

      Who will receive the notifications when the rule conditions are met

    • deliver_byarray required

      List of delivery methods for sending notifications. By default, `insights` is always included

      array<string>

      List of delivery methods for sending notifications. By default, `insights` is always included

      items
      string
    • created_atstring required

      When the record was created

    • updated_atstring required

      When the record was last updated

Example response
json
{
  "smart_notification_rules": [
    {
      "id": 0,
      "name": "string",
      "enabled": false,
      "frequency": "hourly",
      "metric_type": "work_time",
      "condition": "above",
      "condition_value": 0,
      "time_unit": "per_hour",
      "target": {},
      "recipients": {},
      "deliver_by": [
        "email"
      ],
      "created_at": "2024-01-15T10:30:00Z",
      "updated_at": "2024-01-15T10:30:00Z"
    }
  ]
}
400Invalid parameters
object

Hubstaff_Public_V2_Entities_Error model

  • codestring required

    Legacy string error code for backward compatibility

  • error_codeinteger

    Numeric error code for i18n/programmatic handling. Ranges: 10000-10999 (Auth), 11000-11999 (Validation), 12000-12999 (Resource), 13000-13999 (Rate Limit), 14000-14999 (Time Entry/Activity), 15000-15999 (System). See GET /v2/error_codes for full reference.

  • errorstring required

    Human-readable error message

  • detailsarray

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    array<string>

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    items
    string
Example response
json
{
  "code": "string",
  "error_code": 0,
  "error": "string",
  "details": [
    "string"
  ]
}
401Unauthorized
object

Hubstaff_Public_V2_Entities_Error model

  • codestring required

    Legacy string error code for backward compatibility

  • error_codeinteger

    Numeric error code for i18n/programmatic handling. Ranges: 10000-10999 (Auth), 11000-11999 (Validation), 12000-12999 (Resource), 13000-13999 (Rate Limit), 14000-14999 (Time Entry/Activity), 15000-15999 (System). See GET /v2/error_codes for full reference.

  • errorstring required

    Human-readable error message

  • detailsarray

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    array<string>

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    items
    string
Example response
json
{
  "code": "string",
  "error_code": 0,
  "error": "string",
  "details": [
    "string"
  ]
}
403API access is only for organizations on an active plan
object

Hubstaff_Public_V2_Entities_Error model

  • codestring required

    Legacy string error code for backward compatibility

  • error_codeinteger

    Numeric error code for i18n/programmatic handling. Ranges: 10000-10999 (Auth), 11000-11999 (Validation), 12000-12999 (Resource), 13000-13999 (Rate Limit), 14000-14999 (Time Entry/Activity), 15000-15999 (System). See GET /v2/error_codes for full reference.

  • errorstring required

    Human-readable error message

  • detailsarray

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    array<string>

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    items
    string
Example response
json
{
  "code": "string",
  "error_code": 0,
  "error": "string",
  "details": [
    "string"
  ]
}
404Could not find record
object

Hubstaff_Public_V2_Entities_Error model

  • codestring required

    Legacy string error code for backward compatibility

  • error_codeinteger

    Numeric error code for i18n/programmatic handling. Ranges: 10000-10999 (Auth), 11000-11999 (Validation), 12000-12999 (Resource), 13000-13999 (Rate Limit), 14000-14999 (Time Entry/Activity), 15000-15999 (System). See GET /v2/error_codes for full reference.

  • errorstring required

    Human-readable error message

  • detailsarray

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    array<string>

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    items
    string
Example response
json
{
  "code": "string",
  "error_code": 0,
  "error": "string",
  "details": [
    "string"
  ]
}
429Rate limit exceeded
object

Hubstaff_Public_V2_Entities_Error model

  • codestring required

    Legacy string error code for backward compatibility

  • error_codeinteger

    Numeric error code for i18n/programmatic handling. Ranges: 10000-10999 (Auth), 11000-11999 (Validation), 12000-12999 (Resource), 13000-13999 (Rate Limit), 14000-14999 (Time Entry/Activity), 15000-15999 (System). See GET /v2/error_codes for full reference.

  • errorstring required

    Human-readable error message

  • detailsarray

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    array<string>

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    items
    string
Example response
json
{
  "code": "string",
  "error_code": 0,
  "error": "string",
  "details": [
    "string"
  ]
}

Create smart notification rule

POST/v2/organizations/{organization_id}/insights/smart_notification_rules

Creates a new smart notification rule.

Returns the created smart notification rule. New rules are enabled by default.

Note: The metric_type of type time_spent_in_tool (used to measure time spent in an app/url) is not yet supported.

Target field options:

  • To target all members: {"all_members": true}
  • To target specific teams: {"team_ids": [team_id]}
  • To target specific members: {"user_ids": [user_id_1, user_id_2]}
  • You can combine team_ids and user_ids

Recipients field options:

  • To notify by role: {"roles": ["owner", "manager"]}
  • To notify specific members: {"user_ids": [user_id_1, user_id_2]}
  • You can combine roles and user_ids
  • Only owners, managers, and team leads can be recipients

Deliver_by field:

  • The value ‘insights’ is always included (notifications appear on the insights page)
  • You can also include ‘email’ and ‘slack’

Parameters

NameInTypeDescription
organization_idrequired
pathinteger (int32)

Request body

object

Create smart notification rule

  • namestring required

    Rule name

  • frequencystring required

    Determines how often the conditions for notifications are checked

  • metric_typestring required

    Metric type to be monitored

  • conditionstring required

    Rule condition

  • condition_valuenumber required

    Rule threshold value (in seconds if metric type is work_timeor time_spent_in_tool)

  • targetobject required

    Who will be monitored by the rule

    object

    Who will be monitored by the rule

    • all_membersboolean

      Monitor all members

    • team_idsarray

      Monitor specific teams

      array<integer>

      Monitor specific teams

      items
      integer(int32)
    • user_idsarray

      Monitor specific users

      array<integer>

      Monitor specific users

      items
      integer(int32)
  • recipientsobject required

    Who will receive the notifications

    object

    Who will receive the notifications

    • rolesarray

      Specific roles (e.g., ["owner"])

      array<string>

      Specific roles (e.g., ["owner"])

      items
      string
    • user_idsarray

      Specific users

      array<integer>

      Specific users

      items
      integer(int32)
  • deliver_byarray

    List of delivery methods for sending notifications

    array<string>

    List of delivery methods for sending notifications

    items
    string
  • time_unitstring

    Duration of time over which the rule is evaluated

Responses

201A smart notification rule
object
  • smart_notification_ruleobject
    object

    SmartNotificationRule model

    • idinteger required

      Smart notification rule ID

    • namestring required

      Smart notification rule name

    • enabledboolean required

      Indicates whether the smart notification rule is enabled

    • frequencystring required

      Determines how often the conditions for notifications are checked

    • metric_typestring required

      Metric type to be monitored

    • conditionstring required

      Comparison condition for triggering the notification

    • condition_valuenumber required

      Rule threshold value (in seconds if metric type is work_time or time_spent_in_tool)

    • time_unitstring

      Duration of time over which the rule is evaluated. It specifies the length of the observation period

    • targetobject required

      Who will be monitored by the rule

      object

      Who will be monitored by the rule

    • recipientsobject required

      Who will receive the notifications when the rule conditions are met

      object

      Who will receive the notifications when the rule conditions are met

    • deliver_byarray required

      List of delivery methods for sending notifications. By default, `insights` is always included

      array<string>

      List of delivery methods for sending notifications. By default, `insights` is always included

      items
      string
    • created_atstring required

      When the record was created

    • updated_atstring required

      When the record was last updated

Example response
json
{
  "smart_notification_rule": {
    "id": 0,
    "name": "string",
    "enabled": false,
    "frequency": "hourly",
    "metric_type": "work_time",
    "condition": "above",
    "condition_value": 0,
    "time_unit": "per_hour",
    "target": {},
    "recipients": {},
    "deliver_by": [
      "email"
    ],
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-15T10:30:00Z"
  }
}
400Invalid parameters
object

Hubstaff_Public_V2_Entities_Error model

  • codestring required

    Legacy string error code for backward compatibility

  • error_codeinteger

    Numeric error code for i18n/programmatic handling. Ranges: 10000-10999 (Auth), 11000-11999 (Validation), 12000-12999 (Resource), 13000-13999 (Rate Limit), 14000-14999 (Time Entry/Activity), 15000-15999 (System). See GET /v2/error_codes for full reference.

  • errorstring required

    Human-readable error message

  • detailsarray

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    array<string>

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    items
    string
Example response
json
{
  "code": "string",
  "error_code": 0,
  "error": "string",
  "details": [
    "string"
  ]
}
401Unauthorized
object

Hubstaff_Public_V2_Entities_Error model

  • codestring required

    Legacy string error code for backward compatibility

  • error_codeinteger

    Numeric error code for i18n/programmatic handling. Ranges: 10000-10999 (Auth), 11000-11999 (Validation), 12000-12999 (Resource), 13000-13999 (Rate Limit), 14000-14999 (Time Entry/Activity), 15000-15999 (System). See GET /v2/error_codes for full reference.

  • errorstring required

    Human-readable error message

  • detailsarray

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    array<string>

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    items
    string
Example response
json
{
  "code": "string",
  "error_code": 0,
  "error": "string",
  "details": [
    "string"
  ]
}
403API access is only for organizations on an active plan
object

Hubstaff_Public_V2_Entities_Error model

  • codestring required

    Legacy string error code for backward compatibility

  • error_codeinteger

    Numeric error code for i18n/programmatic handling. Ranges: 10000-10999 (Auth), 11000-11999 (Validation), 12000-12999 (Resource), 13000-13999 (Rate Limit), 14000-14999 (Time Entry/Activity), 15000-15999 (System). See GET /v2/error_codes for full reference.

  • errorstring required

    Human-readable error message

  • detailsarray

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    array<string>

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    items
    string
Example response
json
{
  "code": "string",
  "error_code": 0,
  "error": "string",
  "details": [
    "string"
  ]
}
404Could not find record
object

Hubstaff_Public_V2_Entities_Error model

  • codestring required

    Legacy string error code for backward compatibility

  • error_codeinteger

    Numeric error code for i18n/programmatic handling. Ranges: 10000-10999 (Auth), 11000-11999 (Validation), 12000-12999 (Resource), 13000-13999 (Rate Limit), 14000-14999 (Time Entry/Activity), 15000-15999 (System). See GET /v2/error_codes for full reference.

  • errorstring required

    Human-readable error message

  • detailsarray

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    array<string>

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    items
    string
Example response
json
{
  "code": "string",
  "error_code": 0,
  "error": "string",
  "details": [
    "string"
  ]
}
429Rate limit exceeded
object

Hubstaff_Public_V2_Entities_Error model

  • codestring required

    Legacy string error code for backward compatibility

  • error_codeinteger

    Numeric error code for i18n/programmatic handling. Ranges: 10000-10999 (Auth), 11000-11999 (Validation), 12000-12999 (Resource), 13000-13999 (Rate Limit), 14000-14999 (Time Entry/Activity), 15000-15999 (System). See GET /v2/error_codes for full reference.

  • errorstring required

    Human-readable error message

  • detailsarray

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    array<string>

    Per-attribute validation errors: [{attribute, error}]. Present on validation failures.

    items
    string
Example response
json
{
  "code": "string",
  "error_code": 0,
  "error": "string",
  "details": [
    "string"
  ]
}