Skip to content

Errors

Every error has the same shape:

{
"code": "PERMISSION_DENIED",
"message": "You don't have permission to do that.",
"request_id": "req_8f14e45fceea167a5a36dedd4bea2543",
"details": { "permission": "ticket.reply" }
}
  • code is stable. Write your code against it.
  • message is for people and may change. Log it, don’t parse it.
  • request_id identifies the request (also in the X-Request-ID header). Quote it to support.
  • details adds specifics for some codes, such as the missing permission or the invalid fields.
Status Means Retry?
400 The request is invalid: bad JSON, a missing or wrong field No: fix the request
401 No API key, or it isn’t valid No: fix the key
403 The key may not do this, or the plan doesn’t include it No
404 It doesn’t exist, or the key can’t see it No
409 It conflicts with the current state: closed, already done, someone changed it first, a limit is reached Usually no: read the current state first
429 Too many requests Yes, after Retry-After seconds
500, 502, 503, 504 Something went wrong on our side Yes, with backoff (safe for GET, and for POST with an Idempotency-Key)

400 VALIDATION_FAILED names each invalid field and the rule it broke:

{
"code": "VALIDATION_FAILED",
"message": "One or more fields are invalid.",
"details": { "fields": { "email": "email", "subject": "required" } }
}

400 MALFORMED_JSON means the body isn’t valid JSON.

Code What happened
UNAUTHENTICATED No API key was sent (or it was sent for another organization’s URL)
API_KEY_INVALID The key is unknown, revoked or expired, or its owner left
PERMISSION_DENIED The key’s scopes don’t cover this. details.permission names what’s needed
PLAN_FEATURE_UNAVAILABLE Your plan doesn’t include this. details.feature names it
SUBSCRIPTION_INACTIVE The organization’s subscription has lapsed
ORGANIZATION_NOT_FOUND, PRODUCT_NOT_FOUND, TICKET_NOT_FOUND, CUSTOMER_NOT_FOUND, CONVERSATION_NOT_FOUND Not found, or not visible to this key
PRODUCT_SUSPENDED The product is suspended and read-only
PRODUCT_NOT_ACTIVE The product is archived and takes nothing new
TICKET_VERSION_CONFLICT, REVISION_CONFLICT Someone changed it since you read it. Read it again, then retry
INVALID_STATUS_TRANSITION A ticket can’t move to that status from its current one
TICKET_CLOSED, CONVERSATION_CLOSED It’s closed and takes no more replies
CONVERSATION_NOT_YOURS Someone else is handling this chat
CHANNEL_REPLY_WINDOW_CLOSED WhatsApp only allows a free-form reply within 24 hours of the customer’s last message. Send a template instead
IDEMPOTENCY_KEY_REUSED, CLIENT_MESSAGE_ID_REUSED The same key or message ID was used for a different request
CONTACT_LIMIT_REACHED, FAQ_LIMIT_REACHED, ARTICLE_LIMIT_REACHED, STORAGE_LIMIT_REACHED A plan limit is reached
RATE_LIMITED Too many requests. See rate limits

Each endpoint in the API reference lists the codes it can answer.

async function supportaka(path, init = {}) {
const res = await fetch(`https://api.supportaka.com/api/v1${path}`, {
...init,
headers: { Authorization: `Bearer ${process.env.SUPPORTAKA_KEY}`, 'Content-Type': 'application/json', ...init.headers },
});
if (res.ok) return res.status === 204 ? null : res.json();
const error = await res.json().catch(() => ({ code: 'UNKNOWN', message: res.statusText }));
const err = new Error(`${error.code}: ${error.message} (request ${error.request_id})`);
err.status = res.status;
err.code = error.code;
err.details = error.details;
err.retryAfter = Number(res.headers.get('Retry-After')) || null;
throw err;
}