Aller au contenu
Ressource · Accounting

Account coding rules

An account coding rule codes the bank transactions that match its conditions.

account-coding-rules:readaccount-coding-rules:write
MéthodeCheminRésumé
GET…/account-coding-rulesList account coding rules in the workspace
POST…/account-coding-rulesCreate a new account coding rule
PATCH…/account-coding-rules/{ruleId}Update an existing account coding rule
DELETE…/account-coding-rules/{ruleId}Delete an account coding rule
POST…/account-coding-rules/reorderReorder account coding rules to change their evaluation priority
POST…/account-coding-rules/{ruleId}/conditionsAdd a condition to an account coding rule
DELETE…/account-coding-rules/{ruleId}/conditions/{conditionId}Delete a condition from an account coding rule
PATCH…/account-coding-rules/{ruleId}/conditions/{conditionId}Edit a condition on an account coding rule
POST…/account-coding-rules/{ruleId}/actionsAdd an action to an account coding rule
DELETE…/account-coding-rules/{ruleId}/actions/{actionId}Delete an action from an account coding rule
PATCH…/account-coding-rules/{ruleId}/actions/{actionId}Edit an action on an account coding rule

Les chemins commencent par /workspaces/{workspaceId}. Les endpoints GET demandent account-coding-rules:read, les autres account-coding-rules:write.

L’objet AccountCodingRule

firestoreIdstringobligatoire

ID of the account coding rule.

workspaceIdstringobligatoire

ID of the workspace.

namestringobligatoire
descriptionstring
bankAccountIdstring

ID of the bank account.

conditionsOperatorstringobligatoire

ValeursANDOR

conditionsobject[]obligatoire
field: TEXT
idstringobligatoire
fieldstringobligatoire

ValeursTEXT

operatorstringobligatoire

ValeursCONTAINSNOT_CONTAINS

valuestringobligatoire
field: MILLI_AMOUNT
idstringobligatoire
fieldstringobligatoire

ValeursMILLI_AMOUNT

operatorstringobligatoire

ValeursLTGTLTEGTEEQNEQ

valuenumberobligatoire
field: CURRENCY
idstringobligatoire
fieldstringobligatoire

ValeursCURRENCY

operatorstringobligatoire

ValeursEQNEQ

valuestringobligatoire

ISO 4217 currency code

Afficher les 11 champs
actionsobject[]obligatoire
Afficher les 3 champs enfants
idstringobligatoire
typestringobligatoire

ValeursASSIGN_ACCOUNTASSIGN_TAX_TYPESET_ENTRY_DESCRIPTION

valuestringobligatoire
ordernumberobligatoire
creationobjectobligatoire

When and by whom the resource was created.

Afficher les 2 champs enfants
creationDateTimestringdate-timeobligatoire

Date and time when the resource was created.

createdBystring

ID of the user who created the resource, when recorded.

activationobjectobligatoire

Whether the resource is enabled, and when and by whom it was last enabled or disabled.

Afficher les 3 champs enfants
enabledbooleanobligatoire

Whether the resource is enabled.

updateDateTimestringdate-timeobligatoire

Date and time when enabled was last set.

updatedBystring

ID of the user who last set enabled, when recorded.

L’objet AccountCodingRule
{
  "firestoreId": "Ru7bX2kQ9mWp4tLz6nHc",
  "workspaceId": "Wk7fQ2xR9bLm4tZp8sNv",
  "name": "string",
  "description": "string",
  "bankAccountId": "bacc_Q0gzMTA4NzY1NDM",
  "conditionsOperator": "AND",
  "conditions": [
    {
      "id": "string",
      "field": "TEXT",
      "operator": "CONTAINS",
      "value": "string"
    }
  ],
  "actions": [
    {
      "id": "string",
      "type": "ASSIGN_ACCOUNT",
      "value": "string"
    }
  ],
  "order": 0,
  "creation": {
    "creationDateTime": "2026-03-02T09:15:00.000Z",
    "createdBy": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj"
  },
  "activation": {
    "enabled": true,
    "updateDateTime": "2026-03-02T09:15:00.000Z",
    "updatedBy": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj"
  }
}
GET/workspaces/{workspaceId}/account-coding-rules

List account coding rules in the workspace

Portéeaccount-coding-rules:read

Paramètres de chemin

workspaceIdstringobligatoire

ID of the workspace.

