Skip to main content

Bank rule exclusions

An exclusion (bank_rule_exclusion) takes one company out of one workspace rule's reach. It is the workspace scope's safety valve: a rule that suits every company but two need not be duplicated, it is enough to exclude those two.

The rules themselves, their condition vocabulary and their simulation are described on their own page (Bank imputation rules).

Only a workspace rule can be excluded​

A company rule can never be the subject of an exclusion. It already concerns exactly one company, so excluding that company from it would be either a no-op or a contradiction. The attempt is refused with a 422, it is not silently ignored. That is also why a company rule's excluded_company_ids is always empty: the empty array is the true answer there, not a filler.

The company you exclude must belong to the rule's workspace. A company of another workspace and a company that does not exist receive the same answer, so this endpoint cannot be used to probe for a company's existence.

Removing an exclusion puts the workspace rule back in force for that company from the next classification on. Neither adding nor removing one rewrites anything already posted: an exclusion owns neither an accounting entry nor a payment.

The endpoints​

  • GET /api/v1/bank_rules/{bank_rule_id}/exclusions - list a rule's exclusions
  • POST /api/v1/bank_rules/{bank_rule_id}/exclusions - exclude a company from a rule
  • DELETE /api/v1/bank_rule_exclusions/{id} - remove an exclusion

Two path shapes, and that is not an inconsistency. The list and the creation are the rule's collection, so they hang off the rule. The removal is addressed by the exclusion's own id, on a path that carries neither the rule nor the company - it is the workspace_id published on the exclusion that authorizes it. None of the three paths carries a workspace_id: it is derived from the rule for the first two, from the exclusion for the third.

Reads require the read scope, the creation the write scope, the removal the destroy or the write scope. The Idempotency-Key header is accepted and optional on both writes.

An exclusion's fields​

Six fields, all present in every response. There is nothing more to read: the rule is what carries the overview.

FieldWhat it carries
idThe exclusion's id, the one DELETE /api/v1/bank_rule_exclusions/{id} carries
workspace_idThe workspace the exclusion belongs to
bank_rule_idThe workspace rule this company is taken out of
company_idThe company taken out. It belongs to the rule's workspace
created_at, updated_atISO 8601 timestamps

The same set is published on the rule, under excluded_company_ids, and that is often all you need. This resource is for when you need each exclusion's own id in order to remove it.

Excluding a company​

curl -X POST https://app.scribee.tech/api/v1/bank_rules/88/exclusions \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: b3d7e510-2c48-4a9f-8e61-70f4a2c9d183" \
-d '{ "company_id": 34 }'
{
"data": {
"id": 410,
"workspace_id": 12,
"bank_rule_id": 88,
"company_id": 34,
"created_at": "2026-08-21T15:10:00+02:00",
"updated_at": "2026-08-21T15:10:00+02:00"
}
}

company_id is the body's only field, and it is required. A body carrying none is refused with a 422 and the validation_failed code, naming company.

On a company rule, the refusal names the rule and carries the remedy:

{
"error": "unprocessable_entity",
"code": "validation_failed",
"message": "La validation a échoué",
"details": {
"rule": ["est une règle de société : elle ne concerne déjà qu'une seule société et ne peut pas faire l'objet d'une exclusion"]
}
}

A company outside the rule's workspace - or one that exists nowhere - carries a different code, because what is at fault is not the rule but the field's value:

{
"error": "unprocessable_entity",
"code": "invalid_argument",
"message": "La validation a échoué",
"details": {
"company": ["est introuvable dans l'espace de travail de cette règle"]
}
}

A company already excluded from this rule is refused with a 422 and the validation_failed code, naming company: adding the same exclusion twice produces no duplicate.

Listing a rule's exclusions​

curl "https://app.scribee.tech/api/v1/bank_rules/88/exclusions?company_id=34" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
{
"data": [
{
"id": 410,
"workspace_id": 12,
"bank_rule_id": 88,
"company_id": 34,
"created_at": "2026-08-21T15:10:00+02:00",
"updated_at": "2026-08-21T15:10:00+02:00"
}
],
"meta": {
"current_page": 1,
"per_page": 20,
"total_pages": 1,
"total_count": 1
}
}

The list is returned by ascending company_id then ascending id, and the data + meta envelope follows API conventions. Pagination is offset-based, with page and per_page - 20 by default, 100 at most.

