API Error Codes: 404 vs 451 Explained
By Kooperativa Engineering
Most APIs treat "record not found" as a single case with a single status code. That is usually fine, until the dataset also has to support the right to erasure under privacy law, at which point conflating two genuinely different situations under one status code starts actively misleading callers.
The two situations that get conflated
A 404 should mean: this specific record has not been indexed yet, or the identifier does not match anything we hold. It is worth retrying later, or trying a different identifier for the same target. A 451 should mean something categorically different: this record existed, was withdrawn under a legal erasure request, and will not come back for any identifier pointing at that same person.
A stable error code table
A caller should be able to switch on a stable code field rather than parsing the human-readable message, since the wording of that message can change at any time without warning:
- 404 NOT_FOUND: not indexed yet, retry later or try another identifier.
- 451 DATA_SUBJECT_BLOCKED: withdrawn under privacy law, permanent, do not retry.
- 429 RATE_LIMIT_EXCEEDED: too many requests, wait for the Retry-After duration.
- 402 LICENSE_INACTIVE: the account or workspace has no active license, not a per-record issue at all.
- 503 UPSTREAM_UNAVAILABLE: a transient failure on the provider side, safe to retry with backoff.
The retry-logic bug this distinction actually prevents
A client that treats every non-2xx response the same way and retries everything will eventually hammer a 451 endpoint indefinitely for a record that will never return, wasting calls and, more importantly, repeatedly re-requesting data about someone who specifically asked for it to be removed. Coding against the specific status code, not just "success or failure," is the only way to build a retry policy that behaves correctly for both cases.
Get started
Try Kooperativa
One API key. Person and company enrichment, structured search, and monitors under one flat license.
