← Back to API

Errors

All API errors follow a consistent format.

Error response format

{
  "success": false,
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable description",
    "doc_url": "https://www.chatterforms.com/apidocs/errors#ERROR_CODE"
  },
  "meta": {
    "api_version": "2024-01-01"
  }
}

Some errors include extra fields (e.g. upgrade_url, required_plan for UPGRADE_REQUIRED).

Error codes

Authentication

CodeHTTPDescription
INVALID_API_KEY401Missing, invalid, or revoked API key

Request validation

CodeHTTPDescription
PROMPT_REQUIRED400Missing or empty prompt in create request
PROMPT_TOO_LONG400Prompt exceeds 4,000 characters
INVALID_REQUEST400Invalid parameters
UNSUPPORTED_MEDIA_TYPE415Request must be Content-Type: application/json
METHOD_NOT_ALLOWED405Wrong HTTP method

Plan restrictions

CodeHTTPDescription
UPGRADE_REQUIRED403Prompt requires a higher plan. Includes upgrade_url, required_plan

Not found

CodeHTTPDescription
NOT_FOUND404Form not found or not owned by your account

Server errors

CodeHTTPDescription
FORM_GENERATION_FAILED413, 500Generation failed
DELETE_FAILED500Failed to delete form
INTERNAL_ERROR500Unexpected server error

UPGRADE_REQUIRED (plan restriction)

When a prompt requires a feature above your plan:

{
  "success": false,
  "error": {
    "code": "UPGRADE_REQUIRED",
    "message": "e-signature requires a Basic plan or higher...",
    "doc_url": "https://www.chatterforms.com/apidocs/errors#UPGRADE_REQUIRED",
    "upgrade_url": "https://www.chatterforms.com/pricing?plan=basic",
    "required_plan": "basic"
  },
  "meta": { "api_version": "2024-01-01" }
}

Handling errors

Node.js:

const res = await fetch(url, options);
const json = await res.json();

if (!json.success) {
  const { code, message } = json.error;
  if (code === 'UPGRADE_REQUIRED') {
    console.log('Upgrade at:', json.error.upgrade_url);
  }
  throw new Error(`${code}: ${message}`);
}

Python:

response = requests.post(url, json=body, headers=headers)

if not response.json().get('success'):
    error = response.json()['error']
    if error['code'] == 'UPGRADE_REQUIRED':
        print('Upgrade at:', error['upgrade_url'])
    raise Exception(f"{error['code']}: {error['message']}")