Top

Bank Rules

Get rules list
GET /bankaccounts/rules
Fetch all the rules created for a specified bank or credit card account ID
Get a rule
GET /bankaccounts/rules/:rule_id
Get details of a specific rule.
Create a rule
POST /bankaccounts/rules
Create a rule and apply it on deposit/withdrawal for bank accounts and on refund/charges for credit card accounts.
Update a rule
PUT /bankaccounts/rules/:rule_id
Make changes to the rule, add or modify it and update.
Delete a rule
DELETE /bankaccounts/rules/:rule_id
Delete a rule from your account and make it no longer applicable on the transactions.

Get rules list

GET  /bankaccounts/rules

Fetch all the rules created for a specified bank or credit card account ID

Parameters

account_id* string Mandatory parameter Account Id for which rules have to be listed.

Sample Response

Status: 200 OK
Content Type: application/json;charset=UTF-8
{
  "code": 0,
  "message": "success",
  "rules": [
    {
      "rule_id": "460000000048005",
      "rule_name": "Minimum Deposit Rule",
      "rule_order": 0,
      "apply_to": "deposits",
      "criteria_type": "and",
      "record_as": "deposit",
      "account_id": "460000000000361",
      "account_name": "Petty Cash",
      "criterion": [
        {
          "criteria_id": "460000000048009",
          "field": "amount",
          "comparator": "greater_than_or_equals",
          "value": 500.00
        }
      ]
    }
  ]
}

Get a rule

GET  /bankaccounts/rules/:rule_id

Get details of a specific rule.

Sample Response

Status: 200 OK
Content Type: application/json;charset=UTF-8
{
  "code": 0,
  "message": "success",
  "rule": {
    "rule_id": "460000000048005",
    "rule_name": "Minimum Deposit Rule",
    "rule_order": 0,
    "apply_to": "deposits",
    "criteria_type": "and",
    "criterion": [
      {
        "criteria_id": "460000000048009",
        "field": "amount",
        "comparator": "greater_than",
        "value": 500.00
      }
    ],
    "record_as": "deposit",
    "account_id": "460000000000361",
    "account_name": "Petty Cash",
    "tax_id": "",
    "customer_id": "46000000000111",
    "customer_name":"Trendz",
    "reference_number": "from_statement"
  }
}

Create a rule

POST  /bankaccounts/rules

Create a rule and apply it on deposit/withdrawal for bank accounts and on refund/charges for credit card accounts.

Request attributes

rule_name* string
[100]
Meaningful name for the rule describing its purpose.
target_account_id* string The account on which the rule has to be applied.
apply_to* string Rule applies to either deposits or withdrawals for bank accounts and to refunds or charges for credit card account.
Allowed Values: withdrawals, deposits, refunds and charges
criteria_type* string Specifies whether all the criteria have to be satisfied or not.
Allowed Values: or and and
field* string Fields on which the conditions are to be applied.
Allowed Values: payee, description, reference_number and amount
comparator* string Comparator for field and its value.
Allowed Values: is, contains, starts_with, is_empty, greater_than, greater_than_or_equals, less_than and less_than_or_equals
value string
[100]
Value for the criteria field.
record_as* string Record transaction based on value specified in apply_to node.
For bank accounts:
If apply_to is deposits:
sales_without_invoices, transfer_fund, interest_income, other_income, expense_refund, deposit.
If apply_to is withdrawals:
expense, transfer_fund, card_payment, owner_drawings.
For credit_card accounts:
If apply_to is refunds:
card_payment, transfer_fund, expense_refund, refund.
If apply_to is charges:
expense, transfer_fund.
Allowed Values: expense, deposit, refund, transfer_fund, card_payment, sales_without_invoices, expense_refund, interest_income, other_income and owner_drawings
account_id string Account which is involved in the rule with the target account.
tax_id string Tax id involved in the transaction.
reference_number string Specifies if Reference number is manual or generated from the statement.
Allowed Values: manual and from_statement
customer_id Long ID of the customer.(applicable for sales_without_invoices,deposit, expense)

Sample Request

