Skip to main content
POST
/
api
/
public
/
v1
/
automation
Create automation rule
curl --request POST \
  --url https://app.msportal.ai/api/public/v1/automation \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "triggerType": "date_threshold",
  "triggerConfig": {},
  "entityType": "device",
  "conditions": [
    "<unknown>"
  ],
  "actions": [
    "<unknown>"
  ],
  "description": "<string>",
  "isActive": false,
  "priority": 0,
  "scopeType": "tenant",
  "companyIds": [
    "3c90c3cc-0d44-4b50-8888-8dd25736052a"
  ],
  "aggregationConfig": "<unknown>"
}
'
{
  "data": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "name": "<string>",
    "description": "<string>",
    "isActive": true,
    "priority": 123,
    "scopeType": "tenant",
    "companyIds": [
      "3c90c3cc-0d44-4b50-8888-8dd25736052a"
    ],
    "triggerType": "<string>",
    "entityType": "<string>",
    "triggerConfig": {},
    "conditions": [
      {
        "id": "<string>",
        "logic": "AND",
        "conditions": [
          {
            "id": "<string>",
            "field": "<string>",
            "operator": "<string>",
            "value": "<unknown>"
          }
        ],
        "groups": [
          "<unknown>"
        ]
      }
    ],
    "actions": [
      {
        "id": "<string>",
        "actionType": "<string>",
        "config": {},
        "order": 123,
        "requiresApproval": true
      }
    ],
    "aggregationConfig": {
      "enabled": true,
      "groupBy": "<string>",
      "groupField": "<string>",
      "minBatchSize": 123,
      "maxWaitHours": 123,
      "combinedActionConfig": {
        "titleTemplate": "<string>",
        "descriptionTemplate": "<string>"
      }
    },
    "createdBy": {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "name": "<string>"
    },
    "updatedBy": {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "name": "<string>"
    },
    "createdAt": "2023-11-07T05:31:56Z",
    "updatedAt": "2023-11-07T05:31:56Z",
    "version": 123,
    "companies": [
      {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "name": "<string>"
      }
    ]
  }
}

Authorizations

Authorization
string
header
required

Use your API key as a Bearer token. API keys can be generated in Settings → Integrations → API Access.

Body

application/json
name
string
required

Rule name (required)

Required string length: 1 - 200
triggerType
enum<string>
required

Trigger type (required)

Available options:
date_threshold,
scheduled,
field_change,
absence
triggerConfig
object
required

Trigger-specific configuration (required)

entityType
enum<string>
required

Entity type (required)

Available options:
device,
company,
compliance,
planner,
user,
goal,
training,
ticket,
meeting
conditions
null[]
required

Condition groups (required)

actions
null[]
required

Actions to execute (required)

description
string

Rule description

Maximum string length: 1000
isActive
boolean
default:false

Whether to activate the rule immediately

priority
integer
default:0

Rule priority (0-100)

Required range: 0 <= x <= 100
scopeType
enum<string>
default:tenant

Rule scope

Available options:
tenant,
company
companyIds
string<uuid>[]

Company IDs for company-scoped rules

aggregationConfig
any | null

Aggregation configuration

Response

Rule created successfully

data
object
required