Correcting data
Fix or remove what you pushed. Data in use is never deleted.
Every change and deletion keeps the previous version in history, stamped with the
datasetId of the import that made it.
| To | Do |
|---|---|
| Change a line's values | Re-send it with the same id (import again) |
| Remove a line or an opening-balance row | Delete it by id |
| Remove an account, dimension value or sub-ledger | Delete it, only while nothing uses it |
| Retire an account that has history | Import it with hidden: true |
| Retire an open item | Re-send it with sourceDeleted: true, or send a snapshot without it |
Re-send to fix
Imports merge by identity: lines and opening balances by id, accounts by accountCode,
dimension values by key, sub-ledger parties by partyKey. Re-send the corrected row
through the same import and it is updated in place.
Delete lines and opening-balance rows
curl -s -X POST \
https://api.prod.accountflow.com/v1/companies/$COMPANY/imports/general-ledger-lines/deletions \
-H "Authorization: Bearer $TOKEN" -H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{ "year": 2025, "ids": ["INV-2025-000123-1", "INV-2025-000123-2"] }'
- Opening balances:
POST …/imports/opening-balances/deletions, same body. - Up to 10 000 ids and 8 MiB per request. Ids follow the import rule (no
:,/,{,}or whitespace), or the request is422with the offending entries inerrors. - The answer is
202with an import of kindGENERAL_LEDGER_LINES_DELETION. Poll it. - A deletion and an import of the same kind don't run together for one company: the second
is
409,reason: job_in_flight.
When it has SUCCEEDED:
rowsDeletedcounts the deleted lines;result.unknownlists ids the ledger didn't have. It is not an error, so a deletion is safe to retry;- the trial balance is recomputed, and a voucher left without lines is gone;
- you may post a deleted
idagain; it starts a new line.
Data in use is never deleted
If any id in the request is in use in Accountflow, nothing is deleted:
{
"type": "https://api.accountflow.com/errors/conflict",
"status": 409,
"error": "conflict",
"reason": "lines_in_use",
"detail": "1 line(s) are in use and nothing was deleted: remove the dependent work in the application first, or post a reversing line instead",
"inUse": [
{ "id": "INV-2025-000123-2", "dependencies": ["match", "comment"] }
]
}
reason |
In use when |
|---|---|
lines_ |
A line is matched, reconciled against the bank, commented, flagged, part of an accrual, tied to an asset, or allocated in payroll. |
opening_ |
A row is split, itemised into open items, matched or commented. |
account_ |
The account has lines, opening balances, matches, reconciliations, adjustments, documents, access rules or payroll mappings. |
dimension_ |
A line or opening balance has ever referenced the value, or it has child values. |
sub_ |
A line, open item or opening balance has ever referenced it, or it has children. |
On a 409:
- Remove the dependent work in Accountflow (undo the match, delete the comment), then delete again; or
- post a reversing line, usually the right answer for a reconciled period; or
- for an account, import it with
hidden: true.
The check runs when you send the request. If someone starts work on a line before the job
runs, the import ends FAILED with the same failureReason and the inUse list under
result, and nothing is deleted. inUse names only the ids you sent. A correction can
also end FAILED with internal_error or job_expired (not picked up within 30
minutes); re-send it.
Delete an account, dimension value or sub-ledger
curl -s -X DELETE "https://api.prod.accountflow.com/v1/companies/$COMPANY/accounts/9000?year=2025" \
-H "Authorization: Bearer $TOKEN" -H "Idempotency-Key: $(uuidgen)"
curl -s -X DELETE https://api.prod.accountflow.com/v1/companies/$COMPANY/dimensions/DEPT-99 \
-H "Authorization: Bearer $TOKEN" -H "Idempotency-Key: $(uuidgen)"
curl -s -X DELETE https://api.prod.accountflow.com/v1/companies/$COMPANY/sub-ledgers/C-9999 \
-H "Authorization: Bearer $TOKEN" -H "Idempotency-Key: $(uuidgen)"
- The path parameters
{accountNumber},{key}and{partyKey}are theaccountCode, dimensionkeyandpartyKeyyou imported. yearon the account delete defaults to the current accounting year. Send it.- Answers:
202with an import to poll;404for no such object, or no ledger for that year;409as above, orreason: company_not_api_managedwhen that year's ledger belongs to another accounting system.
Not available
- Replacing a whole period. Lines merge by
id; delete what should go. - Rolling back a whole import. Delete the ids you pushed.
- Forcing the deletion of data in use.