Errors an agent can parse: 422 naming the field, 400 for a bad id, 401 for a bad key
When an agent posts a deal with an unrecognised stage value and gets back a 500 with an empty body, it has nothing to act on and no way to repair the call.
Fathom is not open yet, so anything on this page about what it does is what it is being built to do.

The error was written for a person who is not there
CRM APIs were built behind forms. A browser validates most of the body before the request leaves, so the server can afford to be vague: a human is already looking at the screen, and a human can guess what "Bad Request" meant. Vagueness costs almost nothing when the reader has context the response does not carry.
An agent has none of that. The model assembles the request body from whatever it read upstream, sends it, and the response body is the entire feedback channel. So the failure modes that are merely annoying to a developer are terminal to a loop:
- A 500 with an empty body tells the agent nothing about whether to retry, change the payload, or stop. Most agents retry, identically, until a limit is hit.
- A silent 200 on a write the server quietly dropped is worse: the agent proceeds on a state that does not exist.
- A generic failure with no field name sends the model guessing, which usually means rewriting fields that were correct.
Fathom is built the other way round on the paths an agent writes through. Writes to the five record collections are schema-validated before anything reaches the database, the three classifying actions check their Article 22 inputs server-side, and authentication is answered as authentication rather than as a mystery about the body. Three codes carry that, and they mean structurally different things.
422: the body reached the schema and did not validate
POST and PATCH on contacts, accounts, deals, leads and interactions are schema-validated before anything reaches the database. A missing required field, a wrong type, an unknown field, or an invalid enum value such as an unrecognised deal stage comes back as a 422 that names the field, rather than a 500 or a silent failure.
The three classifying actions use the same code for the same reason. qualify_lead, flag_churn_risk and assign_owner require human_review_ack and lawful_basis, enforced server-side, and the 422 body names exactly which of the two was missing or invalid, with each action tested against each field individually omitted.
If you read an earlier version of our docs, one section described the CRUD case as a 400 while the error table beside it said 422. The server returns 422 on both paths, and the docs now say so in one voice. Branch on 422 for anything the schema or the Article 22 gate rejected.
400: the request never got as far as a schema
400 is for a request that could not be looked up at all. A record id in the path that is not a uuid returns 400 with an invalid_id code on the five record collections, contacts, accounts, deals, leads and interactions, instead of passing the raw segment to a uuid column. The same guard bounds an out-of-range list parameter on those collections rather than handing the value to Postgres.
401: the key, not the body
Every /api/v1 route group, contacts, accounts, deals, leads, interactions, actions and webhooks, rejects a missing, invalid or malformed Authorization header with a 401. A key problem comes back as a key problem, so an agent never rewrites a correct payload because of an expired secret.
That is the scope of this page, stated exactly: 401 on every v1 route group, 422 on writes to the five record collections and on the Article 22 fields of the three classifying actions, and 400 invalid_id on record ids in those same five collections. Branch on those three and you are branching on behaviour that is covered by tests rather than inferred from one lucky curl.
What happens to a bad request
- The agent sends a write it composed itself
POST /api/v1/deals, or a PATCH on a lead, a contact, an account or an interaction, with a body the model built from its own reading of the conversation. No UI fields are required, so the only thing standing between the payload and the store is the schema.
- The key is checked before anything else
Authentication middleware answers a missing or invalid API key with 401 on every v1 route group, including malformed Authorization headers, so an auth failure is never dressed up as a data failure.
- The record id is checked before the database
On contacts, accounts, deals, leads and interactions, a record id that is not a uuid returns 400 invalid_id rather than reaching a uuid column, and list parameters on those collections are bounded rather than passed through.
- The body is validated, and the failing field is named
Schema validation runs on POST and PATCH for contacts, accounts, deals, leads and interactions. Missing required fields, wrong types, unknown fields and invalid enum values are caught at the boundary and answered with 422 naming the field, so a malformed write does not half-land.
- A classifying action without its Article 22 inputs comes back 422
qualify_lead, flag_churn_risk and assign_owner each check human_review_ack and lawful_basis server-side. The 422 body names exactly which of the two is missing or invalid, with each action tested against each field individually omitted.
- The field name the agent reads is the field name it was given
The six action endpoints are exposed as REST and as generated OpenAI function-calling and Anthropic tool-use schemas from one source of truth, so the property named in an error is the property the model already holds in its tool definition.
Status codes an agent can branch on
| What the agent sent | Status | What the response tells it |
|---|---|---|
| A write with no valid API key, or a malformed Authorization header | 401 | Authentication failed on the key, not the body. Every v1 route group answers the same way. |
| GET or DELETE on a contact, account, deal, lead or interaction id that is not a uuid | 400 | invalid_id: the path never reached a schema or the database. |
| POST /api/v1/deals with an unrecognised stage value | 422 | The field that failed validation and what was wrong with it. |
| PATCH on a contact with a required field omitted or the wrong type | 422 | The named field, rather than a 500 or a silent failure. |
| A write body carrying a field the object does not have | 422 | The unknown field is rejected at the boundary rather than quietly dropped. |
| qualify_lead without human_review_ack | 422 | JSON naming human_review_ack as the missing or invalid field. |
| flag_churn_risk without lawful_basis | 422 | JSON naming lawful_basis as the missing or invalid field. |
| assign_owner with human_review_ack omitted | 422 | JSON naming human_review_ack, not a generic error. |
What field-level errors buy you
Retries that converge instead of repeating
A named field turns a retry into a repair. The agent changes one property and resends, rather than resending the identical body until its attempt limit runs out.
The store stays clean because validation runs first
Invalid enum values, wrong types and unknown fields on contacts, accounts, deals, leads and interactions are rejected at the boundary, so a bad write never becomes a record another agent later reads as truth.
The Article 22 refusal is legible, not mysterious
human_review_ack and lawful_basis are enforced server-side on the three classifying actions, and each action is tested with each field individually omitted, so the 422 reliably says which one to attach.
Three failure classes your code can tell apart
401 means the key is wrong. 400 means a record id could not be looked up. 422 means the body parsed and the schema or the classifying gate refused it. Three branches, no string matching on error text.
Error field names your tool definition already knows
Because the REST surface and both generated tool schema formats come from one action definition, the property a 422 names is the property the model holds in its own tool schema. No mapping table between what the API calls a field and what the agent calls it.
Where this sits in the loop
The point of a headless sales backend is that no one is watching. If a human had to open a dashboard to find out why last night's qualify_lead calls stopped writing, the absence of a UI would be a liability rather than a design decision. Parseable errors are what make it a design decision: on the write paths, the response body carries what the caller needs to decide what to do next, because the response body is all there is.
That is the whole argument. An agent loop is only as reliable as the worst-described failure in it, and in most CRM APIs the worst-described failure is an unhandled exception on a value the schema should have rejected. Fathom is built so writes to the five record collections fail at the boundary, in a shape a model can read, with the field named, and so the three codes you branch on mean the same thing across those collections and the six action endpoints.
If you are wiring the action layer rather than the CRUD layer, the six action endpoints have their own page, and the worked OpenAI schema examples show the same property names an error will quote back to you. Agent platform builders calling Fathom from LangChain or CrewAI will find the tool-definition side covered there too.
Fathom is on a waitlist today. When it opens, the Developer plan is free and carries the full API surface: all six actions, both tool schema formats, webhooks with queued delivery and retry, per-key records and actions counters in the dashboard and from GET /api/v1/usage, a key per agent that is metered and revocable on its own, and limits of 1,000 stored records and 10,000 agent actions per month. That is enough to wire an agent loop end to end and watch it recover from its own bad bodies.
Questions
What status code does Fathom return for a malformed write body?
422, with the field named. Schema validation runs on POST and PATCH for contacts, accounts, deals, leads and interactions, so missing required fields, wrong types, unknown fields and invalid enum values such as an unrecognised deal stage return 422 naming what failed, rather than a 500 or a silent failure.
Did this used to be documented as a 400?
Yes, in one place. An earlier docs section described a malformed write as a 400 while the error table on the same page said 422; the server returns 422. Branch on 422 for anything the schema rejected, and treat 400 as the code for a request that never reached a schema.
What does Fathom return 400 for, then?
A record reference that cannot be looked up. On contacts, accounts, deals, leads and interactions, an id in the path that is not a uuid returns 400 with an invalid_id code instead of reaching a uuid column, and out-of-range list parameters on those collections are bounded rather than passed through to Postgres.
Which actions enforce human_review_ack and lawful_basis?
The three classifying actions: qualify_lead, flag_churn_risk and assign_owner. Both fields are required and enforced server-side, the 422 body names exactly which of the two was missing or invalid, and each action is tested with each field individually omitted.
Do the field names in errors match the names in my tool schema?
Yes. The six action endpoints are exposed as REST and as generated OpenAI function-calling and Anthropic tool-use JSON schemas from a single source of truth, so the property an error names is the property the model already holds in its tool definition.
What does an unauthenticated request return?
401. Authentication middleware rejects missing, invalid and malformed API keys with a 401 across every /api/v1 route group, contacts, accounts, deals, leads, interactions, actions and webhooks, so a key problem comes back as a key problem rather than as an opaque failure on the body.
Should my agent retry a 422?
Not with the same body. A 422 means the request parsed and was refused on purpose, by the schema or by the Article 22 gate, so an identical retry fails identically. Have the agent read the named field, change that one property, and resend; reserve blind retries for transport-level failures.
Can I try the error shapes before committing to a paid plan?
The Developer plan is free and carries the full API surface: all six actions, both tool schema formats, webhooks with queued delivery and retry, per-key counters, and limits of 1,000 stored records and 10,000 agent actions per month. Fathom is on a waitlist today, so join it to get access when it opens.