Skip to content

Errors & conventions

This page covers the conventions that apply across the whole REST API: status codes, the response shape, and how updates (PATCH) work.

The API uses standard HTTP status codes. The exact codes per endpoint are in the reference; the common ones:

StatusMeaningWhat to do
200 OKRequest succeededRead the body
201 CreatedResource createdRead the created resource / its id
204 No ContentSuccess, no body (e.g. delete)Nothing to parse
400 Bad RequestMalformed request or invalid fieldFix the request; do not retry unchanged
401 UnauthorizedMissing/expired access tokenLog in again via login-api-token (or refresh)
403 ForbiddenToken lacks permission / wrong scopeUse a token with the right scope
404 Not FoundNo such resourceCheck the id / path
409 ConflictState conflict (e.g. not patchable now)Resolve state, then retry
422 Unprocessable EntityValidation failedFix the offending fields
429 Too Many RequestsRate limitedBack off and retry later
5xxServer errorRetry with back-off

Retry only what is safe: retry 429 and 5xx with exponential back-off. Do not blindly retry 4xx (other than 429) — the request needs changing first.

  • Listing responses carry the records plus pagination metadata (the cursor used by pagination).
  • Single-resource responses return the resource object.
  • Errors return a body describing what went wrong. Always read the response body on a non-2xx status — it explains the failure.

Because field-level shapes are defined per endpoint, treat the interactive reference as the source of truth for exact property names, and code defensively against optional fields.

async function call(path, init) {
const res = await fetch(`${BASE}${path}`, init);
if (!res.ok) {
// Read the body for the error detail before throwing.
const detail = await res.text();
throw new Error(`MendriX ${res.status} on ${path}: ${detail}`);
}
return res.status === 204 ? null : res.json();
}

Updates are performed with PATCH using merge-patch semantics:

  • Only the fields you send are changed. Omitted fields are left untouched.
  • To send a partial update, include just the properties you want to modify.
Terminal window
# Update only the client's phone number; everything else is untouched.
curl -X PATCH \
"https://<your-client-name>.api.mendrix.cloud/api/client/clients/CLIENT_ID" \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "phone": "+31 20 123 4567" }'
  • Reads are safe to repeat.
  • PATCH with the same body is naturally idempotent — re-sending it lands the same state.
  • For create-style operations, guard against duplicates on your side (track what you have already sent) since there is no global idempotency-key header.