Errors
Every error the API returns, as RFC 9457 problem details.
Branch on error, then on reason. Show detail to people; never parse it. A server
build fails if it can return a code that this page does not list.
{
"type": "https://api.accountflow.com/errors/resource-not-found",
"title": "Resource Not Found",
"status": 404,
"detail": "Resource not found",
"error": "resource_not_found",
"requestId": "6f1c2d3e-…"
}
type ends in the code with - for _. It is a name, not a URL to call.
Codes
| Code | Status | Meaning | What to do |
|---|---|---|---|
validation_ |
400 | The request is malformed: a missing or blank field, a value out of range (pageSize outside 1–200, period outside 1–12), an unparseable value. See reasons. |
Fix the request. detail, parameter and errors name the field. |
idempotency_ |
400 | A mutation without an Idempotency-Key header. |
Send a unique key per logical action. |
invalid_ |
400 | The cursor is expired, altered, from another client, or from a request with other filters. | Restart from the first page. |
unauthorized |
401 | No token, or a rejected one. WWW-Authenticate is a bare Bearer challenge without a token and has error="invalid_ for a rejected one; it does not say why. |
Fetch a new token; check audience and issuer. |
forbidden |
403 | Authenticated, but this action is denied. Example: a USER-mode client whose linked person is disabled or has left the organization. See reasons. | Check the client's provisioning in Accountflow. |
capability_ |
403 | This kind of principal can never do this: an MCP sign-in calling /, an interactive MCP session writing, an MCP sign-in where interactive AI sessions are switched off. |
Use an API client (client credentials) for /. |
insufficient_ |
403 | The token lacks a scope. WWW-Authenticate (scope="…") and requiredScope name it. |
Have the scope granted to the client. |
resource_ |
404 | No such id within your reach. Identical for "missing", "not yours" and "deleted". | Check the id and that the client belongs to the right organization. Don't retry. |
method_ |
405 | The path exists; the method doesn't. / answers POST only (Allow: POST). |
Check the reference. |
duplicate_ |
409 | It exists already: the same company number in the organization, policy name, assignment or rule. | Read the existing resource, or change the distinguishing field. |
conflict |
409 | The request is valid; the state is not: an expired upload slot, an archived policy, a missing GL mapping, an account template changed since its preview. See reasons. | Read reason and the extensions, resolve the state, retry. |
deleted_ |
409 | The company was deleted with its organization; it can't be restored alone. | Restore the organization. |
idempotency_ |
409 | The first request with this key is still running. Retry-After is set. |
Retry with the same key. |
payload_ |
413 | More than 10 000 lines in one import request (limit), or a body over 8 MiB (refused before parsing). |
Split the data and send the requests one after another. |
unsupported_ |
415 | The declared content type is not accepted. supported lists the accepted ones. |
Use an accepted type; the reference lists types and size caps. |
unprocessable |
422 | Well-formed, but a rule refuses it: an unknown role, a company of another organization on a rule, a file over its type's cap, an upload whose content is another type (it is deleted), an invalid organization number, a forbidden character in an id, a reference to data that does not exist. See reasons. | Fix the data. detail names the rule; errors lists the lines. |
idempotency_ |
422 | The key was used within 24 hours on the same operation with a different body. | Use a new key per logical action. |
malware_ |
422 | The file failed the virus scan at POST /. It is deleted; no document is created. |
Don't resend that file. Upload a clean file to the same slot while its URL is valid, or start a new upload. |
rate_ |
429 | Over the plan quota. Retry-After and retryAfterSeconds say when to retry. |
Back off as told. |
internal_ |
500 | A server bug. | Retry with the same Idempotency-Key; report the requestId if it persists. |
not_ |
501 | Reserved. No operation returns it. | Report the requestId if you see it. |
service_ |
503 | A dependency is down: authorization, the import engine, the semantic layer, or the virus scanner at upload completion (the file is kept). Never wrong data. Retry-After is set. |
Retry with backoff and the same Idempotency-Key. |
Reasons
reason narrows a code. The common ones are below; the spec's Problem schema and each
operation's error examples have the full set.
reason |
Code | Meaning | Extensions |
|---|---|---|---|
mode_ |
validation_ |
An import mode other than MERGE. |
|
parameter_ |
validation_ |
A query parameter under a retired name (periodYear). detail names the replacement (year). |
parameter |
account_ |
validation_ |
year is not the accounting year of the accountId beside it. |
parameter |
default_ |
validation_ |
isDefault: true on an access policy. The flag grants nothing. |
|
threshold_, threshold_, threshold_, threshold_ |
validation_ |
A currency control's thresholds are invalid. | |
feature_ |
forbidden |
The comment or flag type's module is off for the company. | feature |
origin_ |
forbidden |
An / request from a browser Origin that is not allowed. A request without Origin passes. Report-only for now: logged, not refused. |
|
association_ |
duplicate_ |
The document already has this connection. | connectionId |
intercompany_ |
duplicate_ |
Another line of the intercompany link uses that pairing key. | pairingKey |
job_ |
conflict |
A job of the same kind runs for the same scope. | jobId |
upload_ |
conflict |
The document was completed before its file was PUT to the signed URL. |
|
already_ |
conflict |
GL lines or bank transactions are already in a reconciliation group. | lineIds, bankTransactionIds |
opening_ |
conflict |
Opening-balance rows are part of a settlement; remove it before reconciling them against the bank. | lineIds |
bank_ |
conflict |
The group's bank transactions come from bank accounts that don't feed the same GL account. | bankAccountIds, erpAccountCode |
restricted_ |
conflict |
An access-policy update would drop a template or account rule. Send it back, or state resourceScope. |
companyIds, portfolioIds |
portfolio_ |
conflict |
An access-policy update would replace portfolio rules with an all-companies rule. | portfolioIds |
company_ |
conflict |
The company, or the year's ledger, is not on the Api accounting system. | |
lines_, opening_, account_, dimension_, sub_ |
conflict |
A deletion names data that work in Accountflow depends on. Nothing was deleted. See corrections. | inUse |
intercompany_, intercompany_, intercompany_, intercompany_ |
conflict |
That part of the account is on another intercompany link. | definitionId, active, counterparty |
fiscal_ |
conflict |
The fiscal year would overlap another of the company's years. | accountingYear |
ledger_ |
conflict |
The year already has an Api ledger. | ledgerId |
fetch_ |
conflict |
An Api ledger was requested while an ERP fetch runs. | |
foreign_ |
conflict |
A trial balance into a year holding lines or opening balances you pushed yourself. | |
trial_ |
conflict |
General-ledger lines or opening balances into a year loaded as a trial balance. | |
trial_ |
conflict |
The trial-balance import is not switched on in this environment. | |
company_ |
conflict |
The company's organization was terminated. Reads work for 90 days, writes are refused; after that the company is 404. Not resolvable through the API. |
|
unknown_ |
unprocessable |
Account codes missing from the year's chart. | accountCodes |
bank_ |
unprocessable |
The group's bank transactions are in more than one currency, or a line has no amount in the bank's currency. | currencies, currency |
confirmation_ |
unprocessable |
An account-template apply with unconfirmed warnings. Have a person confirm them, then send them as confirmedWarnings. |
warnings |
fiscal_, fiscal_ |
unprocessable |
Fiscal-year fields that are not twelve months from the first of a month, or that contradict each other. | |
fiscal_ |
unprocessable |
A company update naming another fiscal-year start month. Change it in Accountflow. |
A settings write whose version is stale is conflict with currentVersion or
currentRevision: read the settings again and re-apply your change.
An MCP-Protocol-Version header naming a version /mcp does not support is
validation_failed with parameter and supported. Like the Origin check, it is
report-only for now.
Problem extension fields
Every problem has error and requestId (the X-Request-Id header's value) beside the
RFC 9457 members (type, title, status, detail, instance). The spec's Problem
schema declares every extension. These are the common ones; each appears only when it
applies.
| Extension | Type | On | Meaning |
|---|---|---|---|
reason |
string | conflict, unprocessable, forbidden, validation_ |
The rule that fired. |
errors |
array of items | validation_, unprocessable |
Field-level detail, up to 100 items. |
parameter |
string | validation_, invalid_ |
The parameter or header at fault (pageSize, cursor, year, MCP-Protocol-Version). |
currentVersion |
string | conflict on a settings write |
The settings' version now. |
currentRevision |
integer | conflict on an account settings write |
The account's settingsRevision now. |
inUse |
array of {id, dependencies} |
conflict, reason: *_ |
Your ids or keys that are in use, and what uses them. Never an internal id. |
accountCodes |
array of strings | unknown_ |
The missing codes. |
warnings |
array of strings | confirmation_ |
Unconfirmed template warnings: TEMPLATE_, DOCUMENTATION_, AUTO_. |
definitionId, active, counterparty |
UUID, boolean, string | reason: intercompany_ |
The link that holds that part of the account. |
jobId |
UUID | job_ |
The blocking job. Poll it. |
limit |
integer | payload_ |
The cap that was exceeded. |
retryAfterSeconds |
integer | rate_, service_, idempotency_ |
Retry-After as a number. |
requiredScope |
string | insufficient_ |
The missing scope. |
supported |
array of strings | unsupported_, validation_ |
The accepted media types, or MCP protocol versions. |
The errors item
{ "field": "lines[12].amount", "message": "amount is required", "index": 12 }
| Field | Meaning |
|---|---|
field |
The field at fault; empty when a whole line is malformed. |
message |
For people. Don't branch on it. |
index |
The element of a request array, 0-based. Only when the error addresses one. |
allowedValues |
The accepted values, when the field is an enumeration. |
Every validation_failed and unprocessable uses this one shape.