Skip to main content
POST
/
api
/
automations
Create an automation
curl --request POST \
  --url https://clarus-api.com/api/automations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'X-Clarus-Subdomain: <api-key>' \
  --data '
{
  "data": {
    "type": "automations",
    "attributes": {
      "resource_name": "goods_out",
      "event": "completed",
      "name": "Email on dispatch",
      "enabled": true,
      "conditions_changes": [
        {
          "type": "ADD",
          "attributes": {
            "condition_code": "account_id",
            "source_path": "data.account_id",
            "operator": "eq",
            "value": "42"
          }
        }
      ],
      "actions_changes": [
        {
          "type": "ADD",
          "attributes": {
            "destination_type": "email",
            "destination_code": "default",
            "parameters_changes": [
              {
                "type": "ADD",
                "attributes": {
                  "parameter_code": "email_recipient",
                  "value": "[email protected]"
                }
              }
            ]
          }
        }
      ]
    }
  }
}
'
{
  "data": {
    "id": 123,
    "type": "automations",
    "attributes": {
      "resource_name": "goods_out",
      "event": "completed",
      "enabled": true
    }
  }
}

Request Structure

{
  "data": {
    "type": "automations",
    "attributes": {
      "resource_name": "goods_out",
      "event": "completed",
      "name": "Email on dispatch",
      "enabled": true,
      "conditions_changes": [
        { "type": "ADD", "attributes": { "condition_code": "account_id", "source_path": "data.account_id", "operator": "eq", "value": "42" } }
      ],
      "actions_changes": [
        { "type": "ADD", "attributes": { "destination_type": "email", "destination_code": "default", "parameters_changes": [
          { "type": "ADD", "attributes": { "parameter_code": "email_recipient", "value": "[email protected]" } }
        ] } }
      ]
    }
  }
}

Key Fields

FieldRequiredDescription
resource_nameYesTriggering resource
eventYesTriggering event (depends on resource_name)
enabledYesWhether the automation is active
conditions_changesYesConditions to add — only type: ADD is valid on create
actions_changesYesActions (and parameters) to add — only type: ADD is valid on create

Conditions, Actions & Parameters

Conditions, actions, and action parameters are managed inline through this payload using change objects. On create only ADD is allowed; the update endpoint also accepts UPDATE and DESTROY (which require the existing record id).

Resource Events

resource_nameevents
goods_outcreated, completed, updated, processed, cancelled
goods_incompleted, created, cancelled, moved_to_part
goods_out_pick_listcompleted, created, cancelled, picked
invoicesubmitted, authorised, paid
load_dropdispatched
stock_balanceupdated
stockpositively_adjusted, negatively_adjusted, placed_on_hold, released_from_hold, received, unreceived, dispatched, undispatched, account_transferred, picked
putaway_taskcompleted
failure_event_logcreated
ftp_fileuploaded
ftp_importfailed
daily_schedule / weekly_schedule / monthly_schedule / one_time_scheduletriggered

Authorizations

Authorization
string
header
required

OAuth 2.0 authentication. Use the client credentials or authorization code flow to obtain an access token.

X-Clarus-Subdomain
string
header
required

The subdomain/tenant name identifying which tenant's data to access. Required for all API requests.

Body

application/json
data
object
required

Response

Automation created successfully

data
object