Aller au contenu
Ressource · Accounting

Chart of accounts

A chart of accounts lists the accounts and the account groups of the workspace accounting.

chart-of-accounts:readchart-of-accounts:write
MéthodeCheminRésumé
GET…/chart-of-accountsList charts of accounts in the workspace
POST…/chart-of-accountsCreate a chart of accounts
PATCH…/chart-of-accounts/{chartOfAccountId}Update a chart of accounts
DELETE…/chart-of-accounts/{chartOfAccountId}Delete a chart of accounts
POST…/chart-of-accounts/{chartOfAccountId}/accountsCreate an account inside a chart of accounts
PATCH…/chart-of-accounts/{chartOfAccountId}/accounts/{accountId}Update an account inside a chart of accounts
DELETE…/chart-of-accounts/{chartOfAccountId}/accounts/{accountId}Delete an account from a chart of accounts
POST…/chart-of-accounts/{chartOfAccountId}/groupsCreate an account group inside a chart of accounts
PATCH…/chart-of-accounts/{chartOfAccountId}/groups/{groupId}Update an account group inside a chart of accounts
DELETE…/chart-of-accounts/{chartOfAccountId}/groups/{groupId}Delete an account group from a chart of accounts
POST…/chart-of-accounts/exportExport a chart of accounts to a downloadable file

Les chemins commencent par /workspaces/{workspaceId}. Les endpoints GET demandent chart-of-accounts:read, les autres chart-of-accounts:write.

L’objet ChartOfAccount

firestoreIdstringobligatoire

ID of the chart of accounts.

workspaceIdstringobligatoire

ID of the workspace.

validFromstring
validUntilstring
titlestringobligatoire
groupsobject[]obligatoire
Afficher les 4 champs enfants
idstringobligatoire
namestringobligatoire
descriptionstring
parentIdstring
accountsobject[]obligatoire
Afficher les 8 champs enfants
codestringobligatoire
namestringobligatoire
descriptionstring
groupIdstringobligatoire
taxTypeIdstring

ID of the tax type.

bankAccountIdstring

ID of the bank account.

typestring
Afficher les 18 valeurs

BANKCURRENT_ASSETFIXED_ASSETINVENTORYNON_CURRENT_ASSETPREPAYMENTCURRENT_LIABILITYLIABILITYNON_CURRENT_LIABILITYEQUITYREVENUESALESOTHER_INCOMEDIRECT_COSTOVERHEADEXPENSEDEPRECIATIONSUSPENSE

currencystring

ISO 4217 currency code

Afficher les 8 champs
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.

L’objet ChartOfAccount
{
  "firestoreId": "Ca6yH3kN8pTr1vWx4bQs",
  "workspaceId": "Wk7fQ2xR9bLm4tZp8sNv",
  "validFrom": "string",
  "validUntil": "string",
  "title": "string",
  "groups": [
    {
      "id": "string",
      "name": "string",
      "description": "string",
      "parentId": "string"
    }
  ],
  "accounts": [
    {
      "code": "string",
      "name": "string",
      "description": "string",
      "groupId": "string",
      "taxTypeId": "Tt9mC5rL2wQz7nVb4kHp",
      "bankAccountId": "bacc_Q0gzMTA4NzY1NDM",
      "type": "BANK",
      "currency": "CHF"
    }
  ],
  "creation": {
    "creationDateTime": "2026-03-02T09:15:00.000Z",
    "createdBy": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj"
  }
}
GET/workspaces/{workspaceId}/chart-of-accounts

List charts of accounts in the workspace

Portéechart-of-accounts: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

dataChartOfAccount[]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/chart-of-accounts' \
  -H "Authorization: Bearer $SWAY_API_KEY"
{
  "data": [
    {
      "firestoreId": "Ca6yH3kN8pTr1vWx4bQs",
      "workspaceId": "Wk7fQ2xR9bLm4tZp8sNv",
      "validFrom": "string",
      "validUntil": "string",
      "title": "string",
      "groups": […],
      "accounts": […],
      "creation": {
        "creationDateTime": "2026-03-02T09:15:00.000Z",
        "createdBy": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj"
      }
    }
  ],
  "limit": 0,
  "nextCursor": "string"
}
POST/workspaces/{workspaceId}/chart-of-accounts

