Skip to main content
POST
/
automation-rules
Create automation rule
curl --request POST \
  --url https://api.fernhq.com/automation-rules \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "Sweep when over 5000 USDC",
  "customerId": "da1f853f-b083-40f3-b729-30c99826e4ed",
  "transactionTemplate": {
    "source": {
      "sourcePaymentAccountId": "072a8b7b-38c7-429a-a6cf-35dae7f2fb77",
      "sourcePaymentMethod": "<any>",
      "sourceCurrency": "USD"
    },
    "destination": {
      "destinationPaymentAccountId": "072a8b7b-38c7-429a-a6cf-35dae7f2fb77",
      "destinationPaymentMethod": "<any>",
      "destinationCurrency": "USD"
    },
    "amount": {
      "type": "FLAT",
      "value": "<string>"
    },
    "developerFee": {
      "developerFeeType": "USD",
      "developerFeeAmount": "5.45"
    }
  },
  "trigger": {
    "type": "THRESHOLD_BASED",
    "cronSchedule": "* * * * *",
    "thresholdAmount": "5000"
  }
}'
{
"id": "rule_ghi789",
"name": "Sweep when over 5000 USDC",
"customerId": "da1f853f-b083-40f3-b729-30c99826e4ed",
"transactionTemplate": {
"source": {
"sourcePaymentAccountId": "072a8b7b-38c7-429a-a6cf-35dae7f2fb77",
"sourcePaymentMethod": "<any>",
"sourceCurrency": {
"label": "USDC",
"chain": "ETHEREUM",
"contractAddress": "0x123456789abcd123456789abcd123456789abcd",
"currencyDecimals": 18
}
},
"destination": {
"destinationPaymentAccountId": "072a8b7b-38c7-429a-a6cf-35dae7f2fb77",
"destinationPaymentMethod": "<any>",
"destinationCurrency": {
"label": "USDC",
"chain": "ETHEREUM",
"contractAddress": "0x123456789abcd123456789abcd123456789abcd",
"currencyDecimals": 18
}
},
"amount": {
"type": "FLAT",
"value": "<string>"
},
"developerFee": {
"developerFeeType": "USD",
"developerFeeAmount": "5.45"
}
},
"trigger": {
"type": "THRESHOLD_BASED",
"cronSchedule": "* * * * *",
"thresholdAmount": "5000"
},
"createdAt": "2025-09-12T12:00:00Z"
}

Authorizations

Authorization
string
header
required

To authenticate server-side requests

Body

application/json

Request schema for creating a new automation rule

name
string
required

Human-readable name for the automation rule

Example:

"Sweep when over 5000 USDC"

customerId
string<uuid>
required

ID of the customer who owns this automation rule

Example:

"da1f853f-b083-40f3-b729-30c99826e4ed"

transactionTemplate
object
required

Template configuration for transactions created by automation rule

trigger
object
required

Response

Configuration for automated transaction execution

id
string
required

Unique identifier for the automation rule

Example:

"rule_ghi789"

name
string
required

Human-readable name for the automation rule

Example:

"Sweep when over 5000 USDC"

customerId
string<uuid>
required

ID of the customer who owns this automation rule

Example:

"da1f853f-b083-40f3-b729-30c99826e4ed"

transactionTemplate
object
required

Template configuration for transactions created by automation rule

trigger
object
required
createdAt
string

ISO timestamp when this automation rule was created

Example:

"2025-09-12T12:00:00Z"