Skip to content

FISCALISTO / API / REFERENCE

Rules

Open in ChatGPTOpen in ClaudeOpen in Cursor

The object Rule

Fields
  1. Rule

An empresa rule: when something happens (trigger), if its conditions are met, it does its actions. The same as Ajustes › Reglas in the app.

id*string

Object identifier, with its prefix (iss_, inv_, ret_, cus_, prd_, emp_, bat_, brn_, whs_, stm_, adj_, evt_, whe_).

livemode*boolean

true in production (fk_live_ keys), false in test mode (fk_test_). Test objects aren't valid before the SAT.

object*string

What kind of object it is («invoice», «customer»…).

issuer*string

The issuer (iss_…).

name*string

Name.

trigger*string

When it runs.

One of"invoice.received""invoice.issued""invoice.paid""invoice.cancelled""invoice.approved""invoice.rejected""finding.created""payout.submitted""payout.paid""payout.failed""invoice.daily""purchase_order.daily""bank.movement""purchase_order.saved""purchase_order.approved""purchase_order.rejected""purchase_order.sent""purchase_order.confirmed""purchase_order.received_part""purchase_order.received_all""purchase_order.invoiced_all""purchase_order.price_variance""purchase_order.registered""sat.listed""sat.opinion""sat.buzon""sat.certificate"
conditions*

If: what the invoice or order has to meet. Without conditions, it always runs.

actions*array<>

Then: what it does, in this order.

else_actions*array<>

Else: what it does when its conditions don't hold ([]: nothing).

once_per_record*boolean

true: it runs only once per invoice or order.

wait_days*integer

Wait and check again: the days it waits before acting, checking the record again (0: it acts right away).

Range-9007199254740991 <= value <= 9007199254740991
follow_ups*array<>

If it still holds: steps days after it acted (reminders, escalation); if its conditions no longer hold, the remaining ones don't run ([]: none).

stop_after*boolean

true: if it's met, the following rules don't run for that record.

enabled*boolean

false: paused.

position*integer

Its place in the order they run in (1 first).

Range-9007199254740991 <= value <= 9007199254740991
created_at*|

When it was created, ISO 8601 with Mexico City time (-06:00).

updated_at*|

When it last changed, ISO 8601 (-06:00).

Example Rule

{  "id": "rul_OufpKqnrvx9p2Hq8vR4nXk7LmT3wYc9pB6",  "object": "rule",  "livemode": false,  "issuer": "iss_OufpKqnrvx9p",  "name": "Aceros del Norte a Obra Norte",  "trigger": "invoice.received",  "conditions": {    "match": "all",    "conditions": [      {        "field": "supplier",        "operator": "is",        "values": [          "ADN0101019Z3"        ]      }    ],    "groups": []  },  "actions": [    {      "type": "cost_center",      "cost_center": "ccn_OufpKqnrvx9p1"    }  ],  "else_actions": [],  "once_per_record": true,  "wait_days": 0,  "follow_ups": [],  "stop_after": false,  "enabled": true,  "position": 1,  "created_at": "2026-11-20T10:00:00-06:00",  "updated_at": "2026-11-20T10:00:00-06:00"}

The object SupplierGroup

Fields
  1. SupplierGroup

A supplier group (Proveedores › Grupos): each supplier is in one at most, and a rule applies to the whole group with the supplierGroup condition.

id*string

Object identifier, with its prefix (iss_, inv_, ret_, cus_, prd_, emp_, bat_, brn_, whs_, stm_, adj_, evt_, whe_).

livemode*boolean

true in production (fk_live_ keys), false in test mode (fk_test_). Test objects aren't valid before the SAT.

object*string

What kind of object it is («invoice», «customer»…).

issuer*string

The issuer (iss_…).

name*string

Name.

color*string

Color of its label in the app: info, warning, positive, critical or muted.

suppliers*integer

How many suppliers are in the group.

Range-9007199254740991 <= value <= 9007199254740991
created_at*|

When it was created, ISO 8601 with Mexico City time (-06:00).

Example SupplierGroup

{  "id": "sgr_OufpKqnrvx9p1",  "object": "supplier_group",  "livemode": false,  "issuer": "iss_OufpKqnrvx9p",  "name": "Fletes",  "color": "info",  "suppliers": 8,  "created_at": "2026-11-22T09:02:11-06:00"}

The object RuleTest

Fields
  1. RuleTest

What the rule would do with an invoice or order (without changing anything).

object*string

What kind of object it is («invoice», «customer»…).

record*string

The invoice, order or bank movement, in words.

invoice_uuid?|

The tax folio, for an invoice.

purchase_order?integer

The purchase order.

Range-9007199254740991 <= value <= 9007199254740991
bank_movement?string

The bank movement, its id in /v1/accounting/bank_movements: bwd_… a withdrawal, btx_… a deposit.

matches*boolean

Whether its conditions are met.

already_ran*boolean

It already ran on this record and won't again.

conditions*array<>

Each condition with what the record has.

would_do*array<string>

What it would do, in words (nothing changes).

Example RuleTest

{  "object": "rule_test",  "record": "Factura A-120 de ACEROS DEL NORTE",  "invoice_uuid": "5F3B2A10-8C4D-4E6F-9A1B-2C3D4E5F6A7B",  "matches": true,  "already_ran": false,  "conditions": [    {      "condition": "Proveedor es ADN0101019Z3",      "holds": true,      "actual": "ADN0101019Z3"    }  ],  "would_do": [    "poner el centro de costo «Obra Norte»"  ]}

