Skip to Content
DeveloperAPI ReferenceError Handling

Error Handling

Understanding and handling API errors in HealthTalk.

Error Response Format

All errors return a consistent JSON structure:

{ "error": { "code": "INVALID_REQUEST", "message": "The request body is missing required field 'patientId'", "details": { "field": "patientId", "reason": "required" } } }

HTTP Status Codes

StatusDescription
200Success
201Created
400Bad Request - Invalid parameters
401Unauthorized - Invalid authentication
403Forbidden - Insufficient permissions
404Not Found - Resource doesn’t exist
409Conflict - Resource already exists
422Unprocessable - Validation failed
429Too Many Requests - Rate limit exceeded
500Internal Server Error
503Service Unavailable

Error Codes

Authentication Errors

CodeDescription
INVALID_SIGNATUREHMAC signature verification failed
EXPIRED_TIMESTAMPRequest timestamp too old
INVALID_TENANTTenant ID not recognized

Validation Errors

CodeDescription
INVALID_REQUESTRequest body malformed
MISSING_FIELDRequired field not provided
INVALID_FORMATField format incorrect

Resource Errors

CodeDescription
PATIENT_NOT_FOUNDPatient ID doesn’t exist
TEMPLATE_NOT_FOUNDTemplate ID doesn’t exist
MESSAGE_NOT_FOUNDMessage ID doesn’t exist

Best Practices

  • Always check HTTP status codes
  • Log error details for debugging
  • Implement exponential backoff for retries
  • Handle rate limits gracefully
Last updated on