Rule
Rule object represents arbitrary business rules added to schema objects.
Talk with a Rossum representative about enabling this feature.
Trigger condition
The trigger_condition is a TxScript formula which controls the execution of the list of actions in a rule object.
There are two possible evaluation modes for this condition:
- simple mode: when the condition does not reference any datapoint, or only reference header fields. Example:
len(field.document_id) < 10. - line-item mode: when the condition references a line item datapoint (a column of a multivalue table). Example:
field.item_amount > 100.0.
In line item mode, the condition is evaluated once for each row of the table, which means multiple actions can potentially be executed. In this case, a deduplication mechanism prevents the creation of duplicate messages (show_message action), duplicate blockers (add_automation_blocker action), and identical emails from being sent (send_email action).
Trigger condition must evaluate strictly to "True", truthy values are not enough to trigger the execution of actions. Wrap your condition with bool(your_condition) if necessary.
Rule actions
Object defines rule actions to be executed when trigger condition is met.
| Attribute | Type | Read-only | Description |
|---|---|---|---|
| id | string | no | Rule action ID. Needs to be unique within the Rule's actions. |
| enabled | bool | no | If false the action is disabled (default: true). |
| type | string | no | See the following for the list of possible actions. |
| payload | object | no | See the following for the payload structure for each action. |
| event | object | no | Actions are configured to be executed on a specific event, see trigger events |
Note that just after document import, the initial validation is performed and rules are then executed:
the trigger conditions are first evaluated on the latest anntoation content, and then actions registered on validation
and annotation_imported events are both executed.
Action Show message
Action: show_message
Event: can be triggered on validation event only.
Payload:
| Attribute | Type | Description |
|---|---|---|
| type | string | One of: error, warning, info. |
| content | string | Message content to be displayed. |
| schema_id | Optional[string] | Optional message target field (omit for document scope message). |
Action Add automation blocker
Action: add_automation_blocker
Event: can be triggered on validation event only.
Payload:
| Attribute | Type | Description |
|---|---|---|
| content | string | Automation blocker content to be displayed. |
| schema_id | Optional[string] | Optional automation blocker target field id (omit for document scope automation blocker). |
Note: at most one action of type add_automation_blocker can be set up for one rule object.
Action change status
Action: change_status
Event: can be triggered on annotation_imported event only.
Payload:
| Attribute | Type | Description |
|---|---|---|
| method | string | Possible options: postpone, export, delete, confirm, reject. |
Note: at most one action of type change_status can be set up for one rule object.
Action Change queue
This action moves the annotation to another queue with or without re-extraction of the data (see the reimport flag).
Action: change_queue
Event: Can be configured to trigger on annotation_imported, annotation_confirmed or annotation_exported.
Payload:
| Attribute | Type | Description |
|---|---|---|
| reimport | Optional[bool] | Flag that controls whether the annotation will be reimported during the action execution. |
| queue_id | integer | ID of the target queue. |
Note: at most one action of type change_queue can be set up for one rule object.
Action Add label
Action: add_label
Event: can be triggered on validation event only.
Payload:
| Attribute | Type | Description |
|---|---|---|
| labels | list[url] | URLs of label object to be linked to the processed annotation |
Note: at most one action of type add_label can be set up for one rule object.
Action Remove label
Action: remove_label
Event: can be triggered on validation event only.
Payload:
| Attribute | Type | Description |
|---|---|---|
| labels | list[url] | URLs of label object to be unlinked from the processed annotation |
Note: at most one action of type remove_label can be set up for one rule object.
Action Add / Remove label
Action: add_remove_label
Event: can be triggered on validation event only.
Payload:
| Attribute | Type | Description |
|---|---|---|
| labels | list[url] | URLs of label object to be linked to the processed annotation |
The affected labels are added to the annotation when the condition is satisfied, and removed otherwise.
Note: at most one action of type add_remove_label can be set up for one rule object.
Action Show / hide field
Action: show_hide_field
Event: can be triggered on validation event only.
Payload:
| Attribute | Type | Description |
|---|---|---|
| schema_ids | List[string] | Set hidden attribute of schema fields according to condition. (Please see schema content |
The affected schema field is visible when the condition is satisfied, and is hidden otherwise.
Action Show field
Action: show_field
Event: can be triggered on validation event only.
Payload:
| Attribute | Type | Description |
|---|---|---|
| schema_ids | List[string] | Set hidden attribute of schema fields to False. (Please see schema content |
Note: at most one action of type show_field can be set up for one rule object.
Action Hide field
Action: hide_field
Event: can be triggered on validation event only.
Payload:
| Attribute | Type | Description |
|---|---|---|
| schema_ids | List[string] | Set hidden attribute of schema fields to True. (Please see schema content |
Note: at most one action of type hide_field can be set up for one rule object.
Action Add validation source
Adds rules validation source to a datapoint.
Action: add_validation_source
Event: can be triggered on validation event only.
Payload:
| Attribute | Type | Description |
|---|---|---|
| schema_id | string | Schema ID of the datapoint to add the validation source to (Please see schema content |
Note: at most one action of type add_validation_source can be set up for one rule object.
Action send email
In line item mode of execution, deduplication mechanism will prevent multiple identical emails from being sent, and at most five emails can be sent by a single action.
Action: send_email
Event: Can be configured to trigger on annotation_imported, annotation_confirmed or annotation_exported.
Payload:
If email_template is defined, the rest of the attributes are ignored.
| Attribute | Type | Description | Required |
|---|---|---|---|
| email_template | string | Email template URL. | Yes |
| attach_document | boolean | When true document linked to the annotation will be sent together with the email as an attachment (default False). | No |
If email_template is not defined, then the payload can contain the following attributes:
| Attribute | Type | Description | Required |
|---|---|---|---|
| to | List[string] | List of recipients. | Yes |
| subject | string | Subject of the email. | Yes |
| body | string | Body of the email. | Yes |
| cc | List[string] | List of cc. | No |
| bcc | List[string] | List of bcc. | No |
Action Exclude from training
This action sets training_enabled to false on the annotation, excluding it from being used for AI training.
Action: exclude_from_training
Event: Can be configured to trigger on annotation_confirmed or annotation_exported.
Payload: none.
Note: at most one action of type exclude_from_training can be set up for one rule object.
Rule
Rule object ID.
Rule object URL.
Name of the rule.
Description of the rule.
Default:""If false the rule is disabled.
Default:trueOrganization URL.
List of queues the rule belongs to.
A condition for triggering the rule's actions. This is a formula evaluated by Rossum TxScript. See Trigger Condition for details.
Default:"True"User who created the rule.
Timestamp of the rule creation.
User that last modified the object.
Timestamp of last modification.
List rules
GET api / v1 / rules
List all rules objects.
curl -X GET "https://example.rossum.app/api/v1/rules"{
"pagination": {
"next": null,
"previous": null
},
"results": [
{
"id": 123,
"url": "https://example.rossum.app/api/v1/rules/123",
"name": "rule",
"description": "Flags invoices missing a required purchase order number.",
"enabled": true,
"organization": "string",
"queues": [
"https://example.rossum.app/api/v1/queues/101",
"https://example.rossum.app/api/v1/queues/102"
],
"trigger_condition": "True",
"created_by": "https://example.rossum.app/api/v1/users/9524",
"created_at": "2022-01-01T15:02:25.653324Z",
"modified_by": "https://example.rossum.app/api/v1/users/10775",
"modified_at": "2021-04-26T10:08:03.856648Z",
"actions": [
{
"id": "f3c43f16-b5f1-4ac8-b789-17d4c26463d7",
"enabled": true,
"type": "show_message",
"event": "validation",
"payload": {
"type": "error",
"content": "No vendor found!",
"schema_id": "vendor_id"
}
}
]
}
]
}{
"detail": "Bad Request.",
"code": "bad_request"
}{
"detail": "Invalid token.",
"code": "authentication_failed"
}{
"detail": "Access to the requested resource is forbidden.",
"code": "access_forbidden"
}{
"detail": "Not found.",
"code": "not_found"
}{
"detail": "Conflict.",
"code": "conflict_status"
}{
"detail": "Request was rate limited.",
"code": "rate_limited",
"url": "https://rossum.app/api/docs/openapi/guides/overview/#rate-limiting"
}{
"detail": "Server error.",
"code": "error"
}{
"detail": "Bad Gateway.",
"code": "bad_gateway"
}{
"detail": "Service Unavailable.",
"code": "service_unavailable"
}{
"detail": "Gateway timeout.",
"code": "gateway_timeout"
}Response
OK
Invalid input data.
Detail of the error
Code of the error
The username/password is invalid or token is invalid (e.g. expired).
Detail of the error
Code of the error
Insufficient permission, missing authentication, invalid CSRF token and similar issue.
Detail of the error
Code of the error
The specified resource was not found.
Detail of the error
Code of the error
Conflict
Detail of the error
Code of the error
Request rate is too high, wait before sending more requests. See Rate Limiting for more details.
Detail of the error
Code of the error
Link to the rate limiting documentation
Server failure while processing the request.
Detail of the error
Code of the error
Invalid response from the upstream server.
Detail of the error
Code of the error
We're temporarily offline for maintenance. Please try again later.
Detail of the error
Code of the error
Upstream server could not complete the request in time.
Detail of the error
Code of the error
Create rule
POST api / v1 / rules
Create a new rule object.
curl -X POST "https://example.rossum.app/api/v1/rules" \ -H "Content-Type: application/json" \ -d '{ "name": "rule" }'{
"id": 123,
"url": "https://example.rossum.app/api/v1/rules/123",
"name": "rule",
"description": "Flags invoices missing a required purchase order number.",
"enabled": true,
"organization": "string",
"queues": [
"https://example.rossum.app/api/v1/queues/101",
"https://example.rossum.app/api/v1/queues/102"
],
"trigger_condition": "True",
"created_by": "https://example.rossum.app/api/v1/users/9524",
"created_at": "2022-01-01T15:02:25.653324Z",
"modified_by": "https://example.rossum.app/api/v1/users/10775",
"modified_at": "2021-04-26T10:08:03.856648Z",
"actions": [
{
"id": "f3c43f16-b5f1-4ac8-b789-17d4c26463d7",
"enabled": true,
"type": "show_message",
"event": "validation",
"payload": {
"type": "error",
"content": "No vendor found!",
"schema_id": "vendor_id"
}
}
]
}{
"detail": "Bad Request.",
"code": "bad_request"
}{
"detail": "Invalid token.",
"code": "authentication_failed"
}{
"detail": "Access to the requested resource is forbidden.",
"code": "access_forbidden"
}{
"detail": "Not found.",
"code": "not_found"
}{
"detail": "Conflict.",
"code": "conflict_status"
}{
"detail": "Payload Too Large.",
"code": "payload_too_large"
}{
"detail": "Request was rate limited.",
"code": "rate_limited",
"url": "https://rossum.app/api/docs/openapi/guides/overview/#rate-limiting"
}{
"detail": "Server error.",
"code": "error"
}{
"detail": "Bad Gateway.",
"code": "bad_gateway"
}{
"detail": "Service Unavailable.",
"code": "service_unavailable"
}{
"detail": "Gateway timeout.",
"code": "gateway_timeout"
}Request Body
application/json
Name of the rule.
Description of the rule.
Default:""If false the rule is disabled.
Default:trueOrganization URL.
List of queues the rule belongs to.
A condition for triggering the rule's actions. This is a formula evaluated by Rossum TxScript. See Trigger Condition for details.
Default:"True"User who created the rule.
Timestamp of the rule creation.
Response
Created
Rule object ID.
Rule object URL.
Name of the rule.
Description of the rule.
Default:""If false the rule is disabled.
Default:trueOrganization URL.
List of queues the rule belongs to.
A condition for triggering the rule's actions. This is a formula evaluated by Rossum TxScript. See Trigger Condition for details.
Default:"True"User who created the rule.
Timestamp of the rule creation.
User that last modified the object.
Timestamp of last modification.
Invalid input data.
Detail of the error
Code of the error
The username/password is invalid or token is invalid (e.g. expired).
Detail of the error
Code of the error
Insufficient permission, missing authentication, invalid CSRF token and similar issue.
Detail of the error
Code of the error
The specified resource was not found.
Detail of the error
Code of the error
Conflict
Detail of the error
Code of the error
Payload too large (especially for files uploaded).
Detail of the error
Code of the error
Request rate is too high, wait before sending more requests. See Rate Limiting for more details.
Detail of the error
Code of the error
Link to the rate limiting documentation
Server failure while processing the request.
Detail of the error
Code of the error
Invalid response from the upstream server.
Detail of the error
Code of the error
We're temporarily offline for maintenance. Please try again later.
Detail of the error
Code of the error
Upstream server could not complete the request in time.
Detail of the error
Code of the error
Retrieve rule
GET api / v1 / rules / {ruleID}
Retrieve a rule object.
curl -X GET "https://example.rossum.app/api/v1/rules/0"{
"id": 123,
"url": "https://example.rossum.app/api/v1/rules/123",
"name": "rule",
"description": "Flags invoices missing a required purchase order number.",
"enabled": true,
"organization": "string",
"queues": [
"https://example.rossum.app/api/v1/queues/101",
"https://example.rossum.app/api/v1/queues/102"
],
"trigger_condition": "True",
"created_by": "https://example.rossum.app/api/v1/users/9524",
"created_at": "2022-01-01T15:02:25.653324Z",
"modified_by": "https://example.rossum.app/api/v1/users/10775",
"modified_at": "2021-04-26T10:08:03.856648Z",
"actions": [
{
"id": "f3c43f16-b5f1-4ac8-b789-17d4c26463d7",
"enabled": true,
"type": "show_message",
"event": "validation",
"payload": {
"type": "error",
"content": "No vendor found!",
"schema_id": "vendor_id"
}
}
]
}{
"detail": "Bad Request.",
"code": "bad_request"
}{
"detail": "Invalid token.",
"code": "authentication_failed"
}{
"detail": "Access to the requested resource is forbidden.",
"code": "access_forbidden"
}{
"detail": "Not found.",
"code": "not_found"
}{
"detail": "Conflict.",
"code": "conflict_status"
}{
"detail": "Request was rate limited.",
"code": "rate_limited",
"url": "https://rossum.app/api/docs/openapi/guides/overview/#rate-limiting"
}{
"detail": "Server error.",
"code": "error"
}{
"detail": "Bad Gateway.",
"code": "bad_gateway"
}{
"detail": "Service Unavailable.",
"code": "service_unavailable"
}{
"detail": "Gateway timeout.",
"code": "gateway_timeout"
}Response
OK
Rule object ID.
Rule object URL.
Name of the rule.
Description of the rule.
Default:""If false the rule is disabled.
Default:trueOrganization URL.
List of queues the rule belongs to.
A condition for triggering the rule's actions. This is a formula evaluated by Rossum TxScript. See Trigger Condition for details.
Default:"True"User who created the rule.
Timestamp of the rule creation.
User that last modified the object.
Timestamp of last modification.
Invalid input data.
Detail of the error
Code of the error
The username/password is invalid or token is invalid (e.g. expired).
Detail of the error
Code of the error
Insufficient permission, missing authentication, invalid CSRF token and similar issue.
Detail of the error
Code of the error
The specified resource was not found.
Detail of the error
Code of the error
Conflict
Detail of the error
Code of the error
Request rate is too high, wait before sending more requests. See Rate Limiting for more details.
Detail of the error
Code of the error
Link to the rate limiting documentation
Server failure while processing the request.
Detail of the error
Code of the error
Invalid response from the upstream server.
Detail of the error
Code of the error
We're temporarily offline for maintenance. Please try again later.
Detail of the error
Code of the error
Upstream server could not complete the request in time.
Detail of the error
Code of the error
Partial update rule
PATCH api / v1 / rules / {ruleID}
Update part of rule object.
curl -X PATCH "https://example.rossum.app/api/v1/rules/0" \ -H "Content-Type: application/json" \ -d '{}'{
"id": 123,
"url": "https://example.rossum.app/api/v1/rules/123",
"name": "rule",
"description": "Flags invoices missing a required purchase order number.",
"enabled": true,
"organization": "string",
"queues": [
"https://example.rossum.app/api/v1/queues/101",
"https://example.rossum.app/api/v1/queues/102"
],
"trigger_condition": "True",
"created_by": "https://example.rossum.app/api/v1/users/9524",
"created_at": "2022-01-01T15:02:25.653324Z",
"modified_by": "https://example.rossum.app/api/v1/users/10775",
"modified_at": "2021-04-26T10:08:03.856648Z",
"actions": [
{
"id": "f3c43f16-b5f1-4ac8-b789-17d4c26463d7",
"enabled": true,
"type": "show_message",
"event": "validation",
"payload": {
"type": "error",
"content": "No vendor found!",
"schema_id": "vendor_id"
}
}
]
}{
"detail": "Bad Request.",
"code": "bad_request"
}{
"detail": "Invalid token.",
"code": "authentication_failed"
}{
"detail": "Access to the requested resource is forbidden.",
"code": "access_forbidden"
}{
"detail": "Not found.",
"code": "not_found"
}{
"detail": "Conflict.",
"code": "conflict_status"
}{
"detail": "Payload Too Large.",
"code": "payload_too_large"
}{
"detail": "Request was rate limited.",
"code": "rate_limited",
"url": "https://rossum.app/api/docs/openapi/guides/overview/#rate-limiting"
}{
"detail": "Server error.",
"code": "error"
}{
"detail": "Bad Gateway.",
"code": "bad_gateway"
}{
"detail": "Service Unavailable.",
"code": "service_unavailable"
}{
"detail": "Gateway timeout.",
"code": "gateway_timeout"
}Request Body
application/json
Name of the rule.
Description of the rule.
Default:""If false the rule is disabled.
Default:trueOrganization URL.
List of queues the rule belongs to.
A condition for triggering the rule's actions. This is a formula evaluated by Rossum TxScript. See Trigger Condition for details.
Default:"True"User who created the rule.
Timestamp of the rule creation.
Response
OK
Rule object ID.
Rule object URL.
Name of the rule.
Description of the rule.
Default:""If false the rule is disabled.
Default:trueOrganization URL.
List of queues the rule belongs to.
A condition for triggering the rule's actions. This is a formula evaluated by Rossum TxScript. See Trigger Condition for details.
Default:"True"User who created the rule.
Timestamp of the rule creation.
User that last modified the object.
Timestamp of last modification.
Invalid input data.
Detail of the error
Code of the error
The username/password is invalid or token is invalid (e.g. expired).
Detail of the error
Code of the error
Insufficient permission, missing authentication, invalid CSRF token and similar issue.
Detail of the error
Code of the error
The specified resource was not found.
Detail of the error
Code of the error
Conflict
Detail of the error
Code of the error
Payload too large (especially for files uploaded).
Detail of the error
Code of the error
Request rate is too high, wait before sending more requests. See Rate Limiting for more details.
Detail of the error
Code of the error
Link to the rate limiting documentation
Server failure while processing the request.
Detail of the error
Code of the error
Invalid response from the upstream server.
Detail of the error
Code of the error
We're temporarily offline for maintenance. Please try again later.
Detail of the error
Code of the error
Upstream server could not complete the request in time.
Detail of the error
Code of the error
Delete rule
DELETE api / v1 / rules / {ruleID}
Delete rule object.
curl -X DELETE "https://example.rossum.app/api/v1/rules/0"{
"detail": "Bad Request.",
"code": "bad_request"
}{
"detail": "Invalid token.",
"code": "authentication_failed"
}{
"detail": "Access to the requested resource is forbidden.",
"code": "access_forbidden"
}{
"detail": "Not found.",
"code": "not_found"
}{
"detail": "Conflict.",
"code": "conflict_status"
}{
"detail": "Request was rate limited.",
"code": "rate_limited",
"url": "https://rossum.app/api/docs/openapi/guides/overview/#rate-limiting"
}{
"detail": "Server error.",
"code": "error"
}{
"detail": "Bad Gateway.",
"code": "bad_gateway"
}{
"detail": "Service Unavailable.",
"code": "service_unavailable"
}{
"detail": "Gateway timeout.",
"code": "gateway_timeout"
}Response
No Content
No response body.
Invalid input data.
Detail of the error
Code of the error
The username/password is invalid or token is invalid (e.g. expired).
Detail of the error
Code of the error
Insufficient permission, missing authentication, invalid CSRF token and similar issue.
Detail of the error
Code of the error
The specified resource was not found.
Detail of the error
Code of the error
Conflict
Detail of the error
Code of the error
Request rate is too high, wait before sending more requests. See Rate Limiting for more details.
Detail of the error
Code of the error
Link to the rate limiting documentation
Server failure while processing the request.
Detail of the error
Code of the error
Invalid response from the upstream server.
Detail of the error
Code of the error
We're temporarily offline for maintenance. Please try again later.
Detail of the error
Code of the error
Upstream server could not complete the request in time.
Detail of the error
Code of the error
Update rule
PUT api / v1 / rules / {ruleID}
Update rule object.
curl -X PUT "https://example.rossum.app/api/v1/rules/0" \ -H "Content-Type: application/json" \ -d '{ "name": "rule" }'{
"id": 123,
"url": "https://example.rossum.app/api/v1/rules/123",
"name": "rule",
"description": "Flags invoices missing a required purchase order number.",
"enabled": true,
"organization": "string",
"queues": [
"https://example.rossum.app/api/v1/queues/101",
"https://example.rossum.app/api/v1/queues/102"
],
"trigger_condition": "True",
"created_by": "https://example.rossum.app/api/v1/users/9524",
"created_at": "2022-01-01T15:02:25.653324Z",
"modified_by": "https://example.rossum.app/api/v1/users/10775",
"modified_at": "2021-04-26T10:08:03.856648Z",
"actions": [
{
"id": "f3c43f16-b5f1-4ac8-b789-17d4c26463d7",
"enabled": true,
"type": "show_message",
"event": "validation",
"payload": {
"type": "error",
"content": "No vendor found!",
"schema_id": "vendor_id"
}
}
]
}{
"detail": "Bad Request.",
"code": "bad_request"
}{
"detail": "Invalid token.",
"code": "authentication_failed"
}{
"detail": "Access to the requested resource is forbidden.",
"code": "access_forbidden"
}{
"detail": "Not found.",
"code": "not_found"
}{
"detail": "Conflict.",
"code": "conflict_status"
}{
"detail": "Payload Too Large.",
"code": "payload_too_large"
}{
"detail": "Request was rate limited.",
"code": "rate_limited",
"url": "https://rossum.app/api/docs/openapi/guides/overview/#rate-limiting"
}{
"detail": "Server error.",
"code": "error"
}{
"detail": "Bad Gateway.",
"code": "bad_gateway"
}{
"detail": "Service Unavailable.",
"code": "service_unavailable"
}{
"detail": "Gateway timeout.",
"code": "gateway_timeout"
}Request Body
application/json
Name of the rule.
Description of the rule.
Default:""If false the rule is disabled.
Default:trueOrganization URL.
List of queues the rule belongs to.
A condition for triggering the rule's actions. This is a formula evaluated by Rossum TxScript. See Trigger Condition for details.
Default:"True"User who created the rule.
Timestamp of the rule creation.
Response
OK
Rule object ID.
Rule object URL.
Name of the rule.
Description of the rule.
Default:""If false the rule is disabled.
Default:trueOrganization URL.
List of queues the rule belongs to.
A condition for triggering the rule's actions. This is a formula evaluated by Rossum TxScript. See Trigger Condition for details.
Default:"True"User who created the rule.
Timestamp of the rule creation.
User that last modified the object.
Timestamp of last modification.
Invalid input data.
Detail of the error
Code of the error
The username/password is invalid or token is invalid (e.g. expired).
Detail of the error
Code of the error
Insufficient permission, missing authentication, invalid CSRF token and similar issue.
Detail of the error
Code of the error
The specified resource was not found.
Detail of the error
Code of the error
Conflict
Detail of the error
Code of the error
Payload too large (especially for files uploaded).
Detail of the error
Code of the error
Request rate is too high, wait before sending more requests. See Rate Limiting for more details.
Detail of the error
Code of the error
Link to the rate limiting documentation
Server failure while processing the request.
Detail of the error
Code of the error
Invalid response from the upstream server.
Detail of the error
Code of the error
We're temporarily offline for maintenance. Please try again later.
Detail of the error
Code of the error
Upstream server could not complete the request in time.
Detail of the error
Code of the error