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]"
}
}
]
}
}
]
}
}
}
'import requests
url = "https://clarus-api.com/api/automations"
payload = { "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]"
}
}
]
}
}
]
}
} }
headers = {
"Authorization": "Bearer <token>",
"X-Clarus-Subdomain": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'X-Clarus-Subdomain': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
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]'}
}
]
}
}
]
}
}
})
};
fetch('https://clarus-api.com/api/automations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"id": 123,
"type": "automations",
"attributes": {
"resource_name": "goods_out",
"event": "completed",
"enabled": true
}
}
}{
"error": "<string>"
}{
"errors": [
{
"code": 123,
"symbol": "<string>",
"details": "<string>",
"source": "<string>",
"context": {}
}
]
}Automations
Create an automation
Create a new automation rule with its conditions and actions.
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]"
}
}
]
}
}
]
}
}
}
'import requests
url = "https://clarus-api.com/api/automations"
payload = { "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]"
}
}
]
}
}
]
}
} }
headers = {
"Authorization": "Bearer <token>",
"X-Clarus-Subdomain": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'X-Clarus-Subdomain': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
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]'}
}
]
}
}
]
}
}
})
};
fetch('https://clarus-api.com/api/automations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"id": 123,
"type": "automations",
"attributes": {
"resource_name": "goods_out",
"event": "completed",
"enabled": true
}
}
}{
"error": "<string>"
}{
"errors": [
{
"code": 123,
"symbol": "<string>",
"details": "<string>",
"source": "<string>",
"context": {}
}
]
}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
| Field | Required | Description |
|---|---|---|
resource_name | Yes | Triggering resource |
event | Yes | Triggering event (depends on resource_name) |
enabled | Yes | Whether the automation is active |
conditions_changes | Yes | Conditions to add — only type: ADD is valid on create |
actions_changes | Yes | Actions (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 onlyADD is allowed; the update endpoint also accepts UPDATE and DESTROY (which require the existing record id).
Resource Events
| resource_name | events |
|---|---|
goods_out | created, completed, updated, processed, cancelled |
goods_in | completed, created, cancelled, moved_to_part |
goods_out_pick_list | completed, created, cancelled, picked |
invoice | submitted, authorised, paid |
load_drop | dispatched |
stock_balance | updated |
stock | positively_adjusted, negatively_adjusted, placed_on_hold, released_from_hold, received, unreceived, dispatched, undispatched, account_transferred, picked |
putaway_task | completed |
failure_event_log | created |
ftp_file | uploaded |
ftp_import | failed |
daily_schedule / weekly_schedule / monthly_schedule / one_time_schedule | triggered |
Authorizations
OAuth 2.0 authentication. Use the client credentials or authorization code flow to obtain an access token.
The subdomain/tenant name identifying which tenant's data to access. Required for all API requests.
Body
application/json
Show child attributes
Show child attributes
Response
Automation created successfully
Show child attributes
Show child attributes
⌘I