Paramètres de requête

limitinteger

Maximum number of items to return, from 1 to 100. A missing, invalid or non-positive value falls back to 20, and a larger value to 100.

Par défaut20

startAfterstring

Cursor of the page to return: the nextCursor of the previous page.

fieldsstring

Comma-separated property paths to include in the response, or in each item of a list. Use dots for nested paths.

idsstring[]

Comma-separated IDs of the items to return, up to 30. When set, limit, startAfter and the filters are ignored.

Renvoie

200

List of items

dataAccountCodingRule[]obligatoire

Items of the page, in list order.

limitintegerobligatoire

Page size of the request, or the number of requested ids.

nextCursorstring

Cursor of the next page, to pass as startAfter. Absent when the page holds fewer items than limit; a full last page still has one, and the page it points to is empty.

curl 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/account-coding-rules' \
  -H "Authorization: Bearer $SWAY_API_KEY"
{
  "data": [
    {
      "firestoreId": "Ru7bX2kQ9mWp4tLz6nHc",
      "workspaceId": "Wk7fQ2xR9bLm4tZp8sNv",
      "name": "string",
      "description": "string",
      "bankAccountId": "bacc_Q0gzMTA4NzY1NDM",
      "conditionsOperator": "AND",
      "conditions": […],
      "actions": […],
      "order": 0,
      "creation": {
        "creationDateTime": "2026-03-02T09:15:00.000Z",
        "createdBy": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj"
      },
      "activation": {
        "enabled": true,
        "updateDateTime": "2026-03-02T09:15:00.000Z",
        "updatedBy": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj"
      }
    }
  ],
  "limit": 0,
  "nextCursor": "string"
}
POST/workspaces/{workspaceId}/account-coding-rules

Create a new account coding rule

Portéeaccount-coding-rules:write

Paramètres de chemin

workspaceIdstringobligatoire

ID of the workspace.

Paramètres de requête

fieldsstring

Comma-separated property paths to include in the response, or in each item of a list. Use dots for nested paths.

Corps de la requête

namestringobligatoire
descriptionstring
bankAccountIdstring

ID of the bank account.

conditionsOperatorstringobligatoire

ValeursANDOR

conditionsobject[]obligatoire
field: TEXT
fieldstringobligatoire

ValeursTEXT

operatorstringobligatoire

ValeursCONTAINSNOT_CONTAINS

valuestringobligatoire
field: MILLI_AMOUNT
fieldstringobligatoire

ValeursMILLI_AMOUNT

operatorstringobligatoire

ValeursLTGTLTEGTEEQNEQ

valuenumberobligatoire
field: CURRENCY
fieldstringobligatoire

ValeursCURRENCY

operatorstringobligatoire

ValeursEQNEQ

valuestringobligatoire

ISO 4217 currency code

actionsobject[]obligatoire
Afficher les 2 champs enfants
typestringobligatoire

ValeursASSIGN_ACCOUNTASSIGN_TAX_TYPESET_ENTRY_DESCRIPTION

valuestringobligatoire
encodeDaysOfHistoricalDatainteger

Renvoie

200

Successful response

dataAccountCodingRuleobligatoire
curl -X POST 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/account-coding-rules' \
  -H "Authorization: Bearer $SWAY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string",
  "description": "string",
  "bankAccountId": "bacc_Q0gzMTA4NzY1NDM",
  "conditionsOperator": "AND",
  "conditions": [
    {
      "field": "TEXT",
      "operator": "CONTAINS",
      "value": "string"
    }
  ],
  "actions": [
    {
      "type": "ASSIGN_ACCOUNT",
      "value": "string"
    }
  ],
  "encodeDaysOfHistoricalData": 0
}'
{
  "data": {
    "firestoreId": "Ru7bX2kQ9mWp4tLz6nHc",
    "workspaceId": "Wk7fQ2xR9bLm4tZp8sNv",
    "name": "string",
    "description": "string",
    "bankAccountId": "bacc_Q0gzMTA4NzY1NDM",
    "conditionsOperator": "AND",
    "conditions": […],
    "actions": […],
    "order": 0,
    "creation": {
      "creationDateTime": "2026-03-02T09:15:00.000Z",
      "createdBy": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj"
    },
    "activation": {
      "enabled": true,
      "updateDateTime": "2026-03-02T09:15:00.000Z",
      "updatedBy": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj"
    }
  }
}
PATCH/workspaces/{workspaceId}/account-coding-rules/{ruleId}

