Skip to main content
POST
/
v1
/
accounting
/
rules
Create accounting rule
curl --request POST \
  --url https://api.hyperline.co/v1/accounting/rules \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "category": "accounting_software",
  "priority": 100,
  "ledger_id": "led_abc123def456",
  "name": "Recurring subscriptions",
  "product_ids": [
    "prod_abc123def456"
  ],
  "product_types": [
    "flat_fee"
  ],
  "customer_ids": [
    "cus_abc123def456"
  ],
  "currencies": [
    "EUR"
  ],
  "countries": [
    "FR"
  ],
  "coupon_ids": [
    "cpn_abc123def456"
  ],
  "client_provider_ids": [
    "clp_abc123def456"
  ],
  "payment_method_types": [
    "card"
  ],
  "interval_period": "month",
  "interval_count": 1,
  "revenue_ledger_account_id": "lac_abc123def456",
  "deferred_revenue_ledger_account_id": "lac_abc123def456",
  "deferred_discount_ledger_account_id": "lac_abc123def456",
  "contra_revenue_ledger_account_id": "lac_abc123def456",
  "discount_ledger_account_id": "lac_abc123def456",
  "ar_ledger_account_id": "lac_abc123def456",
  "cash_ledger_account_id": "lac_abc123def456",
  "payments_clearing_ledger_account_id": "lac_abc123def456",
  "output_tax_ledger_account_id": "lac_abc123def456",
  "bad_debt_expense_ledger_account_id": "lac_abc123def456",
  "customer_credits_ledger_account_id": "lac_abc123def456",
  "journal_id": "jou_abc123def456",
  "entity_type": "invoice"
}
'
{
  "id": "arl_abc123def456",
  "code": "R-001",
  "name": "Recurring subscriptions",
  "ledger_id": "led_abc123def456",
  "category": "accounting_software",
  "priority": 100,
  "product_ids": [
    "prod_abc123def456"
  ],
  "product_types": [
    "flat_fee"
  ],
  "customer_ids": [
    "cus_abc123def456"
  ],
  "currencies": [
    "EUR"
  ],
  "countries": [
    "FR"
  ],
  "coupon_ids": [
    "cpn_abc123def456"
  ],
  "client_provider_ids": [
    "clp_abc123def456"
  ],
  "payment_method_types": [
    "card"
  ],
  "interval_period": "month",
  "interval_count": 1,
  "revenue_ledger_account_id": "lac_abc123def456",
  "deferred_revenue_ledger_account_id": "lac_abc123def456",
  "deferred_discount_ledger_account_id": "lac_abc123def456",
  "contra_revenue_ledger_account_id": "lac_abc123def456",
  "discount_ledger_account_id": "lac_abc123def456",
  "ar_ledger_account_id": "lac_abc123def456",
  "cash_ledger_account_id": "lac_abc123def456",
  "payments_clearing_ledger_account_id": "lac_abc123def456",
  "output_tax_ledger_account_id": "lac_abc123def456",
  "bad_debt_expense_ledger_account_id": "lac_abc123def456",
  "customer_credits_ledger_account_id": "lac_abc123def456",
  "journal_id": "jou_abc123def456",
  "entity_type": "invoice",
  "created_at": "2023-12-25",
  "updated_at": "2023-12-25",
  "revenue_ledger_account": {
    "id": "lac_abc123def456",
    "code": "706100",
    "name": "Revenue",
    "integration": {
      "entity_id": "123456789",
      "provider_name": "stripe",
      "provider_account_id": "acc_1234567890"
    }
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
category
enum<string> | null
required

Rule category (e.g. accounting_software, invoice_posted).

Available options:
invoice_posted,
invoice_settled,
revenue_recognition,
credit_note_created,
accounting_software
Example:

"accounting_software"

priority
number
required

Override order. Higher priority wins when multiple rules match.

Example:

100

ledger_id
string

Identifier of the ledger this rule belongs to.

Example:

"led_abc123def456"

name
string | null

Optional user-defined name for the rule.

Example:

"Recurring subscriptions"

product_ids
string[]

Product IDs to match. Empty means match all.

Example:
["prod_abc123def456"]
product_types
enum<string>[]

Product types to match. Allowed values: flat_fee, dynamic, seat, credit. Empty means match all.

Available options:
flat_fee,
dynamic,
seat,
credit
Example:
["flat_fee"]
customer_ids
string[]

Customer IDs for customer-specific overrides.

Example:
["cus_abc123def456"]
currencies
string[]

Currency codes to match (e.g. EUR, USD).

Example:
["EUR"]
countries
string[]

Country codes for jurisdiction-based overrides.

Example:
["FR"]
coupon_ids
string[]

Coupon IDs to match. Empty means match all.

Example:
["cpn_abc123def456"]
client_provider_ids
string[]

Client provider IDs to match. Empty means match all.

Example:
["clp_abc123def456"]
payment_method_types
string[]

Payment method types to match. Empty means match all.

Example:
["card"]
interval_period
string | null

Billing interval period filter (month, year, etc.).

Example:

"month"

interval_count
number | null

Billing interval count filter.

Example:

1

revenue_ledger_account_id
string | null

Revenue ledger account ID used for invoice line revenue routing.

Example:

"lac_abc123def456"

deferred_revenue_ledger_account_id
string | null

Deferred revenue ledger account ID used before revenue is recognized.

Example:

"lac_abc123def456"

deferred_discount_ledger_account_id
string | null

Deferred discount ledger account ID used before discounts are recognized.

Example:

"lac_abc123def456"

contra_revenue_ledger_account_id
string | null

Contra revenue ledger account ID used for amounts that reduce revenue.

Example:

"lac_abc123def456"

discount_ledger_account_id
string | null

Discount ledger account ID used for recognized discounts.

Example:

"lac_abc123def456"

ar_ledger_account_id
string | null

Accounts receivable ledger account ID used for invoice posting.

Example:

"lac_abc123def456"

cash_ledger_account_id
string | null

Cash ledger account ID used for payment settlement.

Example:

"lac_abc123def456"

payments_clearing_ledger_account_id
string | null

Payments clearing ledger account ID used while payments settle.

Example:

"lac_abc123def456"

output_tax_ledger_account_id
string | null

Output tax ledger account ID used for tax liability.

Example:

"lac_abc123def456"

bad_debt_expense_ledger_account_id
string | null

Bad debt expense ledger account ID used for provider-side write-off routing.

Example:

"lac_abc123def456"

customer_credits_ledger_account_id
string | null

Customer credits ledger account ID used for credit balances.

Example:

"lac_abc123def456"

journal_id
string | null

Journal ID used to route entries in the accounting provider.

Example:

"jou_abc123def456"

entity_type
enum<string> | null

Entity type the rule applies to.

Available options:
invoice,
payment
Example:

"invoice"

Response

201 - application/json
id
string
required

Unique identifier of the accounting rule.

Example:

"arl_abc123def456"

code
string
required

Auto-generated rule code (e.g. R-001).

Example:

"R-001"

name
string | null
required

Optional user-defined name for the rule.

Example:

"Recurring subscriptions"

ledger_id
string
required

Identifier of the ledger this rule belongs to.

Example:

"led_abc123def456"

category
string | null
required

Rule category (e.g. accounting_software, invoice_posted).

Example:

"accounting_software"

priority
number
required

Override order. Higher priority wins when multiple rules match.

Example:

100

product_ids
string[]
required

Product IDs to match. Empty means match all.

Example:
["prod_abc123def456"]
product_types
string[]
required

Product types to match. Allowed values: flat_fee, dynamic, seat, credit. Empty means match all.

Example:
["flat_fee"]
customer_ids
string[]
required

Customer IDs for customer-specific overrides.

Example:
["cus_abc123def456"]
currencies
string[]
required

Currency codes to match (e.g. EUR, USD).

Example:
["EUR"]
countries
string[]
required

Country codes for jurisdiction-based overrides.

Example:
["FR"]
coupon_ids
string[]
required

Coupon IDs to match. Empty means match all.

Example:
["cpn_abc123def456"]
client_provider_ids
string[]
required

Client provider IDs to match. Empty means match all.

Example:
["clp_abc123def456"]
payment_method_types
string[]
required

Payment method types to match. Empty means match all.

Example:
["card"]
interval_period
string | null
required

Billing interval period filter (month, year, etc.).

Example:

"month"

interval_count
number | null
required

Billing interval count filter.

Example:

1

revenue_ledger_account_id
string | null
required

Revenue ledger account ID used for invoice line revenue routing.

Example:

"lac_abc123def456"

deferred_revenue_ledger_account_id
string | null
required

Deferred revenue ledger account ID used before revenue is recognized.

Example:

"lac_abc123def456"

deferred_discount_ledger_account_id
string | null
required

Deferred discount ledger account ID used before discounts are recognized.

Example:

"lac_abc123def456"

contra_revenue_ledger_account_id
string | null
required

Contra revenue ledger account ID used for amounts that reduce revenue.

Example:

"lac_abc123def456"

discount_ledger_account_id
string | null
required

Discount ledger account ID used for recognized discounts.

Example:

"lac_abc123def456"

ar_ledger_account_id
string | null
required

Accounts receivable ledger account ID used for invoice posting.

Example:

"lac_abc123def456"

cash_ledger_account_id
string | null
required

Cash ledger account ID used for payment settlement.

Example:

"lac_abc123def456"

payments_clearing_ledger_account_id
string | null
required

Payments clearing ledger account ID used while payments settle.

Example:

"lac_abc123def456"

output_tax_ledger_account_id
string | null
required

Output tax ledger account ID used for tax liability.

Example:

"lac_abc123def456"

bad_debt_expense_ledger_account_id
string | null
required

Bad debt expense ledger account ID used for provider-side write-off routing.

Example:

"lac_abc123def456"

customer_credits_ledger_account_id
string | null
required

Customer credits ledger account ID used for credit balances.

Example:

"lac_abc123def456"

journal_id
string | null
required

Journal ID used to route entries in the accounting provider.

Example:

"jou_abc123def456"

entity_type
string | null
required

Entity type the rule applies to.

Example:

"invoice"

created_at
string<date>
required

Timestamp when the rule was created.

updated_at
string<date>
required

Timestamp when the rule was last updated.

revenue_ledger_account
object

Expanded revenue ledger account reference when available.