Aller au contenu
Ressource · Accounting

Ledger entries

A ledger entry books an amount to an account of the chart of accounts.

ledger-entries:readledger-entries:write
MéthodeCheminRésumé
GET…/ledger-entriesList ledger entries in the workspace
POST…/ledger-entries/encode-bank-transactionApply a set of cash-coding operations to a bank transaction
POST…/ledger-entries/batch-encode-from-transaction-suggestionsCode one or more bank transactions from their accounting suggestion
POST…/ledger-entries/exportExport ledger entries to a downloadable file
GET…/ledger-entries/pre-exportRun pre-export checks on ledger entries before exporting
POST…/ledger-entries/reorderReorder ledger entries attached to a bank transaction

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

L’objet LedgerEntry

firestoreIdstringobligatoire

ID of the ledger entry.

workspaceIdstringobligatoire

ID of the workspace.

milliAmountnumberobligatoire
creditAccountstring
creditAccountSourcestring

Valeursmanualaibank_accountimportrule

creditBankTransactionobject
Afficher les 3 champs enfants
firestoreIdstringobligatoire

ID of the bank transaction.

bankAccountIdstringobligatoire

ID of the bank account.

orderintegerobligatoire
debitAccountstring
Afficher les 18 champs
debitAccountSourcestring

Valeursmanualaibank_accountimportrule

debitBankTransactionobject
Afficher les 3 champs enfants
firestoreIdstringobligatoire

ID of the bank transaction.

bankAccountIdstringobligatoire

ID of the bank account.

orderintegerobligatoire
taxRatenumber
taxMilliAmountnumber
taxCodestring
taxIdstring
taxAccountstring
taxDirectionstring

Valeurscreditdebit

descriptionstring
datestringobligatoire
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 LedgerEntry
{
  "firestoreId": "Le3wN8qT5xKr1mZv7pBd",
  "workspaceId": "Wk7fQ2xR9bLm4tZp8sNv",
  "milliAmount": 0,
  "creditAccount": "string",
  "creditAccountSource": "manual",
  "creditBankTransaction": {
    "firestoreId": "trx_MjAyNjAzMDJUMDk",
    "bankAccountId": "bacc_Q0gzMTA4NzY1NDM",
    "order": 0
  },
  "debitAccount": "string",
  "debitAccountSource": "manual",
  "debitBankTransaction": {
    "firestoreId": "trx_MjAyNjAzMDJUMDk",
    "bankAccountId": "bacc_Q0gzMTA4NzY1NDM",
    "order": 0
  },
  "taxRate": 0,
  "taxMilliAmount": 0,
  "taxCode": "string",
  "taxId": "string",
  "taxAccount": "string",
  "taxDirection": "credit",
  "description": "string",
  "date": "2026-03-02",
  "creation": {
    "creationDateTime": "2026-03-02T09:15:00.000Z",
    "createdBy": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj"
  }
}
GET/workspaces/{workspaceId}/ledger-entries

List ledger entries in the workspace

Portéeledger-entries: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

dataLedgerEntry[]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/ledger-entries' \
  -H "Authorization: Bearer $SWAY_API_KEY"
{
  "data": [
    {
      "firestoreId": "Le3wN8qT5xKr1mZv7pBd",
      "workspaceId": "Wk7fQ2xR9bLm4tZp8sNv",
      "milliAmount": 0,
      "creditAccount": "string",
      "creditAccountSource": "manual",
      "creditBankTransaction": {
        "firestoreId": "trx_MjAyNjAzMDJUMDk",
        "bankAccountId": "bacc_Q0gzMTA4NzY1NDM",
        "order": 0
      },
      "debitAccount": "string",
      "debitAccountSource": "manual",
      "debitBankTransaction": {
        "firestoreId": "trx_MjAyNjAzMDJUMDk",
        "bankAccountId": "bacc_Q0gzMTA4NzY1NDM",
        "order": 0
      },
      "taxRate": 0,
      "taxMilliAmount": 0,
      "taxCode": "string",
      "taxId": "string",
      "taxAccount": "string",
      "taxDirection": "credit",
      "description": "string",
      "date": "2026-03-02",
      "creation": {
        "creationDateTime": "2026-03-02T09:15:00.000Z",
        "createdBy": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj"
      }
    }
  ],
  "limit": 0,
  "nextCursor": "string"
}
POST/workspaces/{workspaceId}/ledger-entries/encode-bank-transaction

Apply a set of cash-coding operations to a bank transaction

Created ledger entries are appended after the existing ones, in the order they are listed.

Portéeledger-entries: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

bankAccountIdstringobligatoire

ID of the bank account.

bankTransactionIdstringobligatoire

ID of the bank transaction.

