All API resources
Rules
Rules that act on bank transactions when their conditions match.
Base URL https://app.prosaic.works/api/public/v1. Every request needs an API key or access token; see the overview.
List rules
/api/public/v1/rulesSDK: prosaic.rules.list(params)
Returns rules in the workspace associated with the API key. By default returns only active rules.
Query parameters
isActivestringFilter rules by active status.
true(default) returns only active rules,falsereturns only inactive rules,allreturns both.One of:
all,false,trueentityIdstringOnly rules whose scope reaches this entity: workspace-wide rules, rules on the entity's chart template, rules on the entity itself, and rules on any of its bank accounts.
pageintegerDefault:
1pageSizeintegerDefault:
50
Responses
200 Successful response
dataarray of objectsrequiredShow 10 child attributesHide child attributes
idstringrequirednamestringrequireddescriptionstringrequirednullableisActivebooleanrequiredtargetTypestringrequiredcreatedAtstring (date-time)requiredupdatedAtstring (date-time)requiredconditionsarray of objectsrequiredShow 5 child attributesHide child attributes
idstringrequiredfieldstringrequiredoperatorstringrequiredvaluestringrequiredsecondValuestringrequirednullable
actionsarray of objectsrequiredShow 3 child attributesHide child attributes
idstringrequiredactionTypestringrequiredpayloadanyrequired
scopesarray of objectsrequiredShow 5 child attributesHide child attributes
idstringrequiredscopeTypestringrequiredentityobjectrequirednullableShow 2 child attributesHide child attributes
idstringrequirednamestringrequired
bankAccountobjectrequirednullableShow 2 child attributesHide child attributes
idstringrequirednamestringrequired
accountTemplateobjectrequirednullableShow 2 child attributesHide child attributes
idstringrequirednamestringrequired
paginationobjectrequiredShow 6 child attributesHide child attributes
currentPagenumberrequiredpageSizenumberrequiredtotalCountnumberrequiredtotalPagesnumberrequiredhasNextPagebooleanrequiredhasPreviousPagebooleanrequired
400Validation failed401Unauthorized403Insufficient role404Workspace not found, or entityId is not in the workspace500Internal server error
const page = await prosaic.rules.list();curl https://app.prosaic.works/api/public/v1/rules \
-H "Authorization: Bearer $PROSAIC_API_KEY"Get a rule by ID
/api/public/v1/rules/{ruleId}SDK: prosaic.rules.retrieve(ruleId)
Path parameters
ruleIdstringrequired
Responses
200 Successful response
dataobjectrequiredShow 10 child attributesHide child attributes
idstringrequirednamestringrequireddescriptionstringrequirednullableisActivebooleanrequiredtargetTypestringrequiredcreatedAtstring (date-time)requiredupdatedAtstring (date-time)requiredconditionsarray of objectsrequiredShow 5 child attributesHide child attributes
idstringrequiredfieldstringrequiredoperatorstringrequiredvaluestringrequiredsecondValuestringrequirednullable
actionsarray of objectsrequiredShow 3 child attributesHide child attributes
idstringrequiredactionTypestringrequiredpayloadanyrequired
scopesarray of objectsrequiredShow 5 child attributesHide child attributes
idstringrequiredscopeTypestringrequiredentityobjectrequirednullableShow 2 child attributesHide child attributes
idstringrequirednamestringrequired
bankAccountobjectrequirednullableShow 2 child attributesHide child attributes
idstringrequirednamestringrequired
accountTemplateobjectrequirednullableShow 2 child attributesHide child attributes
idstringrequirednamestringrequired
400Invalid rule ID401Unauthorized403Insufficient role404Rule or workspace not found500Internal server error
const { data } = await prosaic.rules.retrieve(ruleId);curl https://app.prosaic.works/api/public/v1/rules/$RULE_ID \
-H "Authorization: Bearer $PROSAIC_API_KEY"Create a rule
/api/public/v1/rulesSDK: prosaic.rules.create(params)
Creates a new rule in the workspace associated with the API key.
Request body
application/json
namestringrequiredconditionsarray of objectsrequiredShow 4 child attributesHide child attributes
fieldstringrequiredOne of:
description,type,date,amount,category,merchantoperatorstringrequiredOne of:
endsWith,startsWith,is,equals,gte,contains,gt,lt,lte,betweenvaluestringrequiredsecondValuestringnullable
actionsarray of objectsrequiredShow 2 child attributesHide child attributes
actionTypestringrequiredOne of:
post_journal,tag_dimensionspayloadanyrequired
scopesarray of objectsrequireddescriptionstringnullableisActivebooleantargetTypestringOne of:
bank_transactionsourcestringOne of:
ai,manual,duplicate,transactions_filters,transactions_reconcile,dimension_proposal,demo_seed
Responses
201 Successful response
dataobjectrequiredShow 10 child attributesHide child attributes
idstringrequirednamestringrequireddescriptionstringrequirednullableisActivebooleanrequiredtargetTypestringrequiredcreatedAtstring (date-time)requiredupdatedAtstring (date-time)requiredconditionsarray of objectsrequiredShow 5 child attributesHide child attributes
idstringrequiredfieldstringrequiredoperatorstringrequiredvaluestringrequiredsecondValuestringrequirednullable
actionsarray of objectsrequiredShow 3 child attributesHide child attributes
idstringrequiredactionTypestringrequiredpayloadanyrequired
scopesarray of objectsrequiredShow 5 child attributesHide child attributes
idstringrequiredscopeTypestringrequiredentityobjectrequirednullableShow 2 child attributesHide child attributes
idstringrequirednamestringrequired
bankAccountobjectrequirednullableShow 2 child attributesHide child attributes
idstringrequirednamestringrequired
accountTemplateobjectrequirednullableShow 2 child attributesHide child attributes
idstringrequirednamestringrequired
400Validation failed. Covers both shape errors (missing/invalid fields) and action-payload semantic errors caught by the request schema (e.g. proportion lines must sum to 1).401Unauthorized403Insufficient role404Workspace not found422Rule failed service-level validation against workspace data (e.g. unknown tax rate codes, account codes not allowed by the action type). Distinct from 400, which is raised by the request schema before the service is called.500Internal server error
const { data } = await prosaic.rules.create({
name: 'Example Ltd',
conditions: [
{
field: 'description',
operator: 'endsWith',
value: 'string',
},
],
actions: [
{
actionType: 'post_journal',
payload: 'string',
},
],
scopes: [
{
scopeType: 'workspace',
},
],
});curl -X POST https://app.prosaic.works/api/public/v1/rules \
-H "Authorization: Bearer $PROSAIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Example Ltd",
"conditions": [
{
"field": "description",
"operator": "endsWith",
"value": "string"
}
],
"actions": [
{
"actionType": "post_journal",
"payload": "string"
}
],
"scopes": [
{
"scopeType": "workspace"
}
]
}'Update a rule
/api/public/v1/rules/{ruleId}SDK: prosaic.rules.update(ruleId, params)
Path parameters
ruleIdstringrequired
Request body
application/json
namestringdescriptionstringnullableisActivebooleanconditionsarray of objectsShow 4 child attributesHide child attributes
fieldstringrequiredOne of:
description,type,date,amount,category,merchantoperatorstringrequiredOne of:
endsWith,startsWith,is,equals,gte,contains,gt,lt,lte,betweenvaluestringrequiredsecondValuestringnullable
targetTypestringOne of:
bank_transactionactionsarray of objectsShow 2 child attributesHide child attributes
actionTypestringrequiredOne of:
post_journal,tag_dimensionspayloadanyrequired
scopesarray of objects
Responses
200 Successful response
dataobjectrequiredShow 10 child attributesHide child attributes
idstringrequirednamestringrequireddescriptionstringrequirednullableisActivebooleanrequiredtargetTypestringrequiredcreatedAtstring (date-time)requiredupdatedAtstring (date-time)requiredconditionsarray of objectsrequiredShow 5 child attributesHide child attributes
idstringrequiredfieldstringrequiredoperatorstringrequiredvaluestringrequiredsecondValuestringrequirednullable
actionsarray of objectsrequiredShow 3 child attributesHide child attributes
idstringrequiredactionTypestringrequiredpayloadanyrequired
scopesarray of objectsrequiredShow 5 child attributesHide child attributes
idstringrequiredscopeTypestringrequiredentityobjectrequirednullableShow 2 child attributesHide child attributes
idstringrequirednamestringrequired
bankAccountobjectrequirednullableShow 2 child attributesHide child attributes
idstringrequirednamestringrequired
accountTemplateobjectrequirednullableShow 2 child attributesHide child attributes
idstringrequirednamestringrequired
400Validation failed. Covers both shape errors (missing/invalid fields) and action-payload semantic errors caught by the request schema (e.g. proportion lines must sum to 1).401Unauthorized403Insufficient role404Rule or workspace not found422Rule failed service-level validation against workspace data (e.g. unknown tax rate codes, account codes not allowed by the action type). Distinct from 400, which is raised by the request schema before the service is called.500Internal server error
const { data } = await prosaic.rules.update(ruleId, {
name: 'Example Ltd',
description: 'Office supplies',
isActive: true,
conditions: [
{
field: 'description',
operator: 'endsWith',
value: 'string',
},
],
targetType: 'bank_transaction',
actions: [
{
actionType: 'post_journal',
payload: 'string',
},
],
scopes: [
{
scopeType: 'workspace',
},
],
});curl -X PATCH https://app.prosaic.works/api/public/v1/rules/$RULE_ID \
-H "Authorization: Bearer $PROSAIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Example Ltd",
"description": "Office supplies",
"isActive": true,
"conditions": [
{
"field": "description",
"operator": "endsWith",
"value": "string"
}
],
"targetType": "bank_transaction",
"actions": [
{
"actionType": "post_journal",
"payload": "string"
}
],
"scopes": [
{
"scopeType": "workspace"
}
]
}'Soft-delete a rule
/api/public/v1/rules/{ruleId}SDK: prosaic.rules.del(ruleId)
Path parameters
ruleIdstringrequired
Responses
200 Successful response
dataobjectrequiredShow 1 child attributeHide child attributes
successbooleanrequiredOne of:
true
400Invalid rule ID401Unauthorized403Insufficient role404Rule or workspace not found500Internal server error
const { data } = await prosaic.rules.del(ruleId);curl -X DELETE https://app.prosaic.works/api/public/v1/rules/$RULE_ID \
-H "Authorization: Bearer $PROSAIC_API_KEY"