CRM Factory logoCRM Factory

Errors

Error response format and status codes.

All API errors return a JSON object with an error field and an appropriate HTTP status code.

Error Format

{
  "error": "Human-readable error message"
}

For validation errors (422), the error field contains a JSON-stringified array of Zod validation issues:

{
  "error": "[{\"code\":\"too_small\",\"minimum\":1,\"type\":\"string\",\"inclusive\":true,\"exact\":false,\"message\":\"String must contain at least 1 character(s)\",\"path\":[\"name\"]}]"
}

Status Codes

CodeMeaningWhen
200OKSuccessful read or update
201CreatedRecord successfully created
307RedirectFile download (redirects to signed URL)
400Bad RequestMalformed request or missing required fields
401UnauthorizedMissing or invalid authentication
403ForbiddenAuthenticated but insufficient permissions
404Not FoundRecord does not exist
409ConflictDuplicate or state conflict (e.g., lead already converted)
422Unprocessable EntityRequest body fails Zod validation
500Internal Server ErrorUnexpected server error

OAuth Error Format

The /api/oauth/token endpoint uses the standard OAuth 2.0 error format:

{
  "error": "invalid_grant",
  "error_description": "Authorization code is invalid or expired"
}
Error CodeDescription
unsupported_grant_typeOnly authorization_code is supported
invalid_requestMissing required OAuth parameters
invalid_clientUnknown client or client authentication failed
invalid_grantCode expired, already used, PKCE mismatch, or redirect URI mismatch

On this page