operationsobject[]obligatoire
type: create
descriptionstring
taxRatenumber
taxMilliAmountnumber
taxCodestring
taxIdstring
taxAccountstring
signedMilliAmountnumberobligatoire
accountstring
typestringobligatoire

Valeurscreate

type: update
ledgerEntryIdstringobligatoire

ID of the ledger entry.

signedMilliAmountnumber
accountstring | null
descriptionstring | null
taxRatenumber | null
taxMilliAmountnumber | null
taxCodestring | null
taxIdstring | null
taxAccountstring | null
typestringobligatoire

Valeursupdate

type: delete
typestringobligatoire

Valeursdelete

ledgerEntryIdstringobligatoire

ID of the ledger entry.

existingLedgerEntryIdsstring[]

ID of the ledger entry.

Renvoie

200

Successful response

dataCashCodingResultobligatoire
Afficher les 2 champs enfants
entriesobject[]obligatoire
Afficher les 11 champs enfants
descriptionstring
taxRatenumber
taxMilliAmountnumber
taxCodestring
taxIdstring
taxAccountstring
signedMilliAmountnumberobligatoire
accountstring
ledgerEntryIdstringobligatoire

ID of the ledger entry.

orderintegerobligatoire
accountSourcestring

Valeursmanualaibank_accountimportrule

accountingStatusstringobligatoire

Valeurspendingpartially_bookedbooked

curl -X POST 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/ledger-entries/encode-bank-transaction' \
  -H "Authorization: Bearer $SWAY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "bankAccountId": "bacc_Q0gzMTA4NzY1NDM",
  "bankTransactionId": "trx_MjAyNjAzMDJUMDk",
  "operations": [
    {
      "description": "string",
      "taxRate": 0,
      "taxMilliAmount": 0,
      "taxCode": "string",
      "taxId": "string",
      "taxAccount": "string",
      "signedMilliAmount": 0,
      "account": "string",
      "type": "create"
    }
  ],
  "existingLedgerEntryIds": [
    "Le3wN8qT5xKr1mZv7pBd"
  ]
}'
{
  "data": {
    "entries": [
      {
        "description": "string",
        "taxRate": 0,
        "taxMilliAmount": 0,
        "taxCode": "string",
        "taxId": "string",
        "taxAccount": "string",
        "signedMilliAmount": 0,
        "account": "string",
        "ledgerEntryId": "Le3wN8qT5xKr1mZv7pBd",
        "order": 0,
        "accountSource": "manual"
      }
    ],
    "accountingStatus": "pending"
  }
}
POST/workspaces/{workspaceId}/ledger-entries/batch-encode-from-transaction-suggestions

Code one or more bank transactions from their accounting suggestion

Portéeledger-entries: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

bankAccountIdstringobligatoire

ID of the bank account.

bankTransactionsobject[]obligatoire
Afficher les 2 champs enfants
bankTransactionIdstringobligatoire

ID of the bank transaction.

existingLedgerEntryIdsstring[]obligatoire

ID of the ledger entry.

Renvoie

200

Successful response

dataBatchCodingResultobligatoire
Afficher 1 champ enfant
resultsobject[]obligatoire
status: approved
entriesobject[]obligatoire
Afficher les 11 champs enfants
descriptionstring
taxRatenumber
taxMilliAmountnumber
taxCodestring
taxIdstring
taxAccountstring
signedMilliAmountnumberobligatoire
accountstring
ledgerEntryIdstringobligatoire

ID of the ledger entry.

orderintegerobligatoire
accountSourcestring

Valeursmanualaibank_accountimportrule

accountingStatusstringobligatoire

Valeurspendingpartially_bookedbooked

bankTransactionIdstringobligatoire

ID of the bank transaction.

statusstringobligatoire

Valeursapproved

status: skipped
bankTransactionIdstringobligatoire

ID of the bank transaction.

statusstringobligatoire

Valeursskipped

reasonstringobligatoire

Valeursout-of-datecannot-accept-suggestion

status: failed
bankTransactionIdstringobligatoire

ID of the bank transaction.

statusstringobligatoire

Valeursfailed

errorCodestringobligatoire
curl -X POST 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/ledger-entries/batch-encode-from-transaction-suggestions' \
  -H "Authorization: Bearer $SWAY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "bankAccountId": "bacc_Q0gzMTA4NzY1NDM",
  "bankTransactions": [
    {
      "bankTransactionId": "trx_MjAyNjAzMDJUMDk",
      "existingLedgerEntryIds": [
        "Le3wN8qT5xKr1mZv7pBd"
      ]
    }
  ]
}'
{
  "data": {
    "results": [
      {
        "entries": [
          {
            "description": "string",
            "taxRate": 0,
            "taxMilliAmount": 0,
            "taxCode": "string",
            "taxId": "string",
            "taxAccount": "string",
            "signedMilliAmount": 0,
            "account": "string",
            "ledgerEntryId": "Le3wN8qT5xKr1mZv7pBd",
            "order": 0,
            "accountSource": "manual"
          }
        ],
        "accountingStatus": "pending",
        "bankTransactionId": "trx_MjAyNjAzMDJUMDk",
        "status": "approved"
      }
    ]
  }
}
POST/workspaces/{workspaceId}/ledger-entries/export

