Skip to content

Errors

All errors follow a uniform format with a standard HTTP code and a stable business code for easy programmatic handling.

{
"code": "CUSTOMER_NOT_FOUND",
"message": "Client non trouvé",
"details": { /* optional */ }
}
  • code: stable identifier — branch your logic on this, not on message
  • message: user-facing French phrase (may change across versions)
  • details: optional object with extra info (e.g. validation errors per field)
{
"code": "VALIDATION_ERROR",
"message": "Requête invalide",
"details": {
"email": ["Requis pour la création"],
"name": ["Requis pour la création"]
}
}
HTTP codeBusiness codeWhen?
401AUTH_API_KEY_MISSINGX-API-Key header missing
401AUTH_API_KEY_INVALIDMalformed key or no matching app
403AUTH_API_KEY_FORBIDDENPublic key (pk_live_) used on a server-only route
HTTP codeBusiness codeWhen?
400VALIDATION_ERRORInvalid body — see details for per-field breakdown
HTTP codeBusiness codeWhen?
404CUSTOMER_NOT_FOUNDUnknown externalId in your app
409CUSTOMER_EMAIL_EXISTSEmail already taken by another customer in your app
HTTP codeBusiness codeWhen?
403PLAN_LIMIT_REACHEDMonthly ticket quota reached
404TICKET_NOT_FOUNDUnknown ticket ID (read routes)
HTTP codeBusiness codeWhen?
429TOO_MANY_REQUESTSGlobal rate limit exceeded (3 req/s, 20 req/10s, 100 req/min)
500INTERNAL_ERRORServer error — report to support if persistent
  • Retry only on 5xx and 429. On a 4xx, fix the request rather than retry.
  • Exponential backoff on 429: 1s, 2s, 4s, 8s…
  • Branch on the business code, not on the French message which may evolve.
  • Log code + details for your internal traces.
async function callSupportDesk(path, body) {
const res = await fetch(`https://supportdesk.innovartx.com/api/v1${path}`, {
method: 'POST',
headers: {
'X-API-Key': process.env.SUPPORTDESK_API_KEY,
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
});
if (!res.ok) {
const err = await res.json().catch(() => null);
const code = err?.code ?? 'UNKNOWN';
if (code === 'CUSTOMER_NOT_FOUND') {
// custom business logic
}
throw new Error(`SupportDesk ${res.status} ${code}`);
}
return res.json();
}