Update an existing account coding rule

Portéeaccount-coding-rules:write

Paramètres de chemin

workspaceIdstringobligatoire

ID of the workspace.

ruleIdstringobligatoire

ID of the account coding rule.

Corps de la requête

namestring
descriptionstring | null
bankAccountIdstring | null

ID of the bank account.

conditionsOperatorstring

ValeursANDOR

activeboolean
encodeDaysOfHistoricalDatainteger

Renvoie

204

No content

curl -X PATCH 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/account-coding-rules/Ru7bX2kQ9mWp4tLz6nHc' \
  -H "Authorization: Bearer $SWAY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "bankAccountId": "bacc_Q0gzMTA4NzY1NDM",
  "conditionsOperator": "AND"
}'
{
  "error": {
    "code": "invalid-argument",
    "message": "Invalid request"
  }
}
DELETE/workspaces/{workspaceId}/account-coding-rules/{ruleId}

Delete an account coding rule

Portéeaccount-coding-rules:write

Paramètres de chemin

workspaceIdstringobligatoire

ID of the workspace.

ruleIdstringobligatoire

ID of the account coding rule.

Renvoie

204

No content

curl -X DELETE 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/account-coding-rules/Ru7bX2kQ9mWp4tLz6nHc' \
  -H "Authorization: Bearer $SWAY_API_KEY"
{
  "error": {
    "code": "invalid-argument",
    "message": "Invalid request"
  }
}
POST/workspaces/{workspaceId}/account-coding-rules/reorder

Reorder account coding rules to change their evaluation priority

Portéeaccount-coding-rules:write

Paramètres de chemin

workspaceIdstringobligatoire

ID of the workspace.

Corps de la requête

ruleIdstringobligatoire

ID of the account coding rule.

newOrderintegerobligatoire

Renvoie

204

No content

curl -X POST 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/account-coding-rules/reorder' \
  -H "Authorization: Bearer $SWAY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "ruleId": "Ru7bX2kQ9mWp4tLz6nHc",
  "newOrder": 0
}'
{
  "error": {
    "code": "invalid-argument",
    "message": "Invalid request"
  }
}
POST/workspaces/{workspaceId}/account-coding-rules/{ruleId}/conditions

Add a condition to an account coding rule

Portéeaccount-coding-rules:write

Paramètres de chemin

workspaceIdstringobligatoire

ID of the workspace.

ruleIdstringobligatoire

ID of the account coding rule.

Corps de la requête

conditionobjectobligatoire
field: TEXT
fieldstringobligatoire

ValeursTEXT

operatorstringobligatoire

ValeursCONTAINSNOT_CONTAINS

valuestringobligatoire
field: MILLI_AMOUNT
fieldstringobligatoire

ValeursMILLI_AMOUNT

operatorstringobligatoire

ValeursLTGTLTEGTEEQNEQ

valuenumberobligatoire
field: CURRENCY
fieldstringobligatoire

ValeursCURRENCY

operatorstringobligatoire

ValeursEQNEQ

valuestringobligatoire

ISO 4217 currency code

Renvoie

204

No content

curl -X POST 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/account-coding-rules/Ru7bX2kQ9mWp4tLz6nHc/conditions' \
  -H "Authorization: Bearer $SWAY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "condition": {
    "field": "TEXT",
    "operator": "CONTAINS",
    "value": "string"
  }
}'
{
  "error": {
    "code": "invalid-argument",
    "message": "Invalid request"
  }
}
DELETE/workspaces/{workspaceId}/account-coding-rules/{ruleId}/conditions/{conditionId}

Delete a condition from an account coding rule

Portéeaccount-coding-rules:write

Paramètres de chemin

workspaceIdstringobligatoire

ID of the workspace.

ruleIdstringobligatoire

ID of the account coding rule.

conditionIdstringobligatoire

ID of the condition in the account coding rule.

Renvoie

204

No content

curl -X DELETE 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/account-coding-rules/Ru7bX2kQ9mWp4tLz6nHc/conditions/k3j9x2m7q1p' \
  -H "Authorization: Bearer $SWAY_API_KEY"
{
  "error": {
    "code": "invalid-argument",
    "message": "Invalid request"
  }
}
PATCH/workspaces/{workspaceId}/account-coding-rules/{ruleId}/conditions/{conditionId}

