Skip to main content
GET
/
organization
/
rules
Retrieve all rulesets
curl --request GET \
  --url https://api.getfernand.com/organization/rules \
  --header 'X-API-Key: <api-key>'
[
  {
    "id": 123,
    "name": "Auto-close spam conversations",
    "status": "LIVE",
    "priority": 0,
    "stop": false,
    "trigger_name": "messages.incoming",
    "created": "2025-01-21T10:30:00Z",
    "applied_count": 42,
    "description": "Automatically closes conversations marked as spam",
    "trigger_data": "2 hours",
    "filters": [
      {
        "field": "conversation.status",
        "operator": "equals",
        "value": "OPENED"
      }
    ],
    "actions": [
      {
        "name": "conversation.close",
        "data": {}
      }
    ],
    "last_applied_at": "2025-01-21T15:45:30Z"
  }
]
Returns a list of all rulesets belonging to the authenticated user’s organization, ordered by priority. This endpoint provides a complete overview of all automation rules configured for the organization.

Authorizations

X-API-Key
string
header
required

Authenticate your account by including your secret key in API requests. You can manage your API keys in the Dashboard.

Authentication to the API is performed by using the HTTP Header X-API-Key.

Response

200 - application/json

List of rulesets retrieved successfully.

id
integer<int32>
required

Unique identifier for the ruleset

name
string
required

Name of the ruleset

Maximum string length: 250
Example:

"Auto-close spam conversations"

status
enum<string>
required

Current status of the ruleset

Available options:
PAUSED,
LIVE
Example:

"LIVE"

priority
integer<int16>
required

Priority order for rule execution (lower numbers execute first)

Example:

0

stop
boolean
required

If true, stops processing subsequent rules when this rule matches

Example:

false

trigger_name
string
required

Event that triggers this rule. Accepted triggers:

  • messages.new_conversation
  • messages.incoming
  • messages.response
  • messages.delivery_failure
  • messages.spam
  • messages.note
  • status.closed
  • status.opened
  • status.snoozed
  • status.unsnoozed
  • teammates.assigned
  • teammate.mentioned
  • time.unanswered_by_client
  • time.unanswered_by_team
  • tickets.ticket_done
Maximum string length: 50
Example:

"messages.incoming"

created
string<date-time>
required

Timestamp when the ruleset was created (UTC)

Example:

"2025-01-21T10:30:00Z"

applied_count
integer<int32>
required

Number of times this rule has been successfully applied

Example:

42

description
string | null

Optional description of what the ruleset does

Maximum string length: 500
Example:

"Automatically closes conversations marked as spam"

trigger_data
string | null

Additional data for the trigger (required for certain triggers):

  • For "teammates.assigned" or "teammate.mentioned": "no_one", "anyone", or an Agent ID
  • For "time.*" triggers: duration and period in format "{duration} {period}" (e.g., "2 hours", "3 days")
Maximum string length: 250
Example:

"2 hours"

filters
object[] | null

Array of filter conditions that must be met for the rule to execute. Each filter contains conditions to match against the entity.

Example:
[
{
"field": "conversation.status",
"operator": "equals",
"value": "OPENED"
}
]
actions
object[]

Array of actions to execute when the rule matches. Each action has a name and optional data.

Example:
[
{ "name": "conversation.close", "data": {} }
]
last_applied_at
string<date-time> | null

Timestamp when the rule was last applied (UTC)

Example:

"2025-01-21T15:45:30Z"