Create a chart of accounts

Portéechart-of-accounts: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

titlestringobligatoire
validFromstring
validUntilstring
groupsobject[]obligatoire
Afficher les 4 champs enfants
idstringobligatoire
namestringobligatoire
descriptionstring
parentIdstring
accountsobject[]obligatoire
Afficher les 8 champs enfants
codestringobligatoire
namestringobligatoire
descriptionstring
groupIdstringobligatoire
taxTypeIdstring

ID of the tax type.

bankAccountIdstring

ID of the bank account.

typestring
Afficher les 18 valeurs

BANKCURRENT_ASSETFIXED_ASSETINVENTORYNON_CURRENT_ASSETPREPAYMENTCURRENT_LIABILITYLIABILITYNON_CURRENT_LIABILITYEQUITYREVENUESALESOTHER_INCOMEDIRECT_COSTOVERHEADEXPENSEDEPRECIATIONSUSPENSE

currencystring

ISO 4217 currency code

importedFromFilestring

Renvoie

200

Successful response

dataChartOfAccountobligatoire
curl -X POST 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/chart-of-accounts' \
  -H "Authorization: Bearer $SWAY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "title": "string",
  "validFrom": "string",
  "validUntil": "string",
  "groups": [
    {
      "id": "string",
      "name": "string",
      "description": "string",
      "parentId": "string"
    }
  ],
  "accounts": [
    {
      "code": "string",
      "name": "string",
      "description": "string",
      "groupId": "string",
      "taxTypeId": "Tt9mC5rL2wQz7nVb4kHp",
      "bankAccountId": "bacc_Q0gzMTA4NzY1NDM",
      "type": "BANK",
      "currency": "CHF"
    }
  ],
  "importedFromFile": "string"
}'
{
  "data": {
    "firestoreId": "Ca6yH3kN8pTr1vWx4bQs",
    "workspaceId": "Wk7fQ2xR9bLm4tZp8sNv",
    "validFrom": "string",
    "validUntil": "string",
    "title": "string",
    "groups": […],
    "accounts": […],
    "creation": {
      "creationDateTime": "2026-03-02T09:15:00.000Z",
      "createdBy": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj"
    }
  }
}
PATCH/workspaces/{workspaceId}/chart-of-accounts/{chartOfAccountId}

Update a chart of accounts

Portéechart-of-accounts:write

Paramètres de chemin

workspaceIdstringobligatoire

ID of the workspace.

chartOfAccountIdstringobligatoire

ID of the chart of accounts.

Corps de la requête

titlestring
validFromstring
validUntilstring
groupsobject[]
Afficher les 4 champs enfants
idstringobligatoire
namestringobligatoire
descriptionstring
parentIdstring
accountsobject[]
Afficher les 8 champs enfants
codestringobligatoire
namestringobligatoire
descriptionstring
groupIdstringobligatoire
taxTypeIdstring

ID of the tax type.

bankAccountIdstring

ID of the bank account.

typestring
Afficher les 18 valeurs

BANKCURRENT_ASSETFIXED_ASSETINVENTORYNON_CURRENT_ASSETPREPAYMENTCURRENT_LIABILITYLIABILITYNON_CURRENT_LIABILITYEQUITYREVENUESALESOTHER_INCOMEDIRECT_COSTOVERHEADEXPENSEDEPRECIATIONSUSPENSE

currencystring

ISO 4217 currency code

Renvoie

204

No content

curl -X PATCH 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/chart-of-accounts/Ca6yH3kN8pTr1vWx4bQs' \
  -H "Authorization: Bearer $SWAY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "title": "string",
  "validFrom": "string",
  "validUntil": "string",
  "groups": [
    {
      "id": "string",
      "name": "string",
      "description": "string",
      "parentId": "string"
    }
  ],
  "accounts": [
    {
      "code": "string",
      "name": "string",
      "description": "string",
      "groupId": "string",
      "taxTypeId": "Tt9mC5rL2wQz7nVb4kHp",
      "bankAccountId": "bacc_Q0gzMTA4NzY1NDM",
      "type": "BANK",
      "currency": "CHF"
    }
  ]
}'
{
  "error": {
    "code": "invalid-argument",
    "message": "Invalid request"
  }
}
DELETE/workspaces/{workspaceId}/chart-of-accounts/{chartOfAccountId}