Edit a condition on an account coding rule

Portéeaccount-coding-rules:write

Paramètres de chemin

workspaceIdstringobligatoire

ID of the workspace.

ruleIdstringobligatoire

ID of the account coding rule.

conditionIdstringobligatoire

ID of the condition in the account coding rule.

Corps de la requête

conditionobjectobligatoire
field: TEXT
fieldstringobligatoire

ValeursTEXT

operatorstringobligatoire

ValeursCONTAINSNOT_CONTAINS

valuestringobligatoire
field: MILLI_AMOUNT
fieldstringobligatoire

ValeursMILLI_AMOUNT

operatorstringobligatoire

ValeursLTGTLTEGTEEQNEQ

valuenumberobligatoire
field: CURRENCY
fieldstringobligatoire

ValeursCURRENCY

operatorstringobligatoire

ValeursEQNEQ

valuestringobligatoire

ISO 4217 currency code

Renvoie

204

No content

curl -X PATCH 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/account-coding-rules/Ru7bX2kQ9mWp4tLz6nHc/conditions/k3j9x2m7q1p' \
  -H "Authorization: Bearer $SWAY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "condition": {
    "field": "TEXT",
    "operator": "CONTAINS",
    "value": "string"
  }
}'
{
  "error": {
    "code": "invalid-argument",
    "message": "Invalid request"
  }
}
POST/workspaces/{workspaceId}/account-coding-rules/{ruleId}/actions

Add an action to an account coding rule

Portéeaccount-coding-rules:write

Paramètres de chemin

workspaceIdstringobligatoire

ID of the workspace.

ruleIdstringobligatoire

ID of the account coding rule.

Corps de la requête

actionobjectobligatoire
Afficher les 2 champs enfants
typestringobligatoire

ValeursASSIGN_ACCOUNTASSIGN_TAX_TYPESET_ENTRY_DESCRIPTION

valuestringobligatoire

Renvoie

204

No content

curl -X POST 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/account-coding-rules/Ru7bX2kQ9mWp4tLz6nHc/actions' \
  -H "Authorization: Bearer $SWAY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "action": {
    "type": "ASSIGN_ACCOUNT",
    "value": "string"
  }
}'
{
  "error": {
    "code": "invalid-argument",
    "message": "Invalid request"
  }
}
DELETE/workspaces/{workspaceId}/account-coding-rules/{ruleId}/actions/{actionId}

Delete an action from an account coding rule

Portéeaccount-coding-rules:write

Paramètres de chemin

workspaceIdstringobligatoire

ID of the workspace.

ruleIdstringobligatoire

ID of the account coding rule.

actionIdstringobligatoire

ID of the action in the account coding rule.

Renvoie

204

No content

curl -X DELETE 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/account-coding-rules/Ru7bX2kQ9mWp4tLz6nHc/actions/w8f4n1c6z5t' \
  -H "Authorization: Bearer $SWAY_API_KEY"
{
  "error": {
    "code": "invalid-argument",
    "message": "Invalid request"
  }
}
PATCH/workspaces/{workspaceId}/account-coding-rules/{ruleId}/actions/{actionId}

Edit an action on an account coding rule

Portéeaccount-coding-rules:write

Paramètres de chemin

workspaceIdstringobligatoire

ID of the workspace.

ruleIdstringobligatoire

ID of the account coding rule.

actionIdstringobligatoire

ID of the action in the account coding rule.

Corps de la requête

actionobjectobligatoire
Afficher les 2 champs enfants
typestringobligatoire

ValeursASSIGN_ACCOUNTASSIGN_TAX_TYPESET_ENTRY_DESCRIPTION

valuestringobligatoire

Renvoie

204

No content

curl -X PATCH 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/account-coding-rules/Ru7bX2kQ9mWp4tLz6nHc/actions/w8f4n1c6z5t' \
  -H "Authorization: Bearer $SWAY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "action": {
    "type": "ASSIGN_ACCOUNT",
    "value": "string"
  }
}'
{
  "error": {
    "code": "invalid-argument",
    "message": "Invalid request"
  }
}

Construisez sur vos propres données.

Créez un compte, ouvrez Profil › Développeur et créez une clé limitée aux ressources dont vous avez besoin. Une question sur une intégration ? L’équipe y répond lors d’un appel.