Error codes

Every error response carries a machine-readable code, a human-readable message, a requestId, and a docs link pointing back here.

Envelope

{ "error": {
    "code":      "insufficient_credits",
    "message":   "You need 150 credits but have 40.",
    "docs":      "https://www.planmysaas.com/docs/api/errors",
    "requestId": "a1b2c3…"
  } }

Authentication (401)

CodeMeaningFix
missing_api_key No key in X-API-Key or Authorization header.Pass the key — see auth docs.
malformed_api_key Key doesn't match the pms_live_… shape.Copy the key exactly as shown — no whitespace or quotes.
invalid_api_key Key hash not found.Generate a new key in Settings.
revoked_api_key Key was explicitly revoked.Generate a new one. Revoked keys can't be reactivated.

Input validation (400)

CodeMeaning
invalid_json Body isn't valid JSON.
invalid_input Body parsed but failed Zod validation. message names the offending field.

Authorisation (402 / 403)

CodeStatusMeaningFix
insufficient_credits402Workspace balance is less than the tool's cost.Upgrade plan or wait for monthly refresh. See plans.
plan_gate 403Tool requires a higher plan tier (e.g. Starter+).Upgrade at /pricing.
regen_limit 403Per-project regen cap reached on Free / Starter.Upgrade to Pro for unlimited regenerations.

Rate limits (429)

CodeMeaning
rate_limited60 req/min per-key exceeded. Wait Retry-After seconds.

Upstream / generation (502 / 504)

CodeStatusMeaningFix
generation_failed 502The upstream AI backend returned an error or invalid JSON.Retry. No credits charged on this response.
generation_timeout 504Generation didn't return before the tool's timeout (90s-5min).Break up very long inputs and retry.

Not found (404)

CodeMeaning
workspace_not_foundThe workspace linked to this key was deleted.

Server (500)

CodeMeaning
preflight_failedInternal error during credit preflight. Retry; if it persists, include requestId in a support ticket.

When to retry

  • Retry immediately: none — always wait a beat.
  • Retry after backoff: 429 (honour Retry-After), 502/504 (exponential 1s → 2s → 4s → stop).
  • Don't retry: 4xx except 429 — fix the input or credentials.

Still stuck? Include the requestId from the failing response in a support ticket at support@planmysaas.com.