Skip to content

POST   /tickets/automation-rules

Create automation rule

Create a new ticket automation rule

Request Body

{
"name": "string",
"trigger": "string",
"conditions": [
{
"field": "priority",
"operator": "string",
"value": null
}
],
"actions": [
{
"type": "string",
"status": "string",
"priority": "string",
"userId": "string",
"teamId": "string"
}
]
}

Try it out

Loading...

Output:

Responses

Description

Automation rule created successfully

{
"id": "string",
"name": "string",
"description": "string",
"enabled": false,
"trigger": "string",
"conditions": [
{
"field": "priority",
"operator": "string",
"value": null
}
],
"conditionsMatch": "string",
"actions": [
{
"type": "string",
"status": "string",
"priority": "string",
"userId": "string",
"teamId": "string"
}
],
"executionOrder": 0,
"createdBy": "string",
"createdAt": "string",
"updatedAt": "string",
"updatedBy": "string"
}

References

#/components/schemas/RuleCondition

type: object
required:
- field
- operator
- value
properties:
field:
type: string
description: Ticket field to evaluate
example: priority
operator:
type: string
enum:
- equals
- not_equals
- contains
- not_contains
- greater_than
- less_than
- greater_than_or_equal
- less_than_or_equal
- in
- not_in
description: Comparison operator
value:
description: Value to compare against (can be string, number, boolean, or array)

#/components/schemas/RuleAction

type: object
required:
- type
properties:
type:
type: string
enum:
- change_status
- change_priority
- assign_to_user
- assign_to_team
description: Action type
status:
type: string
description: New status (for change_status action)
priority:
type: string
description: New priority (for change_priority action)
userId:
type: string
description: User ID to assign to (for assign_to_user action)
teamId:
type: string
description: Team ID to assign to (for assign_to_team action)

#/components/schemas/AutomationRule

type: object
properties:
id:
type: string
description: Rule ID
name:
type: string
description: Rule name
description:
type: string
nullable: true
description: Rule description
enabled:
type: boolean
description: Whether rule is enabled
trigger:
type: string
enum:
- ticket_created
- ticket_updated
- status_changed
- priority_changed
- assigned
- comment_added
description: Event that triggers the rule
conditions:
type: array
items:
$ref: "#/components/schemas/RuleCondition"
description: Conditions that must be met
conditionsMatch:
type: string
enum:
- all
- any
description: Whether all or any conditions must match
actions:
type: array
items:
$ref: "#/components/schemas/RuleAction"
description: Actions to perform
executionOrder:
type: integer
description: Rule execution order
createdBy:
type: string
description: ID of rule creator
createdAt:
type: string
format: date-time
updatedAt:
type: string
format: date-time
updatedBy:
type: string
nullable: true
description: ID of last updater

Route Source Code

Check out the source code for this route entrypoint here: /tickets/automation-rules/route.ts

Or the swagger.yaml spec this documentation was generated from: /tickets/automation-rules/swagger.yaml