The object RuleRun

Fields
  1. RuleRun

One time the rule ran on an invoice or order.

id*string

Object identifier, with its prefix (iss_, inv_, ret_, cus_, prd_, emp_, bat_, brn_, whs_, stm_, adj_, evt_, whe_).

object*string

What kind of object it is («invoice», «customer»…).

rule*string

The rule (rul_…).

trigger*string

When it runs.

One of"invoice.received""invoice.issued""invoice.paid""invoice.cancelled""invoice.approved""invoice.rejected""finding.created""payout.submitted""payout.paid""payout.failed""invoice.daily""purchase_order.daily""bank.movement""purchase_order.saved""purchase_order.approved""purchase_order.rejected""purchase_order.sent""purchase_order.confirmed""purchase_order.received_part""purchase_order.received_all""purchase_order.invoiced_all""purchase_order.price_variance""purchase_order.registered""sat.listed""sat.opinion""sat.buzon""sat.certificate"
record*string

The invoice, order, bank movement or SAT notice, in words.

record_type*string

What the record is (sat: a SAT notice).

One of"invoice""purchase_order""bank_movement""sat"
outcome*string

done: it made changes; nothing: it was already that way; failed: it couldn't (see error).

One of"done""nothing""failed"
did*array<string>

What it did, in words.

error*|

Why it couldn't, or null.

created_at*string

When it was created, ISO 8601 with Mexico City time (-06:00).

Formatdate-time

Example RuleRun

{  "id": "812",  "object": "rule_run",  "rule": "rul_OufpKqnrvx9p2Hq8vR4nXk7LmT3wYc9pB6",  "trigger": "invoice.received",  "record": "Factura A-120 de ACEROS DEL NORTE",  "record_type": "invoice",  "outcome": "done",  "did": [    "puso el centro de costo «Obra Norte»"  ],  "error": null,  "created_at": "2026-11-20T10:04:00-06:00"}

The object RuleBacktest

Fields
  1. RuleBacktest

What the rule would have done in the last days, counted (nothing changes).

object*string

What kind of object it is («invoice», «customer»…).

rule*string

The rule (rul_…).

days*integer

How many days back it looked.

Range-9007199254740991 <= value <= 9007199254740991
since*string

From which day (YYYY-MM-DD, Mexico time).

records*integer

How many invoices, orders, movements or notices of its trigger it looked at.

Range-9007199254740991 <= value <= 9007199254740991
matches*integer

On how many its conditions would have held.

Range-9007199254740991 <= value <= 9007199254740991
amount*|

What the matching ones add up to, in pesos; null for SAT notices or if none matches.

capped*boolean

true: it looked at the 2,000 most recent and stopped there.

would_do*array<string>

What it would have done with each matching one, in words.

else_would_do*array<string>

What it would have done with the rest («Si no se cumple»), in words.

wait_days*integer

Days it waits and checks again before acting (0: acts right away).

Range-9007199254740991 <= value <= 9007199254740991

Example RuleBacktest

{  "object": "rule_backtest",  "rule": "rul_OufpKqnrvx9p2Hq8vR4nXk7LmT3wYc9pB6",  "days": 90,  "since": "2026-08-24",  "records": 412,  "matches": 37,  "amount": 1284300.5,  "capped": false,  "would_do": [    "poner el centro de costo «Obra Norte»"  ],  "else_would_do": [],  "wait_days": 0}

The object RuleVersion

Fields
  1. RuleVersion

A change to a rule, with the rule as it was left. The last 50 of each rule are kept; a deleted rule's, 90 days.

id*string

Object identifier, with its prefix (iss_, inv_, ret_, cus_, prd_, emp_, bat_, brn_, whs_, stm_, adj_, evt_, whe_).

object*string

What kind of object it is («invoice», «customer»…).

change*string

What changed: created, edited, paused, resumed (turned on), deleted or restored (back to an earlier version).

One of"created""edited""paused""resumed""deleted""restored"
changed_by*|

The member (mem_…) who changed it; null if it was the API or Fiscalisto.

rule*

The rule as it was after this change.

created_at*string

When it was created, ISO 8601 with Mexico City time (-06:00).

Formatdate-time

Example RuleVersion

{  "id": "1204",  "object": "rule_version",  "change": "edited",  "changed_by": "mem_OufpKqnrvx9p3fT0aW9CxR2YhJ8kLmNqP4",  "rule": {    "id": "rul_OufpKqnrvx9p2Hq8vR4nXk7LmT3wYc9pB6",    "object": "rule",    "livemode": false,    "issuer": "iss_OufpKqnrvx9p",    "name": "Aceros del Norte a Obra Norte",    "trigger": "invoice.received",    "conditions": {      "match": "all",      "conditions": [        {          "field": "supplier",          "operator": "is",          "values": [            "ADN0101019Z3"          ]        }      ],      "groups": []    },    "actions": [      {        "type": "cost_center",        "cost_center": "ccn_OufpKqnrvx9p1"      }    ],    "else_actions": [],    "once_per_record": true,    "wait_days": 0,    "follow_ups": [],    "stop_after": false,    "enabled": true,    "position": 1,    "created_at": "2026-11-20T10:00:00-06:00",    "updated_at": "2026-11-20T10:00:00-06:00"  },  "created_at": "2026-11-21T09:30:00-06:00"}

Was this page helpful?