Every refusal carries a stable machine-readable code
A client has to be able to tell one refusal from another without reading English. Codes are the contract; the message is for a person.
The rule
- Every refusal an API endpoint emits MUST carry a stable, machine-readable
error_codealongside the human-readableerrorstring. - Message text is never contract: a client MUST NOT classify a refusal by matching its message, and an implementation MUST NOT treat wording as load-bearing.
- A code MUST have one published definition that a client and a test can both name by it.
- Once published, a code's meaning MUST NOT change.
- A published code MUST NOT be reused.
What it means
The human-readable message on a refusal is for a person; it is never what a
client is allowed to match against. A client that classifies a refusal by
matching a substring of the message is reading a field that can be reworded
at will, and a rewording that drops the substring it depended on
reclassifies the refusal without anything failing anywhere. The error_code
exists so a client never has to do that.
A code, once published, keeps its meaning forever and is never reused for something else — the same status code can and does cover more than one reason, and the code is what tells those reasons apart.
Example
Two refusals on sibling endpoints share a status and nothing else.
POST /api/flowdrop/pipeline/{pipeline_id}/resume
{}POST /api/flowdrop/pipeline/{pipeline_id}/cancel
{}Both are 409s; the code is what a client reads to tell one from the other.
The paths are examples of the routes API-9 names pipeline_resume and
pipeline_cancel.