Export ledger entries to a downloadable file

Portéeledger-entries: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

bankAccountIdstringobligatoire

ID of the bank account.

fromDatestring
toDatestring
bankTransactionIdsstring[]

ID of the bank transaction.

exportTypestringobligatoire

Format of the ledger entry export.

  • tsv_cresus

    Tab-separated file to import into Crésus.

  • csv_winbiz

    CSV file to import into Winbiz.

  • tsv_wineur

    Tab-separated file to import into WinEUR.

  • csv_internal_ledger_entry

    CSV file with one row per ledger entry, with its debit, credit and tax accounts.

  • csv_internal_general_ledger

    CSV file in general ledger layout, with one row per account and separate debit and credit columns.

  • xlsx_abacus

    Excel file to import into Abacus.

configobject
Variante 1
winbizVatSchemestringobligatoire

ValeursCASHVAT_NETNO_VATACCRUAL

winbizSuspenseAccountCodestring
Variante 2
abacusMandantNumbernumber
isWorkspaceFileboolean
generateHeadersboolean
transliterateboolean

Renvoie

200

Successful response

dataLedgerEntryExportobligatoire
Afficher les 4 champs enfants
startedbooleanobligatoire
workspaceIdstringobligatoire
bankAccountIdstringobligatoire
filesobject[]obligatoire
Afficher les 4 champs enfants
exportIdstringobligatoire
targetFileNamestringobligatoire
downloadUrlstringuriobligatoire

Time-limited URL to download the file. The file may not be ready the moment the export call returns: poll this URL and retry while it responds with 404 until the download succeeds.

expiresAtstringobligatoire

Instant after which downloadUrl stops working.

curl -X POST 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/ledger-entries/export' \
  -H "Authorization: Bearer $SWAY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "bankAccountId": "bacc_Q0gzMTA4NzY1NDM",
  "fromDate": "2026-01-01",
  "toDate": "2026-03-31",
  "exportType": "tsv_cresus"
}'
{
  "data": {
    "started": true,
    "workspaceId": "string",
    "bankAccountId": "string",
    "files": [
      {
        "exportId": "string",
        "targetFileName": "string",
        "downloadUrl": "https://example.com",
        "expiresAt": "2026-03-02T09:30:00.000Z"
      }
    ]
  }
}
GET/workspaces/{workspaceId}/ledger-entries/pre-export

Run pre-export checks on ledger entries before exporting

Portéeledger-entries:read

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.

bankAccountIdstringobligatoire

ID of the bank account.

fromDatestring
toDatestring
bankTransactionIdsstring[]

ID of the bank transaction.

Renvoie

200

Successful response

dataLedgerEntryExportCheckobligatoire
Afficher les 5 champs enfants
uncodedBankTransactionIdsstring[]obligatoire
uncodedLedgerEntryIdsPerBankTransactionRecord<string, string[]>obligatoire
imbalancedBankTransactionIdsstring[]obligatoire
bankTransactionCountnumberobligatoire
ledgerEntryCountnumberobligatoire
curl 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/ledger-entries/pre-export?bankAccountId=bacc_Q0gzMTA4NzY1NDM' \
  -H "Authorization: Bearer $SWAY_API_KEY"
{
  "data": {
    "uncodedBankTransactionIds": [
      "string"
    ],
    "uncodedLedgerEntryIdsPerBankTransaction": {
      "key": [
        "string"
      ]
    },
    "imbalancedBankTransactionIds": [
      "string"
    ],
    "bankTransactionCount": 0,
    "ledgerEntryCount": 0
  }
}
POST/workspaces/{workspaceId}/ledger-entries/reorder

Reorder ledger entries attached to a bank transaction

Portéeledger-entries:write

Paramètres de chemin

workspaceIdstringobligatoire

ID of the workspace.

Corps de la requête

ledgerEntryIdstringobligatoire

ID of the ledger entry.

bankTransactionIdstringobligatoire

ID of the bank transaction.

bankAccountIdstringobligatoire

ID of the bank account.

newOrderintegerobligatoire

Renvoie

204

No content

curl -X POST 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/ledger-entries/reorder' \
  -H "Authorization: Bearer $SWAY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "ledgerEntryId": "Le3wN8qT5xKr1mZv7pBd",
  "bankTransactionId": "trx_MjAyNjAzMDJUMDk",
  "bankAccountId": "bacc_Q0gzMTA4NzY1NDM",
  "newOrder": 0
}'
{
  "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.