FISCALISTO / API / REFERENCE
Rules
«When something happens, if its conditions are met, then do this»: cost centers, tags, stages and notices that apply themselves to invoices and purchase orders.
Guide to Rules: what each endpoint is for, step by step and with examples.
The object Rule
- 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*stringObject identifier, with its prefix (iss_, inv_, ret_, cus_, prd_, emp_, bat_, brn_, whs_, stm_, adj_, evt_, whe_).
livemode*booleantrue in production (fk_live_ keys), false in test mode (fk_test_). Test objects aren't valid before the SAT.
object*stringWhat kind of object it is («invoice», «customer»…).
issuer*stringThe issuer (iss_…).
name*stringName.
trigger*stringWhen it runs.
"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*booleantrue: it runs only once per invoice or order.
wait_days*integerWait and check again: the days it waits before acting, checking the record again (0: it acts right away).
-9007199254740991 <= value <= 9007199254740991follow_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*booleantrue: if it's met, the following rules don't run for that record.
enabled*booleanfalse: paused.
position*integerIts place in the order they run in (1 first).
-9007199254740991 <= value <= 9007199254740991created_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
- 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*stringObject identifier, with its prefix (iss_, inv_, ret_, cus_, prd_, emp_, bat_, brn_, whs_, stm_, adj_, evt_, whe_).
livemode*booleantrue in production (fk_live_ keys), false in test mode (fk_test_). Test objects aren't valid before the SAT.
object*stringWhat kind of object it is («invoice», «customer»…).
issuer*stringThe issuer (iss_…).
name*stringName.
color*stringColor of its label in the app: info, warning, positive, critical or muted.
suppliers*integerHow many suppliers are in the group.
-9007199254740991 <= value <= 9007199254740991created_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
- RuleTest
What the rule would do with an invoice or order (without changing anything).
object*stringWhat kind of object it is («invoice», «customer»…).
record*stringThe invoice, order or bank movement, in words.
invoice_uuid?|The tax folio, for an invoice.
purchase_order?integerThe purchase order.
-9007199254740991 <= value <= 9007199254740991bank_movement?stringThe bank movement, its id in /v1/accounting/bank_movements: bwd_… a withdrawal, btx_… a deposit.
matches*booleanWhether its conditions are met.
already_ran*booleanIt 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
- RuleRun
One time the rule ran on an invoice or order.
id*stringObject identifier, with its prefix (iss_, inv_, ret_, cus_, prd_, emp_, bat_, brn_, whs_, stm_, adj_, evt_, whe_).
object*stringWhat kind of object it is («invoice», «customer»…).
rule*stringThe rule (rul_…).
trigger*stringWhen it runs.
"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*stringThe invoice, order, bank movement or SAT notice, in words.
record_type*stringWhat the record is (sat: a SAT notice).
"invoice""purchase_order""bank_movement""sat"outcome*stringdone: it made changes; nothing: it was already that way; failed: it couldn't (see error).
"done""nothing""failed"did*array<string>What it did, in words.
error*|Why it couldn't, or null.
created_at*stringWhen it was created, ISO 8601 with Mexico City time (-06:00).
date-timeExample 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
- RuleBacktest
What the rule would have done in the last days, counted (nothing changes).
object*stringWhat kind of object it is («invoice», «customer»…).
rule*stringThe rule (rul_…).
days*integerHow many days back it looked.
-9007199254740991 <= value <= 9007199254740991since*stringFrom which day (YYYY-MM-DD, Mexico time).
records*integerHow many invoices, orders, movements or notices of its trigger it looked at.
-9007199254740991 <= value <= 9007199254740991matches*integerOn how many its conditions would have held.
-9007199254740991 <= value <= 9007199254740991amount*|What the matching ones add up to, in pesos; null for SAT notices or if none matches.
capped*booleantrue: 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*integerDays it waits and checks again before acting (0: acts right away).
-9007199254740991 <= value <= 9007199254740991Example 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
- 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*stringObject identifier, with its prefix (iss_, inv_, ret_, cus_, prd_, emp_, bat_, brn_, whs_, stm_, adj_, evt_, whe_).
object*stringWhat kind of object it is («invoice», «customer»…).
change*stringWhat changed: created, edited, paused, resumed (turned on), deleted or restored (back to an earlier version).
"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*stringWhen it was created, ISO 8601 with Mexico City time (-06:00).
date-timeExample 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?