Overview
Automation Rules enable you to automate fund movements without manual intervention. Instead of initiating each transaction manually, you can define rules that automatically convert and transfer funds based on triggers you configure. Automation Rules are particularly useful for:- Scheduled transfers: Set up recurring transactions (daily, weekly, monthly) to automatically move funds on a schedule. Perfect for regular cash-outs or treasury management.
- Threshold-based sweeps: Automatically trigger transactions when an account balance reaches a specified amount. Ideal for maintaining optimal wallet balances or automated offramping.
Prerequisites
Before creating automation rules, you must have:- Created a customer: Use the Customers API to create either an individual or business customer. The customer does not need to be
ACTIVE(verified) to set up automation rules. - Created payment accounts: Set up both source and destination payment accounts via the Payment Accounts API. You’ll need:
- A source payment account (where funds come from) - this must be a Fern crypto wallet
- A destination payment account (where funds go to) - this can be an external bank account, Fern crypto wallet, or external crypto wallet
- Payment account IDs: Have the
paymentAccountIdvalues ready for both your source and destination accounts. You’ll need these when creating the automation rule.
- Create Fern wallets for crypto wallets
Create an automation rule
Create an automation rule using the Automation Rules API. You’ll need to specify:name: A descriptive name for your rulecustomerId: The customer who owns this automation ruletransactionTemplate: Configuration for the transactions this rule will createtrigger: Conditions that will execute this rule
List automation rules
Retrieve all automation rules for a customer or filter by source payment account. Sample request:Get a specific automation rule
Retrieve details about a specific automation rule by its ID using the Automation Rules APIGET endpoint.
Sample request:
Update an automation rule
Modify an existing automation rule to change its configuration. You must provide the complete rule configuration in the update request. Only the destination parameters, developer fee and amount fields can be updated. Sample request:Delete an automation rule
Remove an automation rule when it’s no longer needed using theDELETE endpoint.
Sample request:
Understanding automation rule components
Transaction template
The transaction template defines what transaction will be executed when the rule triggers. It includes:- Source: The payment account and currency funds will come from
- Destination: The payment account and currency funds will go to
- Amount: How much to transfer (flat amount or percentage of balance)
- Developer fee (optional): Additional fees you want to charge
Amount types
FLAT: Transfer a specific fixed amountTrigger types
THRESHOLD_BASED: Executes when the source account balance reaches or exceeds the specified amount0 0 * * *- Daily at midnight UTC0 0 * * 1- Every Monday at midnight UTC0 12 * * *- Daily at noon UTC0 0 1 * *- First day of every month at midnight UTC0 9 * * 1-5- Weekdays at 9 AM UTC*/15 * * * *- Every 15 minutes
Developer fees
You can optionally charge additional fees on top of Fern’s standard fees. ThedeveloperFee object should be of the following form using the SOURCE_CURRENCY type:
SOURCE_CURRENCY: Charge a fee in the source currency
Best practices
- Start with clear naming conventions: Use descriptive names that indicate the purpose, frequency, or trigger condition of each rule. This makes management easier as you scale.
- Consider time zones: Cron schedules use UTC time. Factor this in when setting up time-based rules to match your business operations.
- Plan for currency conversion: Remember that transactions may involve currency conversion with associated fees. Review the exchange rates and fees using the Exchange Rates API before setting up rules.