Delete a chart of accounts

Portéechart-of-accounts:write

Paramètres de chemin

workspaceIdstringobligatoire

ID of the workspace.

chartOfAccountIdstringobligatoire

ID of the chart of accounts.

Renvoie

204

No content

curl -X DELETE 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/chart-of-accounts/Ca6yH3kN8pTr1vWx4bQs' \
  -H "Authorization: Bearer $SWAY_API_KEY"
{
  "error": {
    "code": "invalid-argument",
    "message": "Invalid request"
  }
}
POST/workspaces/{workspaceId}/chart-of-accounts/{chartOfAccountId}/accounts

Create an account inside a chart of accounts

Portéechart-of-accounts:write

Paramètres de chemin

workspaceIdstringobligatoire

ID of the workspace.

chartOfAccountIdstringobligatoire

ID of the chart of accounts.

Corps de la requête

accountCodestringobligatoire
namestringobligatoire
descriptionstring
groupIdstringobligatoire
taxTypeIdstring

ID of the tax type.

bankAccountIdstring

ID of the bank account.

typestring
Afficher les 18 valeurs

BANKCURRENT_ASSETFIXED_ASSETINVENTORYNON_CURRENT_ASSETPREPAYMENTCURRENT_LIABILITYLIABILITYNON_CURRENT_LIABILITYEQUITYREVENUESALESOTHER_INCOMEDIRECT_COSTOVERHEADEXPENSEDEPRECIATIONSUSPENSE

currencystring

ISO 4217 currency code

Renvoie

204

No content

curl -X POST 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/chart-of-accounts/Ca6yH3kN8pTr1vWx4bQs/accounts' \
  -H "Authorization: Bearer $SWAY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "accountCode": "string",
  "name": "string",
  "description": "string",
  "groupId": "string",
  "taxTypeId": "Tt9mC5rL2wQz7nVb4kHp",
  "bankAccountId": "bacc_Q0gzMTA4NzY1NDM",
  "type": "BANK",
  "currency": "CHF"
}'
{
  "error": {
    "code": "invalid-argument",
    "message": "Invalid request"
  }
}
PATCH/workspaces/{workspaceId}/chart-of-accounts/{chartOfAccountId}/accounts/{accountId}

Update an account inside a chart of accounts

Portéechart-of-accounts:write

Paramètres de chemin

workspaceIdstringobligatoire

ID of the workspace.

chartOfAccountIdstringobligatoire

ID of the chart of accounts.

accountIdstringobligatoire

Code of the account in the chart of accounts.

Corps de la requête

newAccountCodestring
namestring
descriptionstring | null
groupIdstring
taxTypeIdstring | null

ID of the tax type.

bankAccountIdstring | null

ID of the bank account.

typestring | null
Afficher les 18 valeurs

BANKCURRENT_ASSETFIXED_ASSETINVENTORYNON_CURRENT_ASSETPREPAYMENTCURRENT_LIABILITYLIABILITYNON_CURRENT_LIABILITYEQUITYREVENUESALESOTHER_INCOMEDIRECT_COSTOVERHEADEXPENSEDEPRECIATIONSUSPENSE

currencystring | null

ISO 4217 currency code

Renvoie

204

No content

curl -X PATCH 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/chart-of-accounts/Ca6yH3kN8pTr1vWx4bQs/accounts/1020' \
  -H "Authorization: Bearer $SWAY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "taxTypeId": "Tt9mC5rL2wQz7nVb4kHp",
  "bankAccountId": "bacc_Q0gzMTA4NzY1NDM",
  "type": "BANK",
  "currency": "CHF"
}'
{
  "error": {
    "code": "invalid-argument",
    "message": "Invalid request"
  }
}
DELETE/workspaces/{workspaceId}/chart-of-accounts/{chartOfAccountId}/accounts/{accountId}

