Skip to main content
POST
/
clients
/
{id}
/
rules
Create Client Rule
curl --request POST \
  --url https://api.roostedhr.com/api/1_12/clients/{id}/rules \
  --header 'Content-Type: application/json' \
  --header 'X-API-KEY: <api-key>' \
  --data '
{
  "field_id": 111,
  "operator": "is not",
  "tag_id": null,
  "value": "Value"
}
'
{
  "fields": [
    {
      "id": "<string>",
      "field_id": "<string>",
      "field_type": "<string>",
      "field_name": "<string>",
      "operator": "<string>",
      "answers": [
        {
          "id": "<string>",
          "display": "<string>"
        }
      ],
      "value": "<string>"
    }
  ],
  "credentials": [
    {
      "id": "<string>",
      "credentials_id": "<string>",
      "field_id": "<string>",
      "field_type": "<string>",
      "field_name": "<string>",
      "name": "<string>",
      "operator": "<string>",
      "answers": [
        {
          "id": "<string>",
          "display": "<string>"
        }
      ],
      "value": "<string>"
    }
  ],
  "has_tags": [
    {
      "rule_id": "<string>",
      "id": "<string>",
      "text": "<string>",
      "operator": "<string>"
    }
  ],
  "does_not_have_tags": [
    {
      "rule_id": "<string>",
      "id": "<string>",
      "text": "<string>",
      "operator": "<string>"
    }
  ]
}
Rules filter which workers are eligible for this client’s events. A rule is defined by a field_id (referencing a worker custom field) and an operator (is, is not, etc.). The response includes the full rule structure with resolved field names, credentials, and tags:
  • fields — Custom field conditions (e.g., “Facial Hair is Yes”).
  • credentials — Credential requirements (e.g., “has Completion certificate”).
  • has_tags — Workers must have these tags.
  • does_not_have_tags — Workers must not have these tags.

Authorizations

X-API-KEY
string
header
required

Path Parameters

id
string
required

Client ID

Body

application/json

Rule definition. Requires field_id and operator.

field_id
integer
required

Custom field ID to match against.

operator
string
required

Comparison operator (e.g., is, is not).

tag_id
string | null

Tag ID for tag-based rules.

value

Value to compare against.

Response

Created

A worker matching rule for a client, composed of field conditions, credential requirements, and tag filters.

fields
ClientRuleField · object[]
credentials
ClientRuleCredential · object[]
has_tags
ClientRuleTag · object[]
does_not_have_tags
ClientRuleTag · object[]