{
      "rule_name": "Minimum Deposit Rule",
      "target_account_id": "460000000048001",
      "apply_to": "deposits",
      "criteria_type": "and",
      "criterion": [
        {
          "field": "amount",
          "comparator": "greater_than",
          "value": "500.00"
        }
      ],
      "record_as": "deposit",
      "account_id": "460000000049001",
    "reference_number": "from_statement",
    "customer_id":"46000000000111"
    }

Sample Response

Status: 201 Created
Content Type: application/json;charset=UTF-8
{
      "code": 0,
      "message": "The bank rule has been created.",
      "rule": {
        "rule_id": "460000000048005",
        "rule_name": "Minimum Deposit Rule",
        "rule_order": 0,
        "apply_to": "deposits",
        "criteria_type": "and",
        "criterion": [
          {
            "criteria_id": "460000000048009",
            "field": "amount",
            "comparator": "greater_than",
            "value": 500.00
          }
        ],
        "record_as": "deposit",
        "account_id": "460000000000361",
        "account_name": "Petty Cash",
        "tax_id": "",
      "customer_id": "46000000000111",
      "customer_name":"Trendz",
        "reference_number": "from_statement"
      }
    }

Update a rule

PUT  /bankaccounts/rules/:rule_id

Make changes to the rule, add or modify it and update.

Request attributes

rule_name* string
[100]
Meaningful name for the rule describing its purpose.
target_account_id* string The account on which the rule has to be applied.
apply_to* string Rule applies to either deposits or withdrawals for bank accounts and to refunds or charges for credit card account.
Allowed Values: withdrawals, deposits, refunds and charges
criteria_type* string Specifies whether all the criteria have to be satisfied or not.
Allowed Values: or and and
field* string Fields on which the conditions are to be applied.
Allowed Values: payee, description, reference_number and amount
comparator* string Comparator for field and its value.
Allowed Values: is, contains, starts_with, is_empty, greater_than, greater_than_or_equals, less_than and less_than_or_equals
value string
[100]
Value for the criteria field.
record_as* string Record transaction based on value specified in apply_to node.
For bank accounts:
If apply_to is deposits:
sales_without_invoices, transfer_fund, interest_income, other_income, expense_refund, deposit.
If apply_to is withdrawals:
expense, transfer_fund, card_payment, owner_drawings.
For credit_card accounts:
If apply_to is refunds:
card_payment, transfer_fund, expense_refund, refund.
If apply_to is charges:
expense, transfer_fund.
Allowed Values: expense, deposit, refund, transfer_fund, card_payment, sales_without_invoices, expense_refund, interest_income, other_income and owner_drawings
account_id string Account which is involved in the rule with the target account.
tax_id string Tax id involved in the transaction.
reference_number string Specifies if Reference number is manual or generated from the statement.
Allowed Values: manual and from_statement
customer_id Long ID of the customer.(applicable for sales_without_invoice, deposit, expense)

Sample Request

{
      "rule_name": "Minimum Deposit Rule",
      "target_account_id": "",
      "apply_to": "deposits",
      "criteria_type": "and",
      "criterion": [
        {
          "criteria_id": 460000000048009,
          "field": "amount",
          "comparator": "greater_than_or_equals",
          "value": "1500.00"
        }
      ],
      "record_as": "deposit",
      "account_id": 460000000000361,
    "reference_number": "from_statement",
    "customer_id":"46000000000111"
    }

Sample Response

Status: 200 OK
Content Type: application/json;charset=UTF-8
{
      "code": 0,
      "message": "The bank rule has been updated.",
      "rule": {
        "rule_id": "460000000048005",
        "rule_name": "Minimum Deposit Rule",
        "rule_order": "0",
        "apply_to": "deposits",
        "criteria_type": "and",
        "criterion": [
          {
            "criteria_id": "460000000048009",
            "field": "amount",
            "comparator": "greater_than_or_equals",
            "value": 1500.00
          }
        ],
        "record_as": "deposit",
        "account_id": "460000000000361",
      "account_name": "Petty Cash",
      "customer_id":"46000000000111",
      "customer_name":"Trendz",
      "reference_number": "from_statement"
      }
    }

Delete a rule

DELETE  /bankaccounts/rules/:rule_id

Delete a rule from your account and make it no longer applicable on the transactions.

Sample Response

Status: 200 OK
Content Type: application/json;charset=UTF-8
{
  "code": 0,
  "message": "The rule has been deleted."
}