company_id is the only filter, it is optional, and it expects an integer. A value that is not an integer matches nothing - a 200 with an empty collection, never a 422. An absent or empty parameter is not a filter: it restricts nothing.

Only the exclusions of companies the banking API is open to are listed. In an accounting firm, the exclusion of a company that no longer subscribes to the Premium offer is left out of the list, as it is out of the rule's excluded_company_ids, even when another company of the firm opens the API to the workspace. Nothing is deleted: the exclusion reappears as soon as the banking API is open to that company again. On a workspace rule, a company_id naming a company of the rule's workspace the banking API is not open to is refused with 403, rather than answered with an empty collection (see below).

The same call on a company rule answers a 200 with an empty collection when the banking API is open to the rule's company, since such a rule can carry no exclusion at all. Otherwise it is refused with 403 (see below).

Removing an exclusion​

curl -X DELETE https://app.scribee.tech/api/v1/bank_rule_exclusions/410 \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
{
"data": {
"id": 410,
"workspace_id": 12,
"bank_rule_id": 88,
"company_id": 34,
"created_at": "2026-08-21T15:10:00+02:00",
"updated_at": "2026-08-21T15:10:00+02:00"
}
}

The response body is the exclusion as it stood when you asked for it to go. From the next classification on, the workspace rule is a candidate again for that company's operations.

A replay is served only while the excluded company holds the banking capability. If you send the Idempotency-Key header, the same key replays the stored 200 instead of answering 404 on an exclusion already removed. Once the banking API is closed to the excluded company, that replay is refused with 403, even while another company of the workspace still opens it: the stored response is not served. The same goes for the 409 idempotency_request_in_progress: once the first call completes, the key replays its response only if the excluded company still holds the capability, and answers 403 otherwise.

The errors​

StatuserrorcodeWhen
400bad_request-A page that is not an integer greater than or equal to 1, or a page beyond the last page of a non-empty collection
403forbidden-Your OAuth client holds no grant on the workspace concerned, the token does not carry the required scope, or the banking API is not open to the company or the workspace the request is decided on (see below)
404not_found-The rule or the exclusion is not reachable by your grants
409-idempotency_key_reuseThe same Idempotency-Key has already been used for a different body or query string
409-idempotency_request_in_progressAn earlier call carrying that key is still in flight
422unprocessable_entityvalidation_failedThe target rule is a company rule, the company is already excluded, or the body carries no company_id
422unprocessable_entityinvalid_argumentThe company_id is not a company of the rule's workspace
413--The request body is over 4 MiB, or its JSON holds more than 500,000 nodes or more than 100,000 objects and arrays, nests them more than 16 levels deep, or holds a key path longer than 128 bytes or a number longer than 128 bytes. Empty-bodied response; nothing was done and the request is not counted in the shared limit - see API conventions
429too_many_requestsrate_limitedYour OAuth application went over the partner API's common limit. Nothing was done; replay the request after the delay in the Retry-After header - see API conventions

A company rule is decided on its company. On a workspace rule, both writes are decided on the excluded company, the list on the company its filter names, otherwise on the workspace. For a company rule, the banking API must be open to the rule's company, the list included. For a workspace rule, POST /api/v1/bank_rules/{bank_rule_id}/exclusions is decided on the company of the company_id sent, DELETE /api/v1/bank_rule_exclusions/{id} on the exclusion's company, and GET /api/v1/bank_rules/{bank_rule_id}/exclusions on the company of the rule's workspace its company_id filter names, or, with no filter or when the filter names no company of that workspace, on the workspace (Who can use the banking API). In an accounting firm, excluding a company that does not subscribe to the Premium offer is therefore refused with 403, and so is removing its exclusion, even when another company of the firm subscribes to that offer and opens the API to the workspace. The same goes for listing the exclusions of the company rule of a company that does not subscribe to that offer, and for filtering the list of a workspace rule on such a company. On a workspace rule, a body without company_id, or whose company_id names no company of the rule's workspace, names no company to decide on: it is decided on the workspace, then refused with 422 if it passes that check. On a company rule, the same body is still decided on the rule's company: once the banking API is closed to that company, it is refused with 403 before the body is validated, even when another company of the firm opens the API to the workspace.

A resource out of reach answers 404, never 403. Reachability is settled before the question of rights: an exclusion in a workspace your grants do not cover and an exclusion that does not exist receive the same answer. That matters all the more on DELETE /api/v1/bank_rule_exclusions/{id}, whose path carries neither the rule nor the company.

API reference​