Skip to content

Errors

Every Open API error comes in the standard RFC 9457 (Problem Details) format with the Content-Type: application/problem+json header. The HTTP status of the response matches the status field in the body.

HTTP/1.1 404 Not Found
Content-Type: application/problem+json
{
"type": "https://open.jecrm.org/errors#DEAL_NOT_FOUND",
"title": "Deal not found",
"status": 404,
"detail": "Deal not found.",
"instance": "/v1/deals/3f2a1c7e-5b1d-4f0e-9c3a-2b8d6e4f1a90",
"code": "DEAL_NOT_FOUND",
"timestamp": "2026-11-17T10:00:00.000Z"
}
Field Meaning
code Machine-readable error code. Handle errors by this field, not by title or detail.
status HTTP status (a number).
title Short name of the error. The same for every error with the same code.
detail Explanation of this particular case, for the developer. The text may change.
type Link to the error description on open.jecrm.org/errors.
instance Path of the request that caused the error.
timestamp Time of the error (UTC, ISO 8601).
errors Only for VALIDATION_ERROR: the list of invalid parameters.
retry_after Only for RATE_LIMIT_EXCEEDED: how many seconds to wait before retrying.

Successful responses keep the same format as before ({ "status": true, "status_code": 200, "data": … }).

Status When What to do
400 Invalid parameters or request body Fix the request. Retrying unchanged will not help.
401 The API key is missing or wrong Check the key. See Where to get the API key.
404 The record does not exist or belongs to another company; unknown URL Check the id and the request URL.
413 The file is larger than 25 MB Make the file smaller.
429 Too many requests Wait Retry-After seconds and retry.
500 Unexpected server error Retry later. If it keeps happening, contact support with instance and timestamp.

If a request parameter is invalid (in the query, the path or the body), the API returns 400 with the VALIDATION_ERROR code. The errors field lists all problems at once, not just the first one:

{
"type": "https://open.jecrm.org/errors#VALIDATION_ERROR",
"title": "Request parameters are invalid",
"status": 400,
"detail": "Invalid parameters: status, limit.",
"instance": "/v1/tasks?limit=500&status=FOO",
"code": "VALIDATION_ERROR",
"timestamp": "2026-11-17T10:00:00.000Z",
"errors": [
{ "field": "status", "rule": "isEnum", "detail": "each value in status must be one of the following values: NEW, IN_PROGRESS, REVIEW, POSTPONED, CANCELLED, DONE" },
{ "field": "limit", "rule": "max", "detail": "limit must not be greater than 100" }
]
}
  • field: the parameter name. Nested fields use dots, for example attachments.0.url.
  • rule: the check that failed (isUuid, max, isEnum, isDateString and so on). One field can have several entries.
  • detail: description of the problem in English.

If the key is missing or wrong, the API returns 401 with the WWW-Authenticate: ApiKey header="x-api-key" header:

  • API_KEY_NOT_FOUND: no key was sent.
  • API_KEY_INVALID: the key does not belong to any company. It is wrong, deleted or regenerated.

When the rate limit (200 requests per second per company) is exceeded, the API returns 429 with the RATE_LIMIT_EXCEEDED code. How many seconds to wait is in the Retry-After header and the retry_after field.

Code Status When it happens
VALIDATION_ERROR 400 Invalid query, path or body parameter. Details in errors.
BAD_REQUEST 400 The request could not be parsed, for example broken JSON.
CHAT_CREATED_DATE_FILTER_INVALID 400 created_at is combined with created_from / created_to.
CHAT_UPDATED_DATE_FILTER_INVALID 400 updated_at is combined with updated_from / updated_to.
CHAT_DATE_FILTER_INVALID 400 A chat date filter is not a valid date.
WEBHOOK_EVENT_INVALID 400 The webhook subscription contains an unsupported event.
WEBHOOK_URL_INVALID 400 The webhook URL is invalid, is not https or points to a private network.
API_KEY_NOT_FOUND 401 No API key was sent.
API_KEY_INVALID 401 The API key does not belong to any company.
NOT_FOUND 404 The URL (route) does not exist.
CHAT_NOT_FOUND 404 The chat does not exist or belongs to another company.
MESSAGE_NOT_FOUND 404 The message does not exist or belongs to another company.
FUNNEL_NOT_FOUND 404 The funnel does not exist or belongs to another company.
LEAD_NOT_FOUND 404 The lead does not exist, belongs to another company or is a deal (use /v1/deals).
DEAL_NOT_FOUND 404 The deal does not exist, belongs to another company or is a lead (use /v1/leads).
CONTACT_NOT_FOUND 404 The contact does not exist or belongs to another company.
CLIENT_COMPANY_NOT_FOUND 404 The client company does not exist or belongs to another company.
PRODUCT_NOT_FOUND 404 The product does not exist or belongs to another company.
PAYMENT_NOT_FOUND 404 The payment does not exist or belongs to another company.
TASK_NOT_FOUND 404 The task does not exist or belongs to another company.
PAYLOAD_TOO_LARGE 413 The file exceeds the 25 MB limit.
RATE_LIMIT_EXCEEDED 429 Too many requests.
INTERNAL_ERROR 500 Unexpected server error.

The current list of codes is always on open.jecrm.org/errors. The link in the type field opens the matching row there.

On error, MCP server tools return isError: true, and the response text holds the same error body as the REST API, only without the instance field. If a tool gets invalid arguments (a wrong uuid, date, enum value or limit), the call is rejected before it runs, with MCP error -32602 and a description of the field.

const res = await fetch(url, { headers: { 'x-api-key': KEY } });
if (!res.ok) {
const problem = await res.json();
switch (problem.code) {
case 'RATE_LIMIT_EXCEEDED':
await sleep(problem.retry_after * 1000);
return retry();
case 'DEAL_NOT_FOUND':
return null;
case 'VALIDATION_ERROR':
throw new Error(problem.errors.map((e) => `${e.field}: ${e.detail}`).join('; '));
default:
throw new Error(`${problem.code}: ${problem.detail}`);
}
}

Errors used to come in the { "status": false, "status_code": …, "errors": [{ "code", "message" }], "data": null } wrapper. What changed:

  • errors[0].code → code, errors[0].message → title or detail.
  • status_code → status. Note: status is now a number, not true / false.
  • “Not found” (*_NOT_FOUND) is now 404 instead of 400.
  • Key problems are now 401 instead of 400. A wrong key has the API_KEY_INVALID code instead of COMPANY_NOT_FOUND.
  • Validation errors have the VALIDATION_ERROR code with a list of fields (previously INTERNAL_ERROR).
  • An invalid webhook event or URL is now 400 (previously 500).

See also: Open API, MCP server.