Delete an account from a chart of accounts

Portéechart-of-accounts:write

Paramètres de chemin

workspaceIdstringobligatoire

ID of the workspace.

chartOfAccountIdstringobligatoire

ID of the chart of accounts.

accountIdstringobligatoire

Code of the account in the chart of accounts.

Renvoie

204

No content

curl -X DELETE 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/chart-of-accounts/Ca6yH3kN8pTr1vWx4bQs/accounts/1020' \
  -H "Authorization: Bearer $SWAY_API_KEY"
{
  "error": {
    "code": "invalid-argument",
    "message": "Invalid request"
  }
}
POST/workspaces/{workspaceId}/chart-of-accounts/{chartOfAccountId}/groups

Create an account group inside a chart of accounts

Portéechart-of-accounts:write

Paramètres de chemin

workspaceIdstringobligatoire

ID of the workspace.

chartOfAccountIdstringobligatoire

ID of the chart of accounts.

Corps de la requête

groupIdstringobligatoire
namestringobligatoire
descriptionstring
parentIdstring

Renvoie

204

No content

curl -X POST 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/chart-of-accounts/Ca6yH3kN8pTr1vWx4bQs/groups' \
  -H "Authorization: Bearer $SWAY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "groupId": "string",
  "name": "string",
  "description": "string",
  "parentId": "string"
}'
{
  "error": {
    "code": "invalid-argument",
    "message": "Invalid request"
  }
}
PATCH/workspaces/{workspaceId}/chart-of-accounts/{chartOfAccountId}/groups/{groupId}

Update an account group inside a chart of accounts

Portéechart-of-accounts:write

Paramètres de chemin

workspaceIdstringobligatoire

ID of the workspace.

chartOfAccountIdstringobligatoire

ID of the chart of accounts.

groupIdstringobligatoire

ID of the account group in the chart of accounts.

Corps de la requête

newGroupIdstring
namestring
descriptionstring | null
parentIdstring | null

Renvoie

204

No content

curl -X PATCH 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/chart-of-accounts/Ca6yH3kN8pTr1vWx4bQs/groups/10' \
  -H "Authorization: Bearer $SWAY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "newGroupId": "string",
  "name": "string",
  "description": "string",
  "parentId": "string"
}'
{
  "error": {
    "code": "invalid-argument",
    "message": "Invalid request"
  }
}
DELETE/workspaces/{workspaceId}/chart-of-accounts/{chartOfAccountId}/groups/{groupId}

Delete an account group from a chart of accounts

Portéechart-of-accounts:write

Paramètres de chemin

workspaceIdstringobligatoire

ID of the workspace.

chartOfAccountIdstringobligatoire

ID of the chart of accounts.

groupIdstringobligatoire

ID of the account group in the chart of accounts.

Renvoie

204

No content

curl -X DELETE 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/chart-of-accounts/Ca6yH3kN8pTr1vWx4bQs/groups/10' \
  -H "Authorization: Bearer $SWAY_API_KEY"
{
  "error": {
    "code": "invalid-argument",
    "message": "Invalid request"
  }
}
POST/workspaces/{workspaceId}/chart-of-accounts/export

Export a chart of accounts to a downloadable file

Portéechart-of-accounts: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.

Renvoie

200

Successful response

dataExportedFile[]obligatoire
Afficher les 7 champs enfants
successbooleanobligatoire

Whether the file was produced; a failed file has no content.

fromDatestring

First day of the period the file covers.

toDatestring

Last day of the period the file covers, included.

mimeTypestring

Media type of the file.

namestring

Name of the file.

contentstring

Content of the file, as text.

encodingstring

Character encoding of the file, when it is not UTF-8.

curl -X POST 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/chart-of-accounts/export' \
  -H "Authorization: Bearer $SWAY_API_KEY"
{
  "data": [
    {
      "success": true,
      "fromDate": "2026-03-02",
      "toDate": "2026-03-02",
      "mimeType": "text/csv",
      "name": "string",
      "content": "string",
      "encoding": "win1252"
    }
  ]
}

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.