askledgerDocs
REST-APIAuditfiles
Documentatie

Complete an auditfile upload

POST
/administrations/{administrationId}/auditfiles/{auditfileId}/complete

Checks the uploaded file and queues the import. The file must be a readable XAF 3.2 or 4.0 file of at most 2 GB, and the KvK number in its header must match the administration's in LedgerSuite: a mismatch answers 422 kvk_mismatch. Without a KvK number on either side the file is accepted with a warning in issues.

The import runs in the background: poll the auditfile or the administration's source until status is processed or failed. A new file replaces the entries of the period it covers; relations, ledger accounts, journals and VAT codes are updated. The opening balance counts only when no earlier period was uploaded. Entries that do not balance reject the file (validation_failed); the previous data then stays.

Calling complete again for a queued or processed upload returns it unchanged.

Other LedgerSuite products call this with their own client_credentials token with scope askledger:auditfile, for administrations that include them. An AskLedger admin of the administration (company group owner or admin, or AskLedger role admin) can call it signed in to AskLedger, or with an OAuth token that has ledger:write (Pro and Enterprise). API keys cannot upload.

Authorization

bearer
headerAuthorizationBearer <token>

A company group API key (al_live_…, created at /dashboard/api), an OAuth access token from the same authorization flow MCP clients use, or (other LedgerSuite products, /administrations routes only) a LedgerSuite client_credentials token.

Path Parameters

administrationId*string

LedgerSuite administration id; its linked ledger is used

auditfileId*string

Auditfile id (auf_…)

Response Body

Accepted: the import is queued

application/json
  1. response
id*string

auf_…

administrationId*string
fileName*string
status*string

awaiting_upload: PUT the file to the upload URL, then complete; queued/processing: being imported; processed: the data is available; failed: see error

Value in"awaiting_upload""queued""processing""processed""failed"
sizeBytes*|null
version*|

XAF version: 3.2 or 4.0

fiscalYear*|

From the header, e.g. 2025 or 2025-2026

periodStart*|

Start of the period the file covers (YYYY-MM-DD)

periodEnd*|

End of the period the file covers (YYYY-MM-DD)

companyName*string|null
kvkNumber*|

KvK number in the file's header

software*|

Accounting package that made the file

error*|null
issues*array<>

Errors and warnings found in the file (at most 100)

counts*|

Imported records: relations, ledgerAccounts, vatCodes, journals, transactions, transactionLines, openingBalanceLines

createdAt*string
completedAt*string|null
processedAt*string|null
curl -X POST "https://example.com/administrations/string/auditfiles/string/complete"
{  "id": "string",  "administrationId": "string",  "fileName": "string",  "status": "awaiting_upload",  "sizeBytes": -9007199254740991,  "version": "string",  "fiscalYear": "string",  "periodStart": "string",  "periodEnd": "string",  "companyName": "string",  "kvkNumber": "string",  "software": "string",  "error": {    "code": "file_missing",    "message": "string"  },  "issues": [    {      "code": "string",      "severity": "error",      "message": "string",      "line": -9007199254740991,      "column": -9007199254740991    }  ],  "counts": {    "property1": 0,    "property2": 0  },  "createdAt": "string",  "completedAt": "string",  "processedAt": "string"}