The Rule and Rulebook Management APIs enable the creation, updating, retrieval, and management of rules and rulebooks in the Ledger system. These APIs define logic, triggers, and parameters for automating processes, ensuring flexibility and efficiency in managing business workflows.
Rulebook Management
1. Create or Update Rulebook
This allows grouping related rules into a rulebook for streamlined management and execution. For example, a financial institution can create a rulebook for compliance checks and update it with new regulations.
post
Creates a new rulebook.
Body
Agent supplied information about a rulebook.
Responses
200
Response to /api/v1/rulebook/
application/json
Collects together a number of different rules that can be applied to ledger processes.
default
default response to /api/v1/rulebook/
application/json
post
/api/v1/rulebook/
2. Retrieve Rulebook
Retrieve a rulebook to review its structure and rules for auditing or analysis. For instance, a compliance officer can fetch a "Fraud Detection" rulebook to evaluate its triggers and logic.
get
Retrieves an existing rulebook and its included data.
Path parameters
namestringRequired
Query parameters
datastringRequired
Responses
200
Response to /api/v1/rulebook/{name:[^*]+}
application/json
Information about a rulebook in the ledger and the rules it contains.
default
default response to /api/v1/rulebook/{name:[^*]+}
application/json
get
/api/v1/rulebook/{name:[^*]+}
3. List Rulebooks
Provides an overview of all rulebooks for tracking and management. For example, an administrator can list all active rulebooks to monitor their usage and update schedules.
get
Queries the recorded rulebooks.
Query parameters
filterstringOptional
page[size]stringOptional
page[number]stringOptional
sortstringOptional
Responses
200
Response to /api/v1/rulebook/
No content
default
default response to /api/v1/rulebook/
application/json
get
/api/v1/rulebook/
No content
Rule Management
1. Create or Update Rule
Allows adding or updating rules to automate specific processes. For example, a new rule can be added to trigger a reconciliation process when a balance discrepancy is detected.
post
Adds a rule to a rulebook.
Path parameters
rulebookstringRequired
Body
Agent supplied information about a rule.
Responses
200
Response to /api/v1/rulebook/{rulebook:[^*]+}
application/json
A rule that can be executed by the ledger to influence its responses to requests.
default
default response to /api/v1/rulebook/{rulebook:[^*]+}
application/json
post
/api/v1/rulebook/{rulebook:[^*]+}
2. Retrieve Rule
Retrieve rule details to review its triggers, logic, and configuration. For instance, an auditor can fetch a "Transaction Threshold" rule to ensure it aligns with organizational policies.
get
Retrieves a rule and its included scripts
Path parameters
rulebookstringRequired
rulestringRequired
Query parameters
datastringRequired
Responses
200
Response to /api/v1/rulebook/{rulebook:[^]+}/{rule:[^]+}
application/json
Information about a rule on the ledger and the scripts assigned to it.
default
default response to /api/v1/rulebook/{rulebook:[^]+}/{rule:[^]+}
application/json
get
/api/v1/rulebook/{rulebook:[^*]+}/{rule:[^*]+}
3. List Rules
Helps analyze and manage all rules in a rulebook. For example, a compliance manager can view all rules in a "Data Validation" rulebook to check for redundancies.
get
Queries the recorded rules.
Query parameters
filterstringOptional
page[size]stringOptional
page[number]stringOptional
sortstringOptional
Responses
200
Response to /api/v1/rulebook/*/
No content
default
default response to /api/v1/rulebook/*/
application/json
get
/api/v1/rulebook/*/
No content
4. Transition Rule Status
Enables dynamically enabling or disabling rules as needed. For example, deactivate a rule for seasonal discounts after the promotional period ends.
put
Changes the status of a rule (idempotent)
Path parameters
rulebookstringRequired
rulestringRequired
Query parameters
statusstringRequired
Responses
200
Response to /api/v1/rulebook/{rulebook:[^]+}/{rule:[^]+}
application/json
Records information about the transition of an element from one status to another.
addressstringRequired
The address of the element that has transitioned.
current_statusstringRequired
The status of the element current with completion of the transition.
previous_statusstringRequired
The status of the element prior to the transition.
default
default response to /api/v1/rulebook/{rulebook:[^]+}/{rule:[^]+}
application/json
put
/api/v1/rulebook/{rulebook:[^*]+}/{rule:[^*]+}
Example Use Cases
Compliance Automation: Use these APIs to create and manage rules that enforce compliance with financial regulations, such as anti-money laundering checks.
Fraud Detection: Set up and monitor rules that trigger actions when suspicious activities occur, such as large transactions in high-risk regions.
Workflow Management: Organize related rules into rulebooks for easier handling of complex workflows, like automating data validation and reconciliation tasks.