Kwill

Errors

How the Kwill API signals errors and what each status code means.

Every error response from the Kwill API has the same JSON shape:

{
  "error": "Invalid or missing API key.",
  "code": "unauthorized"
}
  • error — a human-readable description, useful for logs and debugging. Do not parse it programmatically — it can change without notice.
  • code — an optional machine-readable code you can branch on in code. Present on well-known error types (see below).

HTTP status codes

StatusMeaningCommon causes
400 Bad RequestThe request body or query parameters are invalid.Missing required field, wrong type, invalid UUID.
401 UnauthorizedAuthentication failed.Missing or revoked API key, malformed Authorization header.
403 ForbiddenAuthenticated but not allowed.Insufficient plan, frozen workspace, or attempting a write during a freeze.
404 Not FoundThe resource does not exist in your workspace.Wrong ID, or the resource was deleted.
409 ConflictDuplicate resource.Creating a client with an email that already exists. The response includes existingClientId.
429 Too Many RequestsRate limit exceeded.See Rate limits.
500 Internal Server ErrorAn unexpected server-side error.Rare. If it persists, contact support.

Machine-readable error codes

Several code values deserve special handling:

plan_required

{
  "error": "API access requires the Studio plan or above.",
  "code": "plan_required",
  "feature": "api",
  "currentPlan": "free",
  "requiredPlan": "studio",
  "upgradeUrl": "https://usekwill.com/settings/billing/upgrade"
}

Your workspace is not on a qualifying plan. Upgrade to Studio or above in Settings → Billing to gain API access.

account_frozen

{
  "error": "Your workspace is frozen. Writes are disabled.",
  "code": "account_frozen"
}

Your workspace has been frozen (typically due to a failed payment). While frozen:

  • Reads (GET requests) continue to work normally.
  • Writes (POST, PATCH, DELETE) return 403 with this code — except webhook deletions, which are still allowed.
  • Webhook events are not emitted; there is no backfill when the workspace is unfrozen.

To unfreeze, resolve the billing issue in Settings → Billing.


Handling errors in code

const res = await fetch('https://usekwill.com/api/v1/clients', {
  headers: { Authorization: `Bearer ${process.env.KWILL_API_KEY}` },
});

if (!res.ok) {
  const body = await res.json();

  if (body.code === 'plan_required') {
    throw new Error('Upgrade to Studio to use the Kwill API.');
  }
  if (body.code === 'account_frozen') {
    throw new Error('Workspace is frozen — resolve billing to resume writes.');
  }

  throw new Error(`Kwill API error ${res.status}: ${body.error